Skip to content

Commit e6e016a

Browse files
feat: Accept intent creation without a fixed status
Stainless-Generated-From: e2f63de376db35944d1bb3d31420d804f66d36b4
1 parent fc4b0de commit e6e016a

11 files changed

Lines changed: 345 additions & 98 deletions

‎api.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -611,6 +611,7 @@ from kernel.types.vaults import (
611611
OnePasswordRecoverVaultItemOperationRequest,
612612
OnePasswordRequestAccessVaultItemOperationRequest,
613613
PrepareCheckoutVaultItemOperationRequest,
614+
RestartVerificationVaultItemOperationRequest,
614615
VaultCardAliases,
615616
VaultCardFillField,
616617
VaultCheckoutContext,

‎src/kernel/resources/vaults/items.py‎

Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -440,6 +440,53 @@ def perform_operation(
440440
"""
441441
...
442442

443+
@overload
444+
def perform_operation(
445+
self,
446+
key: str,
447+
*,
448+
id_or_name: str,
449+
type: Literal["restart_verification"],
450+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
451+
# The extra values given here take precedence over values defined on the client or passed to this method.
452+
extra_headers: Headers | None = None,
453+
extra_query: Query | None = None,
454+
extra_body: Body | None = None,
455+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
456+
) -> VaultItemOperationResponse:
457+
"""
458+
Retrieve the item first and invoke only an operation listed in
459+
`available_operations`, following its natural-language description. Availability
460+
is rechecked at execution time; unavailable operations return 409. Authorization
461+
and preparation may call an external provider and return updated state. Link
462+
cards advertise authorize without checkout context. Eligible unused AgentCard
463+
cards advertise prepare_checkout, which requires checkout context and obtains
464+
device approval before native Square Pay. Keep the returned approval page open,
465+
poll until ready_to_submit, then submit before preparation.expires_at. Unused
466+
preparations expire automatically and cannot be reused. If spend-request
467+
creation is rejected with a non-retryable provider error, the card item is
468+
deleted and the provider's error code and message are returned. Rate limits
469+
return HTTP 429 and retain the card item; stop, back off, and retry the same
470+
authorize operation.
471+
472+
Fill returns a value-free execution result. Validation failures before writing
473+
return 400 (invalid request or targets), 403 (access or destination denied), 404
474+
(resource not found), or 409 (item or browser not ready). Once writing starts,
475+
known partial failures and indeterminate field outcomes return 200 with status
476+
`failed` or `unknown`. Fill never submits the page, so it is safe to retry after
477+
a failure, an `unknown` outcome, or a transport error.
478+
479+
Args:
480+
extra_headers: Send extra headers
481+
482+
extra_query: Add additional query parameters to the request
483+
484+
extra_body: Add additional JSON properties to the request
485+
486+
timeout: Override the client-level default timeout for this request, in seconds
487+
"""
488+
...
489+
443490
@overload
444491
def perform_operation(
445492
self,
@@ -1001,6 +1048,7 @@ def perform_operation(
10011048
*,
10021049
id_or_name: str,
10031050
type: Literal["authorize"]
1051+
| Literal["restart_verification"]
10041052
| Literal["confirm_transaction"]
10051053
| Literal["collect"]
10061054
| Literal["prepare_checkout"]
@@ -1689,6 +1737,53 @@ async def perform_operation(
16891737
"""
16901738
...
16911739

1740+
@overload
1741+
async def perform_operation(
1742+
self,
1743+
key: str,
1744+
*,
1745+
id_or_name: str,
1746+
type: Literal["restart_verification"],
1747+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
1748+
# The extra values given here take precedence over values defined on the client or passed to this method.
1749+
extra_headers: Headers | None = None,
1750+
extra_query: Query | None = None,
1751+
extra_body: Body | None = None,
1752+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
1753+
) -> VaultItemOperationResponse:
1754+
"""
1755+
Retrieve the item first and invoke only an operation listed in
1756+
`available_operations`, following its natural-language description. Availability
1757+
is rechecked at execution time; unavailable operations return 409. Authorization
1758+
and preparation may call an external provider and return updated state. Link
1759+
cards advertise authorize without checkout context. Eligible unused AgentCard
1760+
cards advertise prepare_checkout, which requires checkout context and obtains
1761+
device approval before native Square Pay. Keep the returned approval page open,
1762+
poll until ready_to_submit, then submit before preparation.expires_at. Unused
1763+
preparations expire automatically and cannot be reused. If spend-request
1764+
creation is rejected with a non-retryable provider error, the card item is
1765+
deleted and the provider's error code and message are returned. Rate limits
1766+
return HTTP 429 and retain the card item; stop, back off, and retry the same
1767+
authorize operation.
1768+
1769+
Fill returns a value-free execution result. Validation failures before writing
1770+
return 400 (invalid request or targets), 403 (access or destination denied), 404
1771+
(resource not found), or 409 (item or browser not ready). Once writing starts,
1772+
known partial failures and indeterminate field outcomes return 200 with status
1773+
`failed` or `unknown`. Fill never submits the page, so it is safe to retry after
1774+
a failure, an `unknown` outcome, or a transport error.
1775+
1776+
Args:
1777+
extra_headers: Send extra headers
1778+
1779+
extra_query: Add additional query parameters to the request
1780+
1781+
extra_body: Add additional JSON properties to the request
1782+
1783+
timeout: Override the client-level default timeout for this request, in seconds
1784+
"""
1785+
...
1786+
16921787
@overload
16931788
async def perform_operation(
16941789
self,
@@ -2250,6 +2345,7 @@ async def perform_operation(
22502345
*,
22512346
id_or_name: str,
22522347
type: Literal["authorize"]
2348+
| Literal["restart_verification"]
22532349
| Literal["confirm_transaction"]
22542350
| Literal["collect"]
22552351
| Literal["prepare_checkout"]

‎src/kernel/types/vaults/__init__.py‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,9 @@
119119
from .one_password_recover_vault_item_operation_request_param import (
120120
OnePasswordRecoverVaultItemOperationRequestParam as OnePasswordRecoverVaultItemOperationRequestParam,
121121
)
122+
from .restart_verification_vault_item_operation_request_param import (
123+
RestartVerificationVaultItemOperationRequestParam as RestartVerificationVaultItemOperationRequestParam,
124+
)
122125
from .one_password_request_access_vault_item_operation_request_param import (
123126
OnePasswordRequestAccessVaultItemOperationRequestParam as OnePasswordRequestAccessVaultItemOperationRequestParam,
124127
)

‎src/kernel/types/vaults/credential_account_vault_item.py‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ class AvailableOperation(BaseModel):
3232

3333
type: Literal[
3434
"authorize",
35+
"restart_verification",
3536
"confirm_transaction",
3637
"collect",
3738
"prepare_checkout",

‎src/kernel/types/vaults/credential_vault_item.py‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ class AvailableOperation(BaseModel):
3939

4040
type: Literal[
4141
"authorize",
42+
"restart_verification",
4243
"confirm_transaction",
4344
"collect",
4445
"prepare_checkout",

‎src/kernel/types/vaults/item_perform_operation_params.py‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
__all__ = [
1616
"ItemPerformOperationParams",
1717
"AuthorizeVaultItemOperationRequest",
18+
"RestartVerificationVaultItemOperationRequest",
1819
"ConfirmTransactionVaultItemOperationRequest",
1920
"CollectVaultItemOperationRequest",
2021
"PrepareCheckoutVaultItemOperationRequest",
@@ -34,6 +35,12 @@ class AuthorizeVaultItemOperationRequest(TypedDict, total=False):
3435
type: Required[Literal["authorize"]]
3536

3637

38+
class RestartVerificationVaultItemOperationRequest(TypedDict, total=False):
39+
id_or_name: Required[str]
40+
41+
type: Required[Literal["restart_verification"]]
42+
43+
3744
class ConfirmTransactionVaultItemOperationRequest(TypedDict, total=False):
3845
id_or_name: Required[str]
3946

@@ -195,6 +202,7 @@ class WebmcpInvokeVaultItemOperationRequest(TypedDict, total=False):
195202

196203
ItemPerformOperationParams: TypeAlias = Union[
197204
AuthorizeVaultItemOperationRequest,
205+
RestartVerificationVaultItemOperationRequest,
198206
ConfirmTransactionVaultItemOperationRequest,
199207
CollectVaultItemOperationRequest,
200208
PrepareCheckoutVaultItemOperationRequest,

‎src/kernel/types/vaults/kernel_card_state.py‎

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -44,12 +44,16 @@ class KernelCardState(BaseModel):
4444
"""
4545
pending_authorization on a Visa purchase waits for the cardholder to approve it
4646
through the spend_approval action; an unused link expires after 30 minutes.
47-
recovery_required means approving the purchase or issuing the one-time code has
48-
an unresolved outcome. Kernel never approves again or issues another code for
49-
the item automatically, and the item cannot be deleted or replaced until the
50-
original attempt is reconciled with support. When status_reason says the
51-
provider refused retrieval before acceptance, no code was issued and a later
52-
read retries. declined means the card network refused to issue a code.
47+
recovery_required means verification, approving the purchase or issuing the
48+
one-time code has an unresolved outcome. A server-classified initial attestation
49+
failure before intent dispatch may advertise restart_verification to prepare a
50+
fresh local verification link; this does not approve spending or replay any
51+
provider request. Unclassified legacy recovery and uncertain intent creation
52+
cannot restart. Kernel never approves again or issues another code for the item
53+
automatically, and the item cannot be deleted or replaced until the original
54+
attempt is reconciled with support. When status_reason says the provider refused
55+
retrieval before acceptance, no code was issued and a later read retries.
56+
declined means the card network refused to issue a code.
5357
"""
5458

5559
domains: Optional[List[str]] = None
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2+
3+
from __future__ import annotations
4+
5+
from typing_extensions import Literal, Required, TypedDict
6+
7+
__all__ = ["RestartVerificationVaultItemOperationRequestParam"]
8+
9+
10+
class RestartVerificationVaultItemOperationRequestParam(TypedDict, total=False):
11+
"""
12+
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.
13+
"""
14+
15+
type: Required[Literal["restart_verification"]]

‎src/kernel/types/vaults/vault_item.py‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ class WalletVaultItemAvailableOperation(BaseModel):
4747

4848
type: Literal[
4949
"authorize",
50+
"restart_verification",
5051
"confirm_transaction",
5152
"collect",
5253
"prepare_checkout",
@@ -123,6 +124,7 @@ class CardVaultItemAvailableOperation(BaseModel):
123124

124125
type: Literal[
125126
"authorize",
127+
"restart_verification",
126128
"confirm_transaction",
127129
"collect",
128130
"prepare_checkout",

‎src/kernel/types/vaults/vault_item_operation_response.py‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ class WalletVaultItemAvailableOperation(BaseModel):
4949

5050
type: Literal[
5151
"authorize",
52+
"restart_verification",
5253
"confirm_transaction",
5354
"collect",
5455
"prepare_checkout",
@@ -125,6 +126,7 @@ class CardVaultItemAvailableOperation(BaseModel):
125126

126127
type: Literal[
127128
"authorize",
129+
"restart_verification",
128130
"confirm_transaction",
129131
"collect",
130132
"prepare_checkout",

0 commit comments

Comments
 (0)