@primitivedotdev/sdk 1.10.0 → 1.11.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.
package/README.md CHANGED
@@ -283,7 +283,17 @@ const issued = await x402.createEmailChallenge({
283
283
  // issued.challenge carries the payment_requirements + nonce_binding the payer signs.
284
284
  ```
285
285
 
286
- The payer, on receiving the challenge, signs it locally with `payEmailChallenge` and sends the resulting envelope back as an `interaction.json` attachment. `payEmailChallenge` does not send anything; it returns the signed payment-step envelope and its canonical JSON bytes:
286
+ The payer receives the challenge as an `interaction.json` MIME part on an inbound email. Rather than hand-parsing it, pass the part bytes to `parseEmailChallengeFromPart`, which validates the envelope and returns the typed `X402EmailChallenge`:
287
+
288
+ ```ts
289
+ import { parseEmailChallengeFromPart } from "@primitivedotdev/sdk/x402";
290
+
291
+ // `interactionPart` is the body of the inbound email's `interaction.json`
292
+ // attachment (a string, a Buffer/Uint8Array, or an already-parsed object).
293
+ const issued = parseEmailChallengeFromPart(interactionPart);
294
+ ```
295
+
296
+ The payer then signs the challenge locally with `payEmailChallenge` and sends the resulting envelope back as an `interaction.json` attachment. `payEmailChallenge` does not send anything; it returns the signed payment-step envelope and its canonical JSON bytes. The validity window is computed and clamped into the accepted band for you, so you never hand-set `validBefore`:
287
297
 
288
298
  ```ts
289
299
  import { privateKeyToAccount } from "viem/accounts";
@@ -317,7 +327,8 @@ await mail.reply(challengeEmail, {
317
327
  `pay()` builds and signs the payment for you. When you need to drive the signing yourself, for example to sign a challenge carried in an email reply and submit the payment separately, the same building blocks are exported directly:
318
328
 
319
329
  - `deriveEip3009Nonce(binding)` derives the interaction-bound EIP-3009 nonce. The byte layout (`keccak256` over the lowercased `interaction_id`, a `0x00` separator, the lowercased `challenge_step_id`, a `0x00` separator, and the 32 raw bytes of the challenge nonce) is locked to a normative vector the platform recomputes.
320
- - `computePaymentValidityWindow({ challengeExpiresAtSec, nowSec })` returns the `{ validAfter, validBefore }` window. `validBefore` covers the challenge expiry plus a settlement margin; the total window is hard-capped (24h) so an over-wide authorization can never be produced.
330
+ - `parseEmailChallengeFromPart(part)` validates an inbound `interaction.json` challenge part (string, bytes, or a parsed object) and returns the typed `X402EmailChallenge` ready for `payEmailChallenge`, so you never hand-parse the envelope.
331
+ - `computePaymentValidityWindow({ challengeExpiresAtSec, nowSec })` returns the `{ validAfter, validBefore }` window. By default it lands the window inside the band the platform accepts: `validBefore` keeps at least a minimum settlement headroom (60s) so a near-expired challenge is not signed into a guaranteed rejection, and the total window is clamped to the 24h cap so a far-future expiry never produces an "authorization window too wide" rejection. Pass an explicit `validBeforeSec`/`validAfterSec` to pin a bound; with `clamp: false` an out-of-band pinned value throws a specific error naming which bound was violated instead of silently signing a doomed authorization.
321
332
  - `signInteractionPayment({ sign, payer, domain, payTo, amount, nonceBinding, validAfter, validBefore })` derives the bound nonce, assembles the authorization, and signs it with your `sign` callback. Returns `{ authorization, signature }`. The key never leaves the caller.
322
333
  - `buildExactEvmPaymentPayload({ network, authorization, signature })` assembles the exact-EVM x402 wire payload, validating the nonce and signature shape.
323
334
 
@@ -1,4 +1,4 @@
1
- import { $ as discardEmailContent, $a as FunctionTestRunReply, $c as ListRegistryAgentsResponses, $d as TestEndpointError, $f as UpdateRegistryData, $i as DiscardEmailContentData, $l as ReplayEmailWebhooksResponses, $n as CreateAgentAccountResponse, $o as GetOrgRoutingTopologyResponse, $p as RequestResult, $r as CreateRegistryInput, $s as ListDeliveriesResponses, $t as startAgentClaim, $u as SendMailResult, A as RequestOptions$1, Aa as EmailSearchHighlights, Ac as ListFunctionSecretsResponses, Ad as StartAgentClaimResponse, Af as UpdateDomainError, Ai as DeleteFilterData, Al as PublishAgentInput, An as AgentClaimStartResult, Ao as GetFunctionData, Ap as VerifyDomainData, Ar as CreateFilterResponses, As as GetThreadResponses, At as listPayoutAddresses, Au as SearchEmailsData, B as createFunction, Ba as FunctionDetail, Bc as ListOrgSecretsResponses, Bd as StartCliLoginErrors, Bf as UpdateEndpointResponses, Bi as DeleteFunctionSecretData, Bl as RegisterPayoutAddressResponses, Bn as CliLogoutInput, Bo as GetFunctionTestRunTraceData, Bp as X402NonceBinding, Br as CreateFunctionSecretErrors, Bs as InboxStatusFunctionSummary, Bt as replayEmailWebhooks, Bu as SemanticSearchInput, C as VerifyOptions, Ca as EmailAddress, Cc as ListFunctionLogsErrors, Cd as SetOrgSecretInput, Cf as UpdateAccountData, Ci as DeleteEmailResponse, Cl as PollCliLoginErrors, Cn as AddDomainInput, Co as GetConversationResponse, Cp as VerifyAgentSignupResponses, Cr as CreateEndpointResponse, Cs as GetStorageStatsErrors, Ct as listEmails, Cu as ResourceId, D as PrimitiveApiClientOptions, Da as EmailDetailReply, Dc as ListFunctionSecretsError, Dd as StartAgentClaimError, Df as UpdateAccountResponse, Di as DeleteEndpointErrors, Dl as PublishAgentData, Dn as AgentAccountUpgradeHint, Do as GetEmailErrors, Dp as VerifyCliSignupInput, Dr as CreateFilterErrors, Ds as GetThreadError, Dt as listFunctionSecrets, Du as RotateWebhookSecretResponse, E as PrimitiveApiClient, Ea as EmailDetail, Ec as ListFunctionSecretsData, Ed as StartAgentClaimData, Ef as UpdateAccountInput, Ei as DeleteEndpointError, El as PollCliLoginResponses, En as AgentAccountResult, Eo as GetEmailError, Ep as VerifyCliSignupErrors, Er as CreateFilterError, Es as GetThreadData, Et as listFunctionLogs, Eu as RotateWebhookSecretErrors, F as createAgentClaimLink, Fa as EmailWebhookStatus, Fc as ListFunctionsResponses, Fd as StartAgentSignupInput, Ff as UpdateEndpointData, Fi as DeleteFunctionData, Fl as RegisterPayoutAddressData, Fn as CliLoginPollResult, Fo as GetFunctionRoutingData, Fp as WebhookSecret, Fr as CreateFunctionResponse, Fs as GetWebhookSecretResponses, Ft as payChallenge, Fu as SemanticSearchCoverage, G as defineAgent, Ga as FunctionRouting, Gc as ListPayoutAddressesResponses, Gd as StartCliSignupError, Gf as UpdateFilterResponse, Gi as DeleteOrgSecretData, Gl as ReplayDeliveryError, Gn as CliSignupStartResult, Go as GetInboxStatusData, Gp as X402SpendPolicy, Gr as CreateOrgSecretError, Gs as ListDeclinedPaymentsError, Gt as rotateWebhookSecret, Gu as SemanticSearchSnippet, H as createOrgSecret, Ha as FunctionLogRow, Hc as ListPayoutAddressesError, Hd as StartCliLoginResponse, Hf as UpdateFilterError, Hi as DeleteFunctionSecretErrors, Hl as RegistryAgent, Hn as CliLogoutResponses, Ho as GetFunctionTestRunTraceErrors, Hp as X402PaymentRequirements, Hr as CreateFunctionSecretResponse, Hs as InboxStatusRecentEmailSummary, Ht as resendAgentSignupVerification, Hu as SemanticSearchResponses, I as createChallenge, Ia as Endpoint, Ic as ListOrgSecretsData, Id as StartAgentSignupResponse, If as UpdateEndpointError, Ii as DeleteFunctionError, Il as RegisterPayoutAddressError, In as CliLoginStartResult, Io as GetFunctionRoutingError, Ip as X402Challenge, Ir as CreateFunctionResponses, Is as IdempotencyKey, It as pollCliLogin, Iu as SemanticSearchData, J as deleteEndpoint, Ja as FunctionTestRun, Jc as ListRegistriesErrors, Jd as StartCliSignupResponse, Jf as UpdateFunctionError, Ji as DeleteOrgSecretResponse, Jl as ReplayDeliveryResponses, Jn as ConversationMessage, Jo as GetInboxStatusResponse, Jp as ClientOptions, Jr as CreateOrgSecretResponse, Js as ListDeclinedPaymentsResponses, Jt as semanticSearch, Ju as SendEmailErrors, K as deleteDomain, Ka as FunctionSecretListItem, Kc as ListRegistriesData, Kd as StartCliSignupErrors, Kf as UpdateFilterResponses, Ki as DeleteOrgSecretError, Kl as ReplayDeliveryErrors, Kn as CliSignupVerifyResult, Ko as GetInboxStatusError, Kp as createClient, Kr as CreateOrgSecretErrors, Ks as ListDeclinedPaymentsErrors, Kt as sdk_gen_d_exports, Ku as SendEmailData, L as createEmailChallenge, La as ErrorResponse, Lc as ListOrgSecretsError, Ld as StartAgentSignupResponses, Lf as UpdateEndpointErrors, Li as DeleteFunctionErrors, Ll as RegisterPayoutAddressErrors, Ln as CliLogoutData, Lo as GetFunctionRoutingErrors, Lp as X402DeclinedPayment, Lr as CreateFunctionResult, Ls as InboxStatus, Lt as publishAgent, Lu as SemanticSearchError, M as addDomain, Ma as EmailSearchResult, Mc as ListFunctionsError, Md as StartAgentSignupData, Mf as UpdateDomainInput, Mi as DeleteFilterErrors, Ml as PublishAgentResponses, Mn as AgentSignupResendResult, Mo as GetFunctionErrors, Mp as VerifyDomainErrors, Mr as CreateFunctionError, Ms as GetWebhookSecretError, Mt as listRegistryAgents, Mu as SearchEmailsErrors, N as cliLogout, Na as EmailStatus, Nc as ListFunctionsErrors, Nd as StartAgentSignupError, Nf as UpdateDomainResponse, Ni as DeleteFilterResponse, Nl as PublishAgentResult, Nn as AgentSignupStartResult, No as GetFunctionResponse, Np as VerifyDomainResponse, Nr as CreateFunctionErrors, Ns as GetWebhookSecretErrors, Nt as listRegistryRequests, Nu as SearchEmailsResponse, O as PrimitiveApiError, Oa as EmailSearchFacetBucket, Oc as ListFunctionSecretsErrors, Od as StartAgentClaimErrors, Of as UpdateAccountResponses, Oi as DeleteEndpointResponse, Ol as PublishAgentError, On as AgentClaimLinkResult, Oo as GetEmailResponse, Op as VerifyCliSignupResponse, Or as CreateFilterInput, Os as GetThreadErrors, Ot as listFunctions, Ou as RotateWebhookSecretResponses, P as createAgentAccount, Pa as EmailSummary, Pc as ListFunctionsResponse, Pd as StartAgentSignupErrors, Pf as UpdateDomainResponses, Pi as DeleteFilterResponses, Pl as PublishPolicy, Pn as AgentSignupVerifyResult, Po as GetFunctionResponses, Pp as VerifyDomainResponses, Pr as CreateFunctionInput, Ps as GetWebhookSecretResponse, Pt as listSentEmails, Pu as SearchEmailsResponses, Q as deleteOrgSecret, Qa as FunctionTestRunOutboundRequest, Qc as ListRegistryAgentsResponse, Qd as TestEndpointData, Qf as UpdateFunctionResponses, Qi as DiscardContentResult, Ql as ReplayEmailWebhooksResponse, Qn as CreateAgentAccountInput, Qo as GetOrgRoutingTopologyErrors, Qp as RequestOptions, Qr as CreateRegistryErrors, Qs as ListDeliveriesResponse, Qt as setOrgSecret, Qu as SendMailInput, R as createEndpoint, Ra as Filter, Rc as ListOrgSecretsErrors, Rd as StartCliLoginData, Rf as UpdateEndpointInput, Ri as DeleteFunctionResponse, Rl as RegisterPayoutAddressInput, Rn as CliLogoutError, Ro as GetFunctionRoutingResponse, Rp as X402EmailChallenge, Rr as CreateFunctionSecretData, Rs as InboxStatusDomain, Rt as registerPayoutAddress, Ru as SemanticSearchErrors, S as PRIMITIVE_SIGNATURE_HEADER, Sa as DownloadRawEmailResponses, Sc as ListFunctionLogsError, Sd as SetOrgSecretErrors, Sf as UnverifiedDomain, Si as DeleteEmailErrors, Sl as PollCliLoginError, Sn as AddDomainErrors, So as GetConversationErrors, Sp as VerifyAgentSignupResponse, Sr as CreateEndpointInput, Ss as GetStorageStatsError, St as listDomains, Su as ResolveRegistryHandleResponses, T as DEFAULT_API_BASE_URL, Ta as EmailAuth, Tc as ListFunctionLogsResponses, Td as SetOrgSecretResponses, Tf as UpdateAccountErrors, Ti as DeleteEndpointData, Tl as PollCliLoginResponse, Tn as AddDomainResponses, To as GetEmailData, Tp as VerifyCliSignupError, Tr as CreateFilterData, Ts as GetStorageStatsResponses, Tt as listFilters, Tu as RotateWebhookSecretError, U as createRegistry, Ua as FunctionRouteBody, Uc as ListPayoutAddressesErrors, Ud as StartCliLoginResponses, Uf as UpdateFilterErrors, Ui as DeleteFunctionSecretResponse, Ul as RegistryRequest, Un as CliLogoutResult, Uo as GetFunctionTestRunTraceResponse, Up as X402PayoutAddress, Ur as CreateFunctionSecretResponses, Us as Limit, Ut as resendCliSignupVerification, Uu as SemanticSearchResult, V as createFunctionSecret, Va as FunctionListItem, Vc as ListPayoutAddressesData, Vd as StartCliLoginInput, Vf as UpdateFilterData, Vi as DeleteFunctionSecretError, Vl as Registry, Vn as CliLogoutResponse, Vo as GetFunctionTestRunTraceError, Vp as X402PaymentPayload, Vr as CreateFunctionSecretInput, Vs as InboxStatusNextAction, Vt as replyToEmail, Vu as SemanticSearchMeta, W as decideRegistryRequest, Wa as FunctionRouteResult, Wc as ListPayoutAddressesResponse, Wd as StartCliSignupData, Wf as UpdateFilterInput, Wi as DeleteFunctionSecretResponses, Wl as ReplayDeliveryData, Wn as CliSignupResendResult, Wo as GetFunctionTestRunTraceResponses, Wp as X402Receipt, Wr as CreateOrgSecretData, Ws as ListDeclinedPaymentsData, Wt as resolveRegistryHandle, Wu as SemanticSearchScoreBreakdown, X as deleteFunction, Xa as FunctionTestRunDeliveryEndpoint, Xc as ListRegistriesResponses, Xd as StorageStats, Xf as UpdateFunctionInput, Xi as DeliveryStatus, Xl as ReplayEmailWebhooksError, Xn as CreateAgentAccountError, Xo as GetOrgRoutingTopologyData, Xp as CreateClientConfig, Xr as CreateRegistryData, Xs as ListDeliveriesError, Xt as setFunctionRoute, Xu as SendEmailResponses, Y as deleteFilter, Ya as FunctionTestRunDelivery, Yc as ListRegistriesResponse, Yd as StartCliSignupResponses, Yf as UpdateFunctionErrors, Yi as DeleteOrgSecretResponses, Yl as ReplayEmailWebhooksData, Yn as CreateAgentAccountData, Yo as GetInboxStatusResponses, Yp as Config, Yr as CreateOrgSecretResponses, Ys as ListDeliveriesData, Yt as sendEmail, Yu as SendEmailResponse, Z as deleteFunctionSecret, Za as FunctionTestRunInboundEmail, Zc as ListRegistryAgentsData, Zd as SuccessEnvelope, Zf as UpdateFunctionResponse, Zi as DeliverySummary, Zl as ReplayEmailWebhooksErrors, Zn as CreateAgentAccountErrors, Zo as GetOrgRoutingTopologyError, Zp as Options, Zr as CreateRegistryError, Zs as ListDeliveriesErrors, Zt as setFunctionSecret, Zu as SendMailAttachment, _ as SendThreadInput, _a as DownloadDomainZoneFileResponses, _c as ListFiltersError, _d as SetFunctionSecretInput, _f as UnsetFunctionRouteData, _i as DeleteDomainErrors, _l as PayChallengeInput, _n as verifyDomain, _o as GetChallengeErrors, _p as VerifyAgentClaimResponses, _r as CreateEmailChallengeResponse, _s as GetSpendPolicyError, _t as getStorageStats, _u as ResendCliSignupVerificationResponses, a as ForwardInput, aa as Domain, ac as ListEmailsData, ad as SendPermissionsMeta, af as TestFunctionErrors, ai as DecideRegistryRequestErrors, al as ListSentEmailsData, an as unpublishAgent, ao as GetAccountData, ap as UpdateSpendPolicyData, ar as CreateAgentClaimLinkResponse, as as GetRegistryResponses, at as getChallenge, au as ReplyToEmailResponses, b as createAgent, ba as DownloadRawEmailErrors, bc as ListFiltersResponses, bd as SetOrgSecretData, bf as UnsetFunctionRouteResponse, bi as DeleteEmailData, bl as PlanLimits, bn as AddDomainData, bo as GetConversationData, bp as VerifyAgentSignupErrors, br as CreateEndpointError, bs as GetSpendPolicyResponses, bt as listDeclinedPayments, bu as ResolveRegistryHandleErrors, c as InboxStreamOptions, ca as DownloadAttachmentsData, cc as ListEmailsResponse, cd as SentEmailSummary, cf as TestInvocationResult, ci as DecideRegistryRequestResponses, cl as ListSentEmailsResponse, cn as updateDomain, co as GetAccountResponse, cp as UpdateSpendPolicyInput, cr as CreateChallengeError, cs as GetSendPermissionsErrors, ct as getFunction, cu as ResendAgentSignupVerificationErrors, d as ReplyInput, da as DownloadAttachmentsResponse, dc as ListEndpointsError, dd as SetFunctionRouteErrors, df as ThreadMessage, di as DefineAgentErrors, dl as OrgSecretWriteResult, dn as updateFunction, do as GetAgentError, dp as VerifiedDomain, dr as CreateChallengeResponse, ds as GetSentEmailData, dt as getInboxStatus, du as ResendAgentSignupVerificationResponses, ea as DiscardEmailContentError, ec as ListDomainsData, ed as SendPermissionAddress, ef as TestEndpointErrors, ei as CreateRegistryResponse, el as ListRegistryRequestsData, em as ResponseStyle, en as startAgentSignup, eo as FunctionTestRunSend, ep as UpdateRegistryError, er as CreateAgentAccountResponses, es as GetOrgRoutingTopologyResponses, et as downloadAttachments, eu as ReplayResult, f as RequestOptions$2, fa as DownloadAttachmentsResponses, fc as ListEndpointsErrors, fd as SetFunctionRouteResponse, ff as UnpublishAgentData, fi as DefineAgentInput, fl as PaginationMeta, fn as updateRegistry, fo as GetAgentErrors, fp as VerifyAgentClaimData, fr as CreateChallengeResponses, fs as GetSentEmailError, ft as getOrgRoutingTopology, fu as ResendCliSignupVerificationData, g as SendResult, ga as DownloadDomainZoneFileResponse, gc as ListFiltersData, gd as SetFunctionSecretErrors, gf as UnpublishAgentResponses, gi as DeleteDomainError, gl as PayChallengeErrors, gn as verifyCliSignup, go as GetChallengeError, gp as VerifyAgentClaimResponse, gr as CreateEmailChallengeInput, gs as GetSpendPolicyData, gt as getSpendPolicy, gu as ResendCliSignupVerificationResponse, h as SendInput, ha as DownloadDomainZoneFileErrors, hc as ListEnvelope, hd as SetFunctionSecretError, hf as UnpublishAgentResponse, hi as DeleteDomainData, hl as PayChallengeError, hn as verifyAgentSignup, ho as GetChallengeData, hp as VerifyAgentClaimInput, hr as CreateEmailChallengeErrors, hs as GetSentEmailResponses, ht as getSentEmail, hu as ResendCliSignupVerificationInput, i as CreatedAgent, ia as DkimSignature, ic as ListDomainsResponses, id as SendPermissionYourDomain, if as TestFunctionError, ii as DecideRegistryRequestError, il as ListRegistryRequestsResponses, in as testFunction, io as GateFix, ip as UpdateRegistryResponses, ir as CreateAgentClaimLinkInput, is as GetRegistryResponse, it as getAgent, iu as ReplyToEmailResponse, j as createPrimitiveApiClient, ja as EmailSearchMeta, jc as ListFunctionsData, jd as StartAgentClaimResponses, jf as UpdateDomainErrors, ji as DeleteFilterError, jl as PublishAgentResponse, jn as AgentOrgRef, jo as GetFunctionError, jp as VerifyDomainError, jr as CreateFunctionData, js as GetWebhookSecretData, jt as listRegistries, ju as SearchEmailsError, k as PrimitiveApiErrorDetails, ka as EmailSearchFacets, kc as ListFunctionSecretsResponse, kd as StartAgentClaimInput, kf as UpdateDomainData, ki as DeleteEndpointResponses, kl as PublishAgentErrors, kn as AgentClaimResult, ko as GetEmailResponses, kp as VerifyCliSignupResponses, kr as CreateFilterResponse, ks as GetThreadResponse, kt as listOrgSecrets, ku as RoutingTopology, l as PrimitiveClient, la as DownloadAttachmentsError, lc as ListEmailsResponses, ld as SetFunctionRouteData, lf as TestResult, li as DefineAgentData, ll as ListSentEmailsResponses, ln as updateEndpoint, lo as GetAccountResponses, lp as UpdateSpendPolicyResponse, lr as CreateChallengeErrors, ls as GetSendPermissionsResponse, lt as getFunctionRouting, lu as ResendAgentSignupVerificationInput, m as SendAttachment, ma as DownloadDomainZoneFileError, mc as ListEndpointsResponses, md as SetFunctionSecretData, mf as UnpublishAgentErrors, mi as DefineAgentResponses, ml as PayChallengeData, mn as verifyAgentClaim, mo as GetAgentResponses, mp as VerifyAgentClaimErrors, mr as CreateEmailChallengeError, ms as GetSentEmailResponse, mt as getSendPermissions, mu as ResendCliSignupVerificationErrors, n as AgentResource, na as DiscardEmailContentResponse, nc as ListDomainsErrors, nd as SendPermissionManagedZone, nf as TestEndpointResponses, ni as Cursor, nl as ListRegistryRequestsErrors, nm as Auth, nn as startCliSignup, no as FunctionTestRunTrace, np as UpdateRegistryInput, nr as CreateAgentClaimLinkError, ns as GetRegistryError, nt as downloadRawEmail, nu as ReplyToEmailError, o as InboundEmail, oa as DomainDnsRecord, oc as ListEmailsError, od as SentEmailDetail, of as TestFunctionResponse, oi as DecideRegistryRequestInput, ol as ListSentEmailsError, on as unsetFunctionRoute, oo as GetAccountError, op as UpdateSpendPolicyError, or as CreateAgentClaimLinkResponses, os as GetSendPermissionsData, ot as getConversation, ou as ResendAgentSignupVerificationData, p as SemanticSearchResponse, pa as DownloadDomainZoneFileData, pc as ListEndpointsResponse, pd as SetFunctionRouteResponses, pf as UnpublishAgentError, pi as DefineAgentResponse, pl as ParsedEmailData, pn as updateSpendPolicy, po as GetAgentResponse, pp as VerifyAgentClaimError, pr as CreateEmailChallengeData, ps as GetSentEmailErrors, pt as getRegistry, pu as ResendCliSignupVerificationError, q as deleteEmail, qa as FunctionSecretWriteResult, qc as ListRegistriesError, qd as StartCliSignupInput, qf as UpdateFunctionData, qi as DeleteOrgSecretErrors, ql as ReplayDeliveryResponse, qn as Conversation, qo as GetInboxStatusErrors, qp as Client, qr as CreateOrgSecretInput, qs as ListDeclinedPaymentsResponse, qt as searchEmails, qu as SendEmailError, r as CreateAgentOptions, ra as DiscardEmailContentResponses, rc as ListDomainsResponse, rd as SendPermissionRule, rf as TestFunctionData, ri as DecideRegistryRequestData, rl as ListRegistryRequestsResponse, rn as testEndpoint, ro as GateDenial, rp as UpdateRegistryResponse, rr as CreateAgentClaimLinkErrors, rs as GetRegistryErrors, rt as getAccount, ru as ReplyToEmailErrors, s as InboxResource, sa as DomainVerifyResult, sc as ListEmailsErrors, sd as SentEmailStatus, sf as TestFunctionResponses, si as DecideRegistryRequestResponse, sl as ListSentEmailsErrors, sn as updateAccount, so as GetAccountErrors, sp as UpdateSpendPolicyErrors, sr as CreateChallengeData, ss as GetSendPermissionsError, st as getEmail, su as ResendAgentSignupVerificationError, t as AccountResource, ta as DiscardEmailContentErrors, tc as ListDomainsError, td as SendPermissionAnyRecipient, tf as TestEndpointResponse, ti as CreateRegistryResponses, tl as ListRegistryRequestsError, tm as createConfig, tn as startCliLogin, to as FunctionTestRunState, tp as UpdateRegistryErrors, tr as CreateAgentClaimLinkData, ts as GetRegistryData, tt as downloadDomainZoneFile, tu as ReplyToEmailData, u as PrimitiveClientOptions, ua as DownloadAttachmentsErrors, uc as ListEndpointsData, ud as SetFunctionRouteError, uf as Thread, ui as DefineAgentError, ul as OrgSecretListItem, un as updateFilter, uo as GetAgentData, up as UpdateSpendPolicyResponses, ur as CreateChallengeInput, us as GetSendPermissionsResponses, ut as getFunctionTestRunTrace, uu as ResendAgentSignupVerificationResponse, v as WaitForNextOptions, va as DownloadRawEmailData, vc as ListFiltersErrors, vd as SetFunctionSecretResponse, vf as UnsetFunctionRouteError, vi as DeleteDomainResponse, vl as PayChallengeResponse, vn as Account, vo as GetChallengeResponse, vp as VerifyAgentSignupData, vr as CreateEmailChallengeResponses, vs as GetSpendPolicyErrors, vt as getThread, vu as ResolveRegistryHandleData, w as verifyWebhookSignature, wa as EmailAttachment, wc as ListFunctionLogsResponse, wd as SetOrgSecretResponse, wf as UpdateAccountError, wi as DeleteEmailResponses, wl as PollCliLoginInput, wn as AddDomainResponse, wo as GetConversationResponses, wp as VerifyCliSignupData, wr as CreateEndpointResponses, ws as GetStorageStatsResponse, wt as listEndpoints, wu as RotateWebhookSecretData, x as createPrimitiveClient, xa as DownloadRawEmailResponse, xc as ListFunctionLogsData, xd as SetOrgSecretError, xf as UnsetFunctionRouteResponses, xi as DeleteEmailError, xl as PollCliLoginData, xn as AddDomainError, xo as GetConversationError, xp as VerifyAgentSignupInput, xr as CreateEndpointErrors, xs as GetStorageStatsData, xt as listDeliveries, xu as ResolveRegistryHandleResponse, y as client, ya as DownloadRawEmailError, yc as ListFiltersResponse, yd as SetFunctionSecretResponses, yf as UnsetFunctionRouteErrors, yi as DeleteDomainResponses, yl as PayChallengeResponses, yn as AccountUpdated, yo as GetChallengeResponses, yp as VerifyAgentSignupError, yr as CreateEndpointData, ys as GetSpendPolicyResponse, yt as getWebhookSecret, yu as ResolveRegistryHandleError, z as createFilter, za as FunctionDeployStatus, zc as ListOrgSecretsResponse, zd as StartCliLoginError, zf as UpdateEndpointResponse, zi as DeleteFunctionResponses, zl as RegisterPayoutAddressResponse, zn as CliLogoutErrors, zo as GetFunctionRoutingResponses, zp as X402EmailChallengeDetails, zr as CreateFunctionSecretError, zs as InboxStatusEndpointSummary, zt as replayDelivery, zu as SemanticSearchField } from "../index-FvnZT9Be.js";
1
+ import { $ as discardEmailContent, $a as FunctionTestRunReply, $c as ListRegistryAgentsResponses, $d as TestEndpointError, $f as UpdateRegistryData, $i as DiscardEmailContentData, $l as ReplayEmailWebhooksResponses, $n as CreateAgentAccountResponse, $o as GetOrgRoutingTopologyResponse, $p as RequestResult, $r as CreateRegistryInput, $s as ListDeliveriesResponses, $t as startAgentClaim, $u as SendMailResult, A as RequestOptions$1, Aa as EmailSearchHighlights, Ac as ListFunctionSecretsResponses, Ad as StartAgentClaimResponse, Af as UpdateDomainError, Ai as DeleteFilterData, Al as PublishAgentInput, An as AgentClaimStartResult, Ao as GetFunctionData, Ap as VerifyDomainData, Ar as CreateFilterResponses, As as GetThreadResponses, At as listPayoutAddresses, Au as SearchEmailsData, B as createFunction, Ba as FunctionDetail, Bc as ListOrgSecretsResponses, Bd as StartCliLoginErrors, Bf as UpdateEndpointResponses, Bi as DeleteFunctionSecretData, Bl as RegisterPayoutAddressResponses, Bn as CliLogoutInput, Bo as GetFunctionTestRunTraceData, Bp as X402NonceBinding, Br as CreateFunctionSecretErrors, Bs as InboxStatusFunctionSummary, Bt as replayEmailWebhooks, Bu as SemanticSearchInput, C as VerifyOptions, Ca as EmailAddress, Cc as ListFunctionLogsErrors, Cd as SetOrgSecretInput, Cf as UpdateAccountData, Ci as DeleteEmailResponse, Cl as PollCliLoginErrors, Cn as AddDomainInput, Co as GetConversationResponse, Cp as VerifyAgentSignupResponses, Cr as CreateEndpointResponse, Cs as GetStorageStatsErrors, Ct as listEmails, Cu as ResourceId, D as PrimitiveApiClientOptions, Da as EmailDetailReply, Dc as ListFunctionSecretsError, Dd as StartAgentClaimError, Df as UpdateAccountResponse, Di as DeleteEndpointErrors, Dl as PublishAgentData, Dn as AgentAccountUpgradeHint, Do as GetEmailErrors, Dp as VerifyCliSignupInput, Dr as CreateFilterErrors, Ds as GetThreadError, Dt as listFunctionSecrets, Du as RotateWebhookSecretResponse, E as PrimitiveApiClient, Ea as EmailDetail, Ec as ListFunctionSecretsData, Ed as StartAgentClaimData, Ef as UpdateAccountInput, Ei as DeleteEndpointError, El as PollCliLoginResponses, En as AgentAccountResult, Eo as GetEmailError, Ep as VerifyCliSignupErrors, Er as CreateFilterError, Es as GetThreadData, Et as listFunctionLogs, Eu as RotateWebhookSecretErrors, F as createAgentClaimLink, Fa as EmailWebhookStatus, Fc as ListFunctionsResponses, Fd as StartAgentSignupInput, Ff as UpdateEndpointData, Fi as DeleteFunctionData, Fl as RegisterPayoutAddressData, Fn as CliLoginPollResult, Fo as GetFunctionRoutingData, Fp as WebhookSecret, Fr as CreateFunctionResponse, Fs as GetWebhookSecretResponses, Ft as payChallenge, Fu as SemanticSearchCoverage, G as defineAgent, Ga as FunctionRouting, Gc as ListPayoutAddressesResponses, Gd as StartCliSignupError, Gf as UpdateFilterResponse, Gi as DeleteOrgSecretData, Gl as ReplayDeliveryError, Gn as CliSignupStartResult, Go as GetInboxStatusData, Gp as X402SpendPolicy, Gr as CreateOrgSecretError, Gs as ListDeclinedPaymentsError, Gt as rotateWebhookSecret, Gu as SemanticSearchSnippet, H as createOrgSecret, Ha as FunctionLogRow, Hc as ListPayoutAddressesError, Hd as StartCliLoginResponse, Hf as UpdateFilterError, Hi as DeleteFunctionSecretErrors, Hl as RegistryAgent, Hn as CliLogoutResponses, Ho as GetFunctionTestRunTraceErrors, Hp as X402PaymentRequirements, Hr as CreateFunctionSecretResponse, Hs as InboxStatusRecentEmailSummary, Ht as resendAgentSignupVerification, Hu as SemanticSearchResponses, I as createChallenge, Ia as Endpoint, Ic as ListOrgSecretsData, Id as StartAgentSignupResponse, If as UpdateEndpointError, Ii as DeleteFunctionError, Il as RegisterPayoutAddressError, In as CliLoginStartResult, Io as GetFunctionRoutingError, Ip as X402Challenge, Ir as CreateFunctionResponses, Is as IdempotencyKey, It as pollCliLogin, Iu as SemanticSearchData, J as deleteEndpoint, Ja as FunctionTestRun, Jc as ListRegistriesErrors, Jd as StartCliSignupResponse, Jf as UpdateFunctionError, Ji as DeleteOrgSecretResponse, Jl as ReplayDeliveryResponses, Jn as ConversationMessage, Jo as GetInboxStatusResponse, Jp as ClientOptions, Jr as CreateOrgSecretResponse, Js as ListDeclinedPaymentsResponses, Jt as semanticSearch, Ju as SendEmailErrors, K as deleteDomain, Ka as FunctionSecretListItem, Kc as ListRegistriesData, Kd as StartCliSignupErrors, Kf as UpdateFilterResponses, Ki as DeleteOrgSecretError, Kl as ReplayDeliveryErrors, Kn as CliSignupVerifyResult, Ko as GetInboxStatusError, Kp as createClient, Kr as CreateOrgSecretErrors, Ks as ListDeclinedPaymentsErrors, Kt as sdk_gen_d_exports, Ku as SendEmailData, L as createEmailChallenge, La as ErrorResponse, Lc as ListOrgSecretsError, Ld as StartAgentSignupResponses, Lf as UpdateEndpointErrors, Li as DeleteFunctionErrors, Ll as RegisterPayoutAddressErrors, Ln as CliLogoutData, Lo as GetFunctionRoutingErrors, Lp as X402DeclinedPayment, Lr as CreateFunctionResult, Ls as InboxStatus, Lt as publishAgent, Lu as SemanticSearchError, M as addDomain, Ma as EmailSearchResult, Mc as ListFunctionsError, Md as StartAgentSignupData, Mf as UpdateDomainInput, Mi as DeleteFilterErrors, Ml as PublishAgentResponses, Mn as AgentSignupResendResult, Mo as GetFunctionErrors, Mp as VerifyDomainErrors, Mr as CreateFunctionError, Ms as GetWebhookSecretError, Mt as listRegistryAgents, Mu as SearchEmailsErrors, N as cliLogout, Na as EmailStatus, Nc as ListFunctionsErrors, Nd as StartAgentSignupError, Nf as UpdateDomainResponse, Ni as DeleteFilterResponse, Nl as PublishAgentResult, Nn as AgentSignupStartResult, No as GetFunctionResponse, Np as VerifyDomainResponse, Nr as CreateFunctionErrors, Ns as GetWebhookSecretErrors, Nt as listRegistryRequests, Nu as SearchEmailsResponse, O as PrimitiveApiError, Oa as EmailSearchFacetBucket, Oc as ListFunctionSecretsErrors, Od as StartAgentClaimErrors, Of as UpdateAccountResponses, Oi as DeleteEndpointResponse, Ol as PublishAgentError, On as AgentClaimLinkResult, Oo as GetEmailResponse, Op as VerifyCliSignupResponse, Or as CreateFilterInput, Os as GetThreadErrors, Ot as listFunctions, Ou as RotateWebhookSecretResponses, P as createAgentAccount, Pa as EmailSummary, Pc as ListFunctionsResponse, Pd as StartAgentSignupErrors, Pf as UpdateDomainResponses, Pi as DeleteFilterResponses, Pl as PublishPolicy, Pn as AgentSignupVerifyResult, Po as GetFunctionResponses, Pp as VerifyDomainResponses, Pr as CreateFunctionInput, Ps as GetWebhookSecretResponse, Pt as listSentEmails, Pu as SearchEmailsResponses, Q as deleteOrgSecret, Qa as FunctionTestRunOutboundRequest, Qc as ListRegistryAgentsResponse, Qd as TestEndpointData, Qf as UpdateFunctionResponses, Qi as DiscardContentResult, Ql as ReplayEmailWebhooksResponse, Qn as CreateAgentAccountInput, Qo as GetOrgRoutingTopologyErrors, Qp as RequestOptions, Qr as CreateRegistryErrors, Qs as ListDeliveriesResponse, Qt as setOrgSecret, Qu as SendMailInput, R as createEndpoint, Ra as Filter, Rc as ListOrgSecretsErrors, Rd as StartCliLoginData, Rf as UpdateEndpointInput, Ri as DeleteFunctionResponse, Rl as RegisterPayoutAddressInput, Rn as CliLogoutError, Ro as GetFunctionRoutingResponse, Rp as X402EmailChallenge, Rr as CreateFunctionSecretData, Rs as InboxStatusDomain, Rt as registerPayoutAddress, Ru as SemanticSearchErrors, S as PRIMITIVE_SIGNATURE_HEADER, Sa as DownloadRawEmailResponses, Sc as ListFunctionLogsError, Sd as SetOrgSecretErrors, Sf as UnverifiedDomain, Si as DeleteEmailErrors, Sl as PollCliLoginError, Sn as AddDomainErrors, So as GetConversationErrors, Sp as VerifyAgentSignupResponse, Sr as CreateEndpointInput, Ss as GetStorageStatsError, St as listDomains, Su as ResolveRegistryHandleResponses, T as DEFAULT_API_BASE_URL, Ta as EmailAuth, Tc as ListFunctionLogsResponses, Td as SetOrgSecretResponses, Tf as UpdateAccountErrors, Ti as DeleteEndpointData, Tl as PollCliLoginResponse, Tn as AddDomainResponses, To as GetEmailData, Tp as VerifyCliSignupError, Tr as CreateFilterData, Ts as GetStorageStatsResponses, Tt as listFilters, Tu as RotateWebhookSecretError, U as createRegistry, Ua as FunctionRouteBody, Uc as ListPayoutAddressesErrors, Ud as StartCliLoginResponses, Uf as UpdateFilterErrors, Ui as DeleteFunctionSecretResponse, Ul as RegistryRequest, Un as CliLogoutResult, Uo as GetFunctionTestRunTraceResponse, Up as X402PayoutAddress, Ur as CreateFunctionSecretResponses, Us as Limit, Ut as resendCliSignupVerification, Uu as SemanticSearchResult, V as createFunctionSecret, Va as FunctionListItem, Vc as ListPayoutAddressesData, Vd as StartCliLoginInput, Vf as UpdateFilterData, Vi as DeleteFunctionSecretError, Vl as Registry, Vn as CliLogoutResponse, Vo as GetFunctionTestRunTraceError, Vp as X402PaymentPayload, Vr as CreateFunctionSecretInput, Vs as InboxStatusNextAction, Vt as replyToEmail, Vu as SemanticSearchMeta, W as decideRegistryRequest, Wa as FunctionRouteResult, Wc as ListPayoutAddressesResponse, Wd as StartCliSignupData, Wf as UpdateFilterInput, Wi as DeleteFunctionSecretResponses, Wl as ReplayDeliveryData, Wn as CliSignupResendResult, Wo as GetFunctionTestRunTraceResponses, Wp as X402Receipt, Wr as CreateOrgSecretData, Ws as ListDeclinedPaymentsData, Wt as resolveRegistryHandle, Wu as SemanticSearchScoreBreakdown, X as deleteFunction, Xa as FunctionTestRunDeliveryEndpoint, Xc as ListRegistriesResponses, Xd as StorageStats, Xf as UpdateFunctionInput, Xi as DeliveryStatus, Xl as ReplayEmailWebhooksError, Xn as CreateAgentAccountError, Xo as GetOrgRoutingTopologyData, Xp as CreateClientConfig, Xr as CreateRegistryData, Xs as ListDeliveriesError, Xt as setFunctionRoute, Xu as SendEmailResponses, Y as deleteFilter, Ya as FunctionTestRunDelivery, Yc as ListRegistriesResponse, Yd as StartCliSignupResponses, Yf as UpdateFunctionErrors, Yi as DeleteOrgSecretResponses, Yl as ReplayEmailWebhooksData, Yn as CreateAgentAccountData, Yo as GetInboxStatusResponses, Yp as Config, Yr as CreateOrgSecretResponses, Ys as ListDeliveriesData, Yt as sendEmail, Yu as SendEmailResponse, Z as deleteFunctionSecret, Za as FunctionTestRunInboundEmail, Zc as ListRegistryAgentsData, Zd as SuccessEnvelope, Zf as UpdateFunctionResponse, Zi as DeliverySummary, Zl as ReplayEmailWebhooksErrors, Zn as CreateAgentAccountErrors, Zo as GetOrgRoutingTopologyError, Zp as Options, Zr as CreateRegistryError, Zs as ListDeliveriesErrors, Zt as setFunctionSecret, Zu as SendMailAttachment, _ as SendThreadInput, _a as DownloadDomainZoneFileResponses, _c as ListFiltersError, _d as SetFunctionSecretInput, _f as UnsetFunctionRouteData, _i as DeleteDomainErrors, _l as PayChallengeInput, _n as verifyDomain, _o as GetChallengeErrors, _p as VerifyAgentClaimResponses, _r as CreateEmailChallengeResponse, _s as GetSpendPolicyError, _t as getStorageStats, _u as ResendCliSignupVerificationResponses, a as ForwardInput, aa as Domain, ac as ListEmailsData, ad as SendPermissionsMeta, af as TestFunctionErrors, ai as DecideRegistryRequestErrors, al as ListSentEmailsData, an as unpublishAgent, ao as GetAccountData, ap as UpdateSpendPolicyData, ar as CreateAgentClaimLinkResponse, as as GetRegistryResponses, at as getChallenge, au as ReplyToEmailResponses, b as createAgent, ba as DownloadRawEmailErrors, bc as ListFiltersResponses, bd as SetOrgSecretData, bf as UnsetFunctionRouteResponse, bi as DeleteEmailData, bl as PlanLimits, bn as AddDomainData, bo as GetConversationData, bp as VerifyAgentSignupErrors, br as CreateEndpointError, bs as GetSpendPolicyResponses, bt as listDeclinedPayments, bu as ResolveRegistryHandleErrors, c as InboxStreamOptions, ca as DownloadAttachmentsData, cc as ListEmailsResponse, cd as SentEmailSummary, cf as TestInvocationResult, ci as DecideRegistryRequestResponses, cl as ListSentEmailsResponse, cn as updateDomain, co as GetAccountResponse, cp as UpdateSpendPolicyInput, cr as CreateChallengeError, cs as GetSendPermissionsErrors, ct as getFunction, cu as ResendAgentSignupVerificationErrors, d as ReplyInput, da as DownloadAttachmentsResponse, dc as ListEndpointsError, dd as SetFunctionRouteErrors, df as ThreadMessage, di as DefineAgentErrors, dl as OrgSecretWriteResult, dn as updateFunction, do as GetAgentError, dp as VerifiedDomain, dr as CreateChallengeResponse, ds as GetSentEmailData, dt as getInboxStatus, du as ResendAgentSignupVerificationResponses, ea as DiscardEmailContentError, ec as ListDomainsData, ed as SendPermissionAddress, ef as TestEndpointErrors, ei as CreateRegistryResponse, el as ListRegistryRequestsData, em as ResponseStyle, en as startAgentSignup, eo as FunctionTestRunSend, ep as UpdateRegistryError, er as CreateAgentAccountResponses, es as GetOrgRoutingTopologyResponses, et as downloadAttachments, eu as ReplayResult, f as RequestOptions$2, fa as DownloadAttachmentsResponses, fc as ListEndpointsErrors, fd as SetFunctionRouteResponse, ff as UnpublishAgentData, fi as DefineAgentInput, fl as PaginationMeta, fn as updateRegistry, fo as GetAgentErrors, fp as VerifyAgentClaimData, fr as CreateChallengeResponses, fs as GetSentEmailError, ft as getOrgRoutingTopology, fu as ResendCliSignupVerificationData, g as SendResult, ga as DownloadDomainZoneFileResponse, gc as ListFiltersData, gd as SetFunctionSecretErrors, gf as UnpublishAgentResponses, gi as DeleteDomainError, gl as PayChallengeErrors, gn as verifyCliSignup, go as GetChallengeError, gp as VerifyAgentClaimResponse, gr as CreateEmailChallengeInput, gs as GetSpendPolicyData, gt as getSpendPolicy, gu as ResendCliSignupVerificationResponse, h as SendInput, ha as DownloadDomainZoneFileErrors, hc as ListEnvelope, hd as SetFunctionSecretError, hf as UnpublishAgentResponse, hi as DeleteDomainData, hl as PayChallengeError, hn as verifyAgentSignup, ho as GetChallengeData, hp as VerifyAgentClaimInput, hr as CreateEmailChallengeErrors, hs as GetSentEmailResponses, ht as getSentEmail, hu as ResendCliSignupVerificationInput, i as CreatedAgent, ia as DkimSignature, ic as ListDomainsResponses, id as SendPermissionYourDomain, if as TestFunctionError, ii as DecideRegistryRequestError, il as ListRegistryRequestsResponses, in as testFunction, io as GateFix, ip as UpdateRegistryResponses, ir as CreateAgentClaimLinkInput, is as GetRegistryResponse, it as getAgent, iu as ReplyToEmailResponse, j as createPrimitiveApiClient, ja as EmailSearchMeta, jc as ListFunctionsData, jd as StartAgentClaimResponses, jf as UpdateDomainErrors, ji as DeleteFilterError, jl as PublishAgentResponse, jn as AgentOrgRef, jo as GetFunctionError, jp as VerifyDomainError, jr as CreateFunctionData, js as GetWebhookSecretData, jt as listRegistries, ju as SearchEmailsError, k as PrimitiveApiErrorDetails, ka as EmailSearchFacets, kc as ListFunctionSecretsResponse, kd as StartAgentClaimInput, kf as UpdateDomainData, ki as DeleteEndpointResponses, kl as PublishAgentErrors, kn as AgentClaimResult, ko as GetEmailResponses, kp as VerifyCliSignupResponses, kr as CreateFilterResponse, ks as GetThreadResponse, kt as listOrgSecrets, ku as RoutingTopology, l as PrimitiveClient, la as DownloadAttachmentsError, lc as ListEmailsResponses, ld as SetFunctionRouteData, lf as TestResult, li as DefineAgentData, ll as ListSentEmailsResponses, ln as updateEndpoint, lo as GetAccountResponses, lp as UpdateSpendPolicyResponse, lr as CreateChallengeErrors, ls as GetSendPermissionsResponse, lt as getFunctionRouting, lu as ResendAgentSignupVerificationInput, m as SendAttachment, ma as DownloadDomainZoneFileError, mc as ListEndpointsResponses, md as SetFunctionSecretData, mf as UnpublishAgentErrors, mi as DefineAgentResponses, ml as PayChallengeData, mn as verifyAgentClaim, mo as GetAgentResponses, mp as VerifyAgentClaimErrors, mr as CreateEmailChallengeError, ms as GetSentEmailResponse, mt as getSendPermissions, mu as ResendCliSignupVerificationErrors, n as AgentResource, na as DiscardEmailContentResponse, nc as ListDomainsErrors, nd as SendPermissionManagedZone, nf as TestEndpointResponses, ni as Cursor, nl as ListRegistryRequestsErrors, nm as Auth, nn as startCliSignup, no as FunctionTestRunTrace, np as UpdateRegistryInput, nr as CreateAgentClaimLinkError, ns as GetRegistryError, nt as downloadRawEmail, nu as ReplyToEmailError, o as InboundEmail, oa as DomainDnsRecord, oc as ListEmailsError, od as SentEmailDetail, of as TestFunctionResponse, oi as DecideRegistryRequestInput, ol as ListSentEmailsError, on as unsetFunctionRoute, oo as GetAccountError, op as UpdateSpendPolicyError, or as CreateAgentClaimLinkResponses, os as GetSendPermissionsData, ot as getConversation, ou as ResendAgentSignupVerificationData, p as SemanticSearchResponse, pa as DownloadDomainZoneFileData, pc as ListEndpointsResponse, pd as SetFunctionRouteResponses, pf as UnpublishAgentError, pi as DefineAgentResponse, pl as ParsedEmailData, pn as updateSpendPolicy, po as GetAgentResponse, pp as VerifyAgentClaimError, pr as CreateEmailChallengeData, ps as GetSentEmailErrors, pt as getRegistry, pu as ResendCliSignupVerificationError, q as deleteEmail, qa as FunctionSecretWriteResult, qc as ListRegistriesError, qd as StartCliSignupInput, qf as UpdateFunctionData, qi as DeleteOrgSecretErrors, ql as ReplayDeliveryResponse, qn as Conversation, qo as GetInboxStatusErrors, qp as Client, qr as CreateOrgSecretInput, qs as ListDeclinedPaymentsResponse, qt as searchEmails, qu as SendEmailError, r as CreateAgentOptions, ra as DiscardEmailContentResponses, rc as ListDomainsResponse, rd as SendPermissionRule, rf as TestFunctionData, ri as DecideRegistryRequestData, rl as ListRegistryRequestsResponse, rn as testEndpoint, ro as GateDenial, rp as UpdateRegistryResponse, rr as CreateAgentClaimLinkErrors, rs as GetRegistryErrors, rt as getAccount, ru as ReplyToEmailErrors, s as InboxResource, sa as DomainVerifyResult, sc as ListEmailsErrors, sd as SentEmailStatus, sf as TestFunctionResponses, si as DecideRegistryRequestResponse, sl as ListSentEmailsErrors, sn as updateAccount, so as GetAccountErrors, sp as UpdateSpendPolicyErrors, sr as CreateChallengeData, ss as GetSendPermissionsError, st as getEmail, su as ResendAgentSignupVerificationError, t as AccountResource, ta as DiscardEmailContentErrors, tc as ListDomainsError, td as SendPermissionAnyRecipient, tf as TestEndpointResponse, ti as CreateRegistryResponses, tl as ListRegistryRequestsError, tm as createConfig, tn as startCliLogin, to as FunctionTestRunState, tp as UpdateRegistryErrors, tr as CreateAgentClaimLinkData, ts as GetRegistryData, tt as downloadDomainZoneFile, tu as ReplyToEmailData, u as PrimitiveClientOptions, ua as DownloadAttachmentsErrors, uc as ListEndpointsData, ud as SetFunctionRouteError, uf as Thread, ui as DefineAgentError, ul as OrgSecretListItem, un as updateFilter, uo as GetAgentData, up as UpdateSpendPolicyResponses, ur as CreateChallengeInput, us as GetSendPermissionsResponses, ut as getFunctionTestRunTrace, uu as ResendAgentSignupVerificationResponse, v as WaitForNextOptions, va as DownloadRawEmailData, vc as ListFiltersErrors, vd as SetFunctionSecretResponse, vf as UnsetFunctionRouteError, vi as DeleteDomainResponse, vl as PayChallengeResponse, vn as Account, vo as GetChallengeResponse, vp as VerifyAgentSignupData, vr as CreateEmailChallengeResponses, vs as GetSpendPolicyErrors, vt as getThread, vu as ResolveRegistryHandleData, w as verifyWebhookSignature, wa as EmailAttachment, wc as ListFunctionLogsResponse, wd as SetOrgSecretResponse, wf as UpdateAccountError, wi as DeleteEmailResponses, wl as PollCliLoginInput, wn as AddDomainResponse, wo as GetConversationResponses, wp as VerifyCliSignupData, wr as CreateEndpointResponses, ws as GetStorageStatsResponse, wt as listEndpoints, wu as RotateWebhookSecretData, x as createPrimitiveClient, xa as DownloadRawEmailResponse, xc as ListFunctionLogsData, xd as SetOrgSecretError, xf as UnsetFunctionRouteResponses, xi as DeleteEmailError, xl as PollCliLoginData, xn as AddDomainError, xo as GetConversationError, xp as VerifyAgentSignupInput, xr as CreateEndpointErrors, xs as GetStorageStatsData, xt as listDeliveries, xu as ResolveRegistryHandleResponse, y as client, ya as DownloadRawEmailError, yc as ListFiltersResponse, yd as SetFunctionSecretResponses, yf as UnsetFunctionRouteErrors, yi as DeleteDomainResponses, yl as PayChallengeResponses, yn as AccountUpdated, yo as GetChallengeResponses, yp as VerifyAgentSignupError, yr as CreateEndpointData, ys as GetSpendPolicyResponse, yt as getWebhookSecret, yu as ResolveRegistryHandleError, z as createFilter, za as FunctionDeployStatus, zc as ListOrgSecretsResponse, zd as StartCliLoginError, zf as UpdateEndpointResponse, zi as DeleteFunctionResponses, zl as RegisterPayoutAddressResponse, zn as CliLogoutErrors, zo as GetFunctionRoutingResponses, zp as X402EmailChallengeDetails, zr as CreateFunctionSecretError, zs as InboxStatusEndpointSummary, zt as replayDelivery, zu as SemanticSearchField } from "../index-DZZQMKxn.js";
2
2
  import { i as openapiDocument, n as PrimitiveParameterManifest, r as operationManifest, t as PrimitiveOperationManifest } from "../operations.generated-BAniFZK9.js";
3
3
  import { f as EmailReceivedEvent } from "../types-CAG3bi20.js";
4
4
  import { b as normalizeReceivedEmail, f as WebhookVerificationError, g as ReceivedEmailThread, h as ReceivedEmailAddress, m as ReceivedEmail, p as WebhookVerificationErrorCode } from "../errors-jagfi4Ue.js";
package/dist/api/index.js CHANGED
@@ -1,4 +1,4 @@
1
1
  import { $ as getStorageStats, $t as verifyDomain, A as deleteEndpoint, At as semanticSearch, B as getAgent, Bt as testFunction, C as createFunctionSecret, Ct as replyToEmail, D as defineAgent, Dt as rotateWebhookSecret, E as decideRegistryRequest, Et as resolveRegistryHandle, F as discardEmailContent, Ft as startAgentClaim, G as getFunctionRouting, Gt as updateEndpoint, H as getConversation, Ht as unsetFunctionRoute, I as downloadAttachments, It as startAgentSignup, J as getOrgRoutingTopology, Jt as updateRegistry, K as getFunctionTestRunTrace, Kt as updateFilter, L as downloadDomainZoneFile, Lt as startCliLogin, M as deleteFunction, Mt as setFunctionRoute, N as deleteFunctionSecret, Nt as setFunctionSecret, O as deleteDomain, Ot as sdk_gen_exports, P as deleteOrgSecret, Pt as setOrgSecret, Q as getSpendPolicy, Qt as verifyCliSignup, R as downloadRawEmail, Rt as startCliSignup, S as createFunction, St as replayEmailWebhooks, T as createRegistry, Tt as resendCliSignupVerification, U as getEmail, Ut as updateAccount, V as getChallenge, Vt as unpublishAgent, W as getFunction, Wt as updateDomain, X as getSendPermissions, Xt as verifyAgentClaim, Y as getRegistry, Yt as updateSpendPolicy, Z as getSentEmail, Zt as verifyAgentSignup, _ as createAgentClaimLink, _t as payChallenge, a as client, at as listEmails, b as createEndpoint, bt as registerPayoutAddress, c as PRIMITIVE_SIGNATURE_HEADER, ct as listFunctionLogs, d as PrimitiveApiClient, dt as listOrgSecrets, en as createClient, et as getThread, f as PrimitiveApiError, ft as listPayoutAddresses, g as createAgentAccount, gt as listSentEmails, h as cliLogout, ht as listRegistryRequests, i as PrimitiveClient, it as listDomains, j as deleteFilter, jt as sendEmail, k as deleteEmail, kt as searchEmails, l as verifyWebhookSignature, lt as listFunctionSecrets, m as addDomain, mt as listRegistryAgents, n as AgentResource, nt as listDeclinedPayments, o as createAgent, ot as listEndpoints, p as createPrimitiveApiClient, pt as listRegistries, q as getInboxStatus, qt as updateFunction, r as InboxResource, rt as listDeliveries, s as createPrimitiveClient, st as listFilters, t as AccountResource, tn as createConfig, tt as getWebhookSecret, u as DEFAULT_API_BASE_URL, ut as listFunctions, v as createChallenge, vt as pollCliLogin, w as createOrgSecret, wt as resendAgentSignupVerification, x as createFilter, xt as replayDelivery, y as createEmailChallenge, yt as publishAgent, z as getAccount, zt as testEndpoint } from "../api-CwpE8_17.js";
2
- import { n as openapiDocument, t as operationManifest } from "../operations.generated-BlW1vtGP.js";
2
+ import { n as openapiDocument, t as operationManifest } from "../operations.generated-DSrvs-Sc.js";
3
3
  import { c as WebhookVerificationError, f as normalizeReceivedEmail } from "../errors-BPJGp9I6.js";
4
4
  export { AccountResource, AgentResource, DEFAULT_API_BASE_URL, InboxResource, PRIMITIVE_SIGNATURE_HEADER, PrimitiveApiClient, PrimitiveApiError, PrimitiveClient, WebhookVerificationError, addDomain, cliLogout, client, createAgent, createAgentAccount, createAgentClaimLink, createChallenge, createClient, createConfig, createEmailChallenge, createEndpoint, createFilter, createFunction, createFunctionSecret, createOrgSecret, createPrimitiveApiClient, createPrimitiveClient, createRegistry, decideRegistryRequest, defineAgent, deleteDomain, deleteEmail, deleteEndpoint, deleteFilter, deleteFunction, deleteFunctionSecret, deleteOrgSecret, discardEmailContent, downloadAttachments, downloadDomainZoneFile, downloadRawEmail, getAccount, getAgent, getChallenge, getConversation, getEmail, getFunction, getFunctionRouting, getFunctionTestRunTrace, getInboxStatus, getOrgRoutingTopology, getRegistry, getSendPermissions, getSentEmail, getSpendPolicy, getStorageStats, getThread, getWebhookSecret, listDeclinedPayments, listDeliveries, listDomains, listEmails, listEndpoints, listFilters, listFunctionLogs, listFunctionSecrets, listFunctions, listOrgSecrets, listPayoutAddresses, listRegistries, listRegistryAgents, listRegistryRequests, listSentEmails, normalizeReceivedEmail, openapiDocument, operationManifest, sdk_gen_exports as operations, payChallenge, pollCliLogin, publishAgent, registerPayoutAddress, replayDelivery, replayEmailWebhooks, replyToEmail, resendAgentSignupVerification, resendCliSignupVerification, resolveRegistryHandle, rotateWebhookSecret, searchEmails, semanticSearch, sendEmail, setFunctionRoute, setFunctionSecret, setOrgSecret, startAgentClaim, startAgentSignup, startCliLogin, startCliSignup, testEndpoint, testFunction, unpublishAgent, unsetFunctionRoute, updateAccount, updateDomain, updateEndpoint, updateFilter, updateFunction, updateRegistry, updateSpendPolicy, verifyAgentClaim, verifyAgentSignup, verifyCliSignup, verifyDomain, verifyWebhookSignature };
@@ -6705,9 +6705,15 @@ type UpdateRegistryResponse = UpdateRegistryResponses[keyof UpdateRegistryRespon
6705
6705
  type ListRegistryAgentsData = {
6706
6706
  body?: never;
6707
6707
  path: {
6708
+ /**
6709
+ * The registry slug.
6710
+ */
6708
6711
  slug: string;
6709
6712
  };
6710
6713
  query?: {
6714
+ /**
6715
+ * Maximum number of items to return (1-200).
6716
+ */
6711
6717
  limit?: number;
6712
6718
  /**
6713
6719
  * The address of the last agent from the previous page.
@@ -6728,6 +6734,9 @@ type ListRegistryAgentsResponse = ListRegistryAgentsResponses[keyof ListRegistry
6728
6734
  type PublishAgentData = {
6729
6735
  body: PublishAgentInput;
6730
6736
  path: {
6737
+ /**
6738
+ * The registry slug.
6739
+ */
6731
6740
  slug: string;
6732
6741
  };
6733
6742
  query?: never;
@@ -6774,7 +6783,13 @@ type PublishAgentResponse = PublishAgentResponses[keyof PublishAgentResponses];
6774
6783
  type UnpublishAgentData = {
6775
6784
  body?: never;
6776
6785
  path: {
6786
+ /**
6787
+ * The registry slug.
6788
+ */
6777
6789
  slug: string;
6790
+ /**
6791
+ * The registry-scoped handle the agent is published under.
6792
+ */
6778
6793
  handle: string;
6779
6794
  };
6780
6795
  query?: never;
@@ -6805,7 +6820,13 @@ type UnpublishAgentResponse = UnpublishAgentResponses[keyof UnpublishAgentRespon
6805
6820
  type ResolveRegistryHandleData = {
6806
6821
  body?: never;
6807
6822
  path: {
6823
+ /**
6824
+ * The registry slug.
6825
+ */
6808
6826
  slug: string;
6827
+ /**
6828
+ * The registry-scoped handle the agent is published under.
6829
+ */
6809
6830
  handle: string;
6810
6831
  };
6811
6832
  query?: never;
@@ -6830,9 +6851,15 @@ type ResolveRegistryHandleResponse = ResolveRegistryHandleResponses[keyof Resolv
6830
6851
  type ListRegistryRequestsData = {
6831
6852
  body?: never;
6832
6853
  path: {
6854
+ /**
6855
+ * The registry slug.
6856
+ */
6833
6857
  slug: string;
6834
6858
  };
6835
6859
  query?: {
6860
+ /**
6861
+ * Maximum number of items to return (1-200).
6862
+ */
6836
6863
  limit?: number;
6837
6864
  };
6838
6865
  url: '/registries/{slug}/requests';
@@ -6860,6 +6887,9 @@ type ListRegistryRequestsResponse = ListRegistryRequestsResponses[keyof ListRegi
6860
6887
  type DecideRegistryRequestData = {
6861
6888
  body: DecideRegistryRequestInput;
6862
6889
  path: {
6890
+ /**
6891
+ * The registry slug.
6892
+ */
6863
6893
  slug: string;
6864
6894
  /**
6865
6895
  * Resource UUID
package/dist/index.d.ts CHANGED
@@ -1,8 +1,8 @@
1
- import { An as AgentClaimStartResult, Dn as AgentAccountUpgradeHint, En as AgentAccountResult, O as PrimitiveApiError, On as AgentClaimLinkResult, Qn as CreateAgentAccountInput, _ as SendThreadInput, a as ForwardInput, b as createAgent, bl as PlanLimits, c as InboxStreamOptions, d as ReplyInput, g as SendResult, h as SendInput, hp as VerifyAgentClaimInput, i as CreatedAgent, ir as CreateAgentClaimLinkInput, kd as StartAgentClaimInput, kn as AgentClaimResult, l as PrimitiveClient, m as SendAttachment, o as InboundEmail, r as CreateAgentOptions, s as InboxResource, t as AccountResource, u as PrimitiveClientOptions, v as WaitForNextOptions, vn as Account, x as createPrimitiveClient, y as client } from "./index-FvnZT9Be.js";
1
+ import { An as AgentClaimStartResult, Dn as AgentAccountUpgradeHint, En as AgentAccountResult, O as PrimitiveApiError, On as AgentClaimLinkResult, Qn as CreateAgentAccountInput, _ as SendThreadInput, a as ForwardInput, b as createAgent, bl as PlanLimits, c as InboxStreamOptions, d as ReplyInput, g as SendResult, h as SendInput, hp as VerifyAgentClaimInput, i as CreatedAgent, ir as CreateAgentClaimLinkInput, kd as StartAgentClaimInput, kn as AgentClaimResult, l as PrimitiveClient, m as SendAttachment, o as InboundEmail, r as CreateAgentOptions, s as InboxResource, t as AccountResource, u as PrimitiveClientOptions, v as WaitForNextOptions, vn as Account, x as createPrimitiveClient, y as client } from "./index-DZZQMKxn.js";
2
2
  import { $ as isPaymentSettledEvent, A as RawContentInline, B as InteractionX402Event, C as ParsedData, D as ParsedStatus, E as ParsedError, F as WebhookAttachment, G as PaymentSettledEvent, H as PAYMENT_EVENT_TYPES, I as WebhookEvent, J as isEmailReceivedEvent, K as WEBHOOK_EVENT_TYPES, L as EMAIL_EVENT_TYPES, M as TlsReportAnalysis, N as UnknownEvent, O as RawContent, P as ValidateEmailAuthResult, Q as isPaymentFailedEvent, R as INTERACTION_EVENT_TYPES, S as KnownWebhookEvent, T as ParsedDataFailed, U as PaymentEvent, V as InteractionX402Suffix, W as PaymentFailedEvent, X as isKnownWebhookEventType, Y as isInteractionX402Event, Z as isPaymentEvent, _ as ForwardResultAttachmentAnalyzed, a as DkimSignature, b as ForwardVerdict, c as DmarcResult, d as EmailAuth, f as EmailReceivedEvent, g as ForwardResult, h as ForwardOriginalSender, i as DkimResult, j as SpfResult, k as RawContentDownloadOnly, l as EmailAddress, m as ForwardAnalysis, n as AuthVerdict, o as DmarcPolicy, p as EventType, q as WebhookEventType, r as BounceAnalysis, s as DmarcReportAnalysis, t as AuthConfidence, u as EmailAnalysis, v as ForwardResultAttachmentSkipped, w as ParsedDataComplete, x as ForwardVerification, y as ForwardResultInline, z as InteractionEvent } from "./types-CAG3bi20.js";
3
3
  import { _ as buildForwardSubject, a as RawEmailDecodeErrorCode, b as normalizeReceivedEmail, c as WebhookPayloadError, d as WebhookValidationErrorCode, f as WebhookVerificationError, g as ReceivedEmailThread, h as ReceivedEmailAddress, i as RawEmailDecodeError, l as WebhookPayloadErrorCode, m as ReceivedEmail, n as PrimitiveWebhookError, o as VERIFICATION_ERRORS, p as WebhookVerificationErrorCode, r as RAW_EMAIL_ERRORS, s as WebhookErrorCode, t as PAYLOAD_ERRORS, u as WebhookValidationError, v as buildReplySubject, x as parseHeaderAddress, y as formatAddress } from "./errors-jagfi4Ue.js";
4
4
  import { A as PRIMITIVE_SIGNATURE_HEADER, B as safeValidateEmailReceivedEvent, C as StandardWebhooksSignResult, D as LEGACY_CONFIRMED_HEADER, E as verifyStandardWebhooksSignature, F as GenerateDownloadTokenOptions, I as VerifyDownloadTokenOptions, L as VerifyDownloadTokenResult, M as VerifyOptions, N as signWebhookPayload, O as LEGACY_SIGNATURE_HEADER, P as verifyWebhookSignature, R as generateDownloadToken, S as STANDARD_WEBHOOK_TIMESTAMP_HEADER, T as signStandardWebhooksPayload, V as validateEmailReceivedEvent, _ as WEBHOOK_VERSION, a as WebhookHeaders, b as STANDARD_WEBHOOK_ID_HEADER, c as getDownloadTimeRemaining, d as handleWebhookEvent, f as isDownloadExpired, g as verifyRawEmailDownload, h as receive, i as WEBHOOK_EVENT_HEADER, j as SignResult, k as PRIMITIVE_CONFIRMED_HEADER, l as getEventHeader, m as parseWebhookEvent, n as HandleWebhookOptions, o as confirmedHeaders, p as isRawIncluded, r as ReceiveRequestOptions, s as decodeRawEmail, t as DecodeRawEmailOptions, u as handleWebhook, v as validateEmailAuth, w as StandardWebhooksVerifyOptions, x as STANDARD_WEBHOOK_SIGNATURE_HEADER, y as emailReceivedEventJsonSchema, z as verifyDownloadToken } from "./index-MfFuW5sS.js";
5
- import { NonceBinding, PayoutRegistrationMessageInput, TokenDomain, TransferAuthorization, X402Challenge, X402ChargeInput, X402Client, X402ClientOptions, X402DeclinedPayment, X402Error, X402PaymentPayload, X402PaymentRequirements, X402PayoutAddress, X402Receipt, X402Signer, X402SpendPolicy, buildPayoutRegistrationMessage, createX402Client, deriveEip3009Nonce } from "./x402/index.js";
5
+ import { NonceBinding, PayoutRegistrationMessageInput, TokenDomain, TransferAuthorization, X402Challenge, X402ChargeInput, X402Client, X402ClientOptions, X402DeclinedPayment, X402Error, X402PaymentPayload, X402PaymentRequirements, X402PayoutAddress, X402Receipt, X402Signer, X402SpendPolicy, buildPayoutRegistrationMessage, createX402Client, deriveEip3009Nonce, parseEmailChallengeFromPart } from "./x402/index.js";
6
6
 
7
7
  //#region src/index.d.ts
8
8
  declare const primitive: {
@@ -11,4 +11,4 @@ declare const primitive: {
11
11
  x402: typeof createX402Client;
12
12
  };
13
13
  //#endregion
14
- export { type Account, AccountResource, type AgentAccountResult, type AgentAccountUpgradeHint, type AgentClaimLinkResult, type AgentClaimResult, type AgentClaimStartResult, AuthConfidence, AuthVerdict, BounceAnalysis, type CreateAgentAccountInput, type CreateAgentClaimLinkInput, type CreateAgentOptions, type CreatedAgent, DecodeRawEmailOptions, DkimResult, DkimSignature, DmarcPolicy, DmarcReportAnalysis, DmarcResult, EMAIL_EVENT_TYPES, EmailAddress, EmailAnalysis, EmailAuth, EmailReceivedEvent, EventType, ForwardAnalysis, type ForwardInput, ForwardOriginalSender, ForwardResult, ForwardResultAttachmentAnalyzed, ForwardResultAttachmentSkipped, ForwardResultInline, ForwardVerdict, ForwardVerification, GenerateDownloadTokenOptions, HandleWebhookOptions, INTERACTION_EVENT_TYPES, type InboundEmail, InboxResource, type InboxStreamOptions, InteractionEvent, InteractionX402Event, InteractionX402Suffix, KnownWebhookEvent, LEGACY_CONFIRMED_HEADER, LEGACY_SIGNATURE_HEADER, type NonceBinding, PAYLOAD_ERRORS, PAYMENT_EVENT_TYPES, PRIMITIVE_CONFIRMED_HEADER, PRIMITIVE_SIGNATURE_HEADER, ParsedData, ParsedDataComplete, ParsedDataFailed, ParsedError, ParsedStatus, PaymentEvent, PaymentFailedEvent, PaymentSettledEvent, type PayoutRegistrationMessageInput, type PlanLimits, PrimitiveApiError, PrimitiveClient, type PrimitiveClientOptions, PrimitiveWebhookError, RAW_EMAIL_ERRORS, RawContent, RawContentDownloadOnly, RawContentInline, RawEmailDecodeError, RawEmailDecodeErrorCode, ReceiveRequestOptions, ReceivedEmail, ReceivedEmailAddress, ReceivedEmailThread, type ReplyInput, STANDARD_WEBHOOK_ID_HEADER, STANDARD_WEBHOOK_SIGNATURE_HEADER, STANDARD_WEBHOOK_TIMESTAMP_HEADER, type SendAttachment, type SendInput, type SendResult, type SendThreadInput, SignResult, SpfResult, StandardWebhooksSignResult, StandardWebhooksVerifyOptions, type StartAgentClaimInput, TlsReportAnalysis, type TokenDomain, type TransferAuthorization, UnknownEvent, VERIFICATION_ERRORS, ValidateEmailAuthResult, type VerifyAgentClaimInput, VerifyDownloadTokenOptions, VerifyDownloadTokenResult, VerifyOptions, WEBHOOK_EVENT_HEADER, WEBHOOK_EVENT_TYPES, WEBHOOK_VERSION, type WaitForNextOptions, WebhookAttachment, WebhookErrorCode, WebhookEvent, WebhookEventType, WebhookHeaders, WebhookPayloadError, WebhookPayloadErrorCode, WebhookValidationError, WebhookValidationErrorCode, WebhookVerificationError, WebhookVerificationErrorCode, type X402Challenge, type X402ChargeInput, X402Client, type X402ClientOptions, type X402DeclinedPayment, X402Error, type X402PaymentPayload, type X402PaymentRequirements, type X402PayoutAddress, type X402Receipt, type X402Signer, type X402SpendPolicy, buildForwardSubject, buildPayoutRegistrationMessage, buildReplySubject, client, confirmedHeaders, createAgent, createPrimitiveClient, createX402Client, decodeRawEmail, primitive as default, deriveEip3009Nonce, emailReceivedEventJsonSchema, formatAddress, generateDownloadToken, getDownloadTimeRemaining, getEventHeader, handleWebhook, handleWebhookEvent, isDownloadExpired, isEmailReceivedEvent, isInteractionX402Event, isKnownWebhookEventType, isPaymentEvent, isPaymentFailedEvent, isPaymentSettledEvent, isRawIncluded, normalizeReceivedEmail, parseHeaderAddress, parseWebhookEvent, receive, safeValidateEmailReceivedEvent, signStandardWebhooksPayload, signWebhookPayload, validateEmailAuth, validateEmailReceivedEvent, verifyDownloadToken, verifyRawEmailDownload, verifyStandardWebhooksSignature, verifyWebhookSignature };
14
+ export { type Account, AccountResource, type AgentAccountResult, type AgentAccountUpgradeHint, type AgentClaimLinkResult, type AgentClaimResult, type AgentClaimStartResult, AuthConfidence, AuthVerdict, BounceAnalysis, type CreateAgentAccountInput, type CreateAgentClaimLinkInput, type CreateAgentOptions, type CreatedAgent, DecodeRawEmailOptions, DkimResult, DkimSignature, DmarcPolicy, DmarcReportAnalysis, DmarcResult, EMAIL_EVENT_TYPES, EmailAddress, EmailAnalysis, EmailAuth, EmailReceivedEvent, EventType, ForwardAnalysis, type ForwardInput, ForwardOriginalSender, ForwardResult, ForwardResultAttachmentAnalyzed, ForwardResultAttachmentSkipped, ForwardResultInline, ForwardVerdict, ForwardVerification, GenerateDownloadTokenOptions, HandleWebhookOptions, INTERACTION_EVENT_TYPES, type InboundEmail, InboxResource, type InboxStreamOptions, InteractionEvent, InteractionX402Event, InteractionX402Suffix, KnownWebhookEvent, LEGACY_CONFIRMED_HEADER, LEGACY_SIGNATURE_HEADER, type NonceBinding, PAYLOAD_ERRORS, PAYMENT_EVENT_TYPES, PRIMITIVE_CONFIRMED_HEADER, PRIMITIVE_SIGNATURE_HEADER, ParsedData, ParsedDataComplete, ParsedDataFailed, ParsedError, ParsedStatus, PaymentEvent, PaymentFailedEvent, PaymentSettledEvent, type PayoutRegistrationMessageInput, type PlanLimits, PrimitiveApiError, PrimitiveClient, type PrimitiveClientOptions, PrimitiveWebhookError, RAW_EMAIL_ERRORS, RawContent, RawContentDownloadOnly, RawContentInline, RawEmailDecodeError, RawEmailDecodeErrorCode, ReceiveRequestOptions, ReceivedEmail, ReceivedEmailAddress, ReceivedEmailThread, type ReplyInput, STANDARD_WEBHOOK_ID_HEADER, STANDARD_WEBHOOK_SIGNATURE_HEADER, STANDARD_WEBHOOK_TIMESTAMP_HEADER, type SendAttachment, type SendInput, type SendResult, type SendThreadInput, SignResult, SpfResult, StandardWebhooksSignResult, StandardWebhooksVerifyOptions, type StartAgentClaimInput, TlsReportAnalysis, type TokenDomain, type TransferAuthorization, UnknownEvent, VERIFICATION_ERRORS, ValidateEmailAuthResult, type VerifyAgentClaimInput, VerifyDownloadTokenOptions, VerifyDownloadTokenResult, VerifyOptions, WEBHOOK_EVENT_HEADER, WEBHOOK_EVENT_TYPES, WEBHOOK_VERSION, type WaitForNextOptions, WebhookAttachment, WebhookErrorCode, WebhookEvent, WebhookEventType, WebhookHeaders, WebhookPayloadError, WebhookPayloadErrorCode, WebhookValidationError, WebhookValidationErrorCode, WebhookVerificationError, WebhookVerificationErrorCode, type X402Challenge, type X402ChargeInput, X402Client, type X402ClientOptions, type X402DeclinedPayment, X402Error, type X402PaymentPayload, type X402PaymentRequirements, type X402PayoutAddress, type X402Receipt, type X402Signer, type X402SpendPolicy, buildForwardSubject, buildPayoutRegistrationMessage, buildReplySubject, client, confirmedHeaders, createAgent, createPrimitiveClient, createX402Client, decodeRawEmail, primitive as default, deriveEip3009Nonce, emailReceivedEventJsonSchema, formatAddress, generateDownloadToken, getDownloadTimeRemaining, getEventHeader, handleWebhook, handleWebhookEvent, isDownloadExpired, isEmailReceivedEvent, isInteractionX402Event, isKnownWebhookEventType, isPaymentEvent, isPaymentFailedEvent, isPaymentSettledEvent, isRawIncluded, normalizeReceivedEmail, parseEmailChallengeFromPart, parseHeaderAddress, parseWebhookEvent, receive, safeValidateEmailReceivedEvent, signStandardWebhooksPayload, signWebhookPayload, validateEmailAuth, validateEmailReceivedEvent, verifyDownloadToken, verifyRawEmailDownload, verifyStandardWebhooksSignature, verifyWebhookSignature };
package/dist/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import { a as client, f as PrimitiveApiError, i as PrimitiveClient, o as createAgent, r as InboxResource, s as createPrimitiveClient, t as AccountResource } from "./api-CwpE8_17.js";
2
2
  import { a as VERIFICATION_ERRORS, c as WebhookVerificationError, d as formatAddress, f as normalizeReceivedEmail, i as RawEmailDecodeError, l as buildForwardSubject, n as PrimitiveWebhookError, o as WebhookPayloadError, p as parseHeaderAddress, r as RAW_EMAIL_ERRORS, s as WebhookValidationError, t as PAYLOAD_ERRORS, u as buildReplySubject } from "./errors-BPJGp9I6.js";
3
3
  import { A as LEGACY_CONFIRMED_HEADER, B as isEmailReceivedEvent, C as SpfResult, D as STANDARD_WEBHOOK_TIMESTAMP_HEADER, E as STANDARD_WEBHOOK_SIGNATURE_HEADER, F as verifyWebhookSignature, G as isPaymentSettledEvent, H as isKnownWebhookEventType, I as EMAIL_EVENT_TYPES, J as safeValidateEmailReceivedEvent, K as generateDownloadToken, L as INTERACTION_EVENT_TYPES, M as PRIMITIVE_CONFIRMED_HEADER, N as PRIMITIVE_SIGNATURE_HEADER, O as signStandardWebhooksPayload, P as signWebhookPayload, R as PAYMENT_EVENT_TYPES, S as ParsedStatus, T as STANDARD_WEBHOOK_ID_HEADER, U as isPaymentEvent, V as isInteractionX402Event, W as isPaymentFailedEvent, Y as validateEmailReceivedEvent, _ as DkimResult, a as getEventHeader, b as EventType, c as isDownloadExpired, d as receive, f as verifyRawEmailDownload, g as AuthVerdict, h as AuthConfidence, i as getDownloadTimeRemaining, j as LEGACY_SIGNATURE_HEADER, k as verifyStandardWebhooksSignature, l as isRawIncluded, m as validateEmailAuth, n as confirmedHeaders, o as handleWebhook, p as WEBHOOK_VERSION, q as verifyDownloadToken, r as decodeRawEmail, s as handleWebhookEvent, t as WEBHOOK_EVENT_HEADER, u as parseWebhookEvent, v as DmarcPolicy, w as emailReceivedEventJsonSchema, x as ForwardVerdict, y as DmarcResult, z as WEBHOOK_EVENT_TYPES } from "./webhook-CiIPtegj.js";
4
- import { X402Client, X402Error, buildPayoutRegistrationMessage, createX402Client, deriveEip3009Nonce } from "./x402/index.js";
4
+ import { X402Client, X402Error, buildPayoutRegistrationMessage, createX402Client, deriveEip3009Nonce, parseEmailChallengeFromPart } from "./x402/index.js";
5
5
  //#region src/index.ts
6
6
  const primitive = {
7
7
  client,
@@ -10,4 +10,4 @@ const primitive = {
10
10
  x402: createX402Client
11
11
  };
12
12
  //#endregion
13
- export { AccountResource, AuthConfidence, AuthVerdict, DkimResult, DmarcPolicy, DmarcResult, EMAIL_EVENT_TYPES, EventType, ForwardVerdict, INTERACTION_EVENT_TYPES, InboxResource, LEGACY_CONFIRMED_HEADER, LEGACY_SIGNATURE_HEADER, PAYLOAD_ERRORS, PAYMENT_EVENT_TYPES, PRIMITIVE_CONFIRMED_HEADER, PRIMITIVE_SIGNATURE_HEADER, ParsedStatus, PrimitiveApiError, PrimitiveClient, PrimitiveWebhookError, RAW_EMAIL_ERRORS, RawEmailDecodeError, STANDARD_WEBHOOK_ID_HEADER, STANDARD_WEBHOOK_SIGNATURE_HEADER, STANDARD_WEBHOOK_TIMESTAMP_HEADER, SpfResult, VERIFICATION_ERRORS, WEBHOOK_EVENT_HEADER, WEBHOOK_EVENT_TYPES, WEBHOOK_VERSION, WebhookPayloadError, WebhookValidationError, WebhookVerificationError, X402Client, X402Error, buildForwardSubject, buildPayoutRegistrationMessage, buildReplySubject, client, confirmedHeaders, createAgent, createPrimitiveClient, createX402Client, decodeRawEmail, primitive as default, deriveEip3009Nonce, emailReceivedEventJsonSchema, formatAddress, generateDownloadToken, getDownloadTimeRemaining, getEventHeader, handleWebhook, handleWebhookEvent, isDownloadExpired, isEmailReceivedEvent, isInteractionX402Event, isKnownWebhookEventType, isPaymentEvent, isPaymentFailedEvent, isPaymentSettledEvent, isRawIncluded, normalizeReceivedEmail, parseHeaderAddress, parseWebhookEvent, receive, safeValidateEmailReceivedEvent, signStandardWebhooksPayload, signWebhookPayload, validateEmailAuth, validateEmailReceivedEvent, verifyDownloadToken, verifyRawEmailDownload, verifyStandardWebhooksSignature, verifyWebhookSignature };
13
+ export { AccountResource, AuthConfidence, AuthVerdict, DkimResult, DmarcPolicy, DmarcResult, EMAIL_EVENT_TYPES, EventType, ForwardVerdict, INTERACTION_EVENT_TYPES, InboxResource, LEGACY_CONFIRMED_HEADER, LEGACY_SIGNATURE_HEADER, PAYLOAD_ERRORS, PAYMENT_EVENT_TYPES, PRIMITIVE_CONFIRMED_HEADER, PRIMITIVE_SIGNATURE_HEADER, ParsedStatus, PrimitiveApiError, PrimitiveClient, PrimitiveWebhookError, RAW_EMAIL_ERRORS, RawEmailDecodeError, STANDARD_WEBHOOK_ID_HEADER, STANDARD_WEBHOOK_SIGNATURE_HEADER, STANDARD_WEBHOOK_TIMESTAMP_HEADER, SpfResult, VERIFICATION_ERRORS, WEBHOOK_EVENT_HEADER, WEBHOOK_EVENT_TYPES, WEBHOOK_VERSION, WebhookPayloadError, WebhookValidationError, WebhookVerificationError, X402Client, X402Error, buildForwardSubject, buildPayoutRegistrationMessage, buildReplySubject, client, confirmedHeaders, createAgent, createPrimitiveClient, createX402Client, decodeRawEmail, primitive as default, deriveEip3009Nonce, emailReceivedEventJsonSchema, formatAddress, generateDownloadToken, getDownloadTimeRemaining, getEventHeader, handleWebhook, handleWebhookEvent, isDownloadExpired, isEmailReceivedEvent, isInteractionX402Event, isKnownWebhookEventType, isPaymentEvent, isPaymentFailedEvent, isPaymentSettledEvent, isRawIncluded, normalizeReceivedEmail, parseEmailChallengeFromPart, parseHeaderAddress, parseWebhookEvent, receive, safeValidateEmailReceivedEvent, signStandardWebhooksPayload, signWebhookPayload, validateEmailAuth, validateEmailReceivedEvent, verifyDownloadToken, verifyRawEmailDownload, verifyStandardWebhooksSignature, verifyWebhookSignature };
@@ -1,2 +1,2 @@
1
- import { n as openapiDocument, t as operationManifest } from "../operations.generated-BlW1vtGP.js";
1
+ import { n as openapiDocument, t as operationManifest } from "../operations.generated-DSrvs-Sc.js";
2
2
  export { openapiDocument, operationManifest };
@@ -2659,7 +2659,8 @@ const openapiDocument = {
2659
2659
  "name": "slug",
2660
2660
  "in": "path",
2661
2661
  "required": true,
2662
- "schema": { "type": "string" }
2662
+ "schema": { "type": "string" },
2663
+ "description": "The registry slug."
2663
2664
  }],
2664
2665
  "get": {
2665
2666
  "operationId": "listRegistryAgents",
@@ -2674,7 +2675,8 @@ const openapiDocument = {
2674
2675
  "type": "integer",
2675
2676
  "minimum": 1,
2676
2677
  "maximum": 200
2677
- }
2678
+ },
2679
+ "description": "Maximum number of items to return (1-200)."
2678
2680
  }, {
2679
2681
  "name": "cursor",
2680
2682
  "in": "query",
@@ -2720,12 +2722,14 @@ const openapiDocument = {
2720
2722
  "name": "slug",
2721
2723
  "in": "path",
2722
2724
  "required": true,
2723
- "schema": { "type": "string" }
2725
+ "schema": { "type": "string" },
2726
+ "description": "The registry slug."
2724
2727
  }, {
2725
2728
  "name": "handle",
2726
2729
  "in": "path",
2727
2730
  "required": true,
2728
- "schema": { "type": "string" }
2731
+ "schema": { "type": "string" },
2732
+ "description": "The registry-scoped handle the agent is published under."
2729
2733
  }],
2730
2734
  "get": {
2731
2735
  "operationId": "resolveRegistryHandle",
@@ -2756,7 +2760,8 @@ const openapiDocument = {
2756
2760
  "name": "slug",
2757
2761
  "in": "path",
2758
2762
  "required": true,
2759
- "schema": { "type": "string" }
2763
+ "schema": { "type": "string" },
2764
+ "description": "The registry slug."
2760
2765
  }],
2761
2766
  "get": {
2762
2767
  "operationId": "listRegistryRequests",
@@ -2770,7 +2775,8 @@ const openapiDocument = {
2770
2775
  "type": "integer",
2771
2776
  "minimum": 1,
2772
2777
  "maximum": 200
2773
- }
2778
+ },
2779
+ "description": "Maximum number of items to return (1-200)."
2774
2780
  }],
2775
2781
  "responses": {
2776
2782
  "200": {
@@ -2790,7 +2796,8 @@ const openapiDocument = {
2790
2796
  "name": "slug",
2791
2797
  "in": "path",
2792
2798
  "required": true,
2793
- "schema": { "type": "string" }
2799
+ "schema": { "type": "string" },
2800
+ "description": "The registry slug."
2794
2801
  }, { "$ref": "#/components/parameters/ResourceId" }],
2795
2802
  "post": {
2796
2803
  "operationId": "decideRegistryRequest",
@@ -14322,7 +14329,7 @@ const operationManifest = [
14322
14329
  "operationId": "decideRegistryRequest",
14323
14330
  "path": "/registries/{slug}/requests/{id}",
14324
14331
  "pathParams": [{
14325
- "description": null,
14332
+ "description": "The registry slug.",
14326
14333
  "enum": null,
14327
14334
  "name": "slug",
14328
14335
  "required": true,
@@ -14584,14 +14591,14 @@ const operationManifest = [
14584
14591
  "operationId": "listRegistryAgents",
14585
14592
  "path": "/registries/{slug}/agents",
14586
14593
  "pathParams": [{
14587
- "description": null,
14594
+ "description": "The registry slug.",
14588
14595
  "enum": null,
14589
14596
  "name": "slug",
14590
14597
  "required": true,
14591
14598
  "type": "string"
14592
14599
  }],
14593
14600
  "queryParams": [{
14594
- "description": null,
14601
+ "description": "Maximum number of items to return (1-200).",
14595
14602
  "enum": null,
14596
14603
  "maximum": 200,
14597
14604
  "minimum": 1,
@@ -14650,14 +14657,14 @@ const operationManifest = [
14650
14657
  "operationId": "listRegistryRequests",
14651
14658
  "path": "/registries/{slug}/requests",
14652
14659
  "pathParams": [{
14653
- "description": null,
14660
+ "description": "The registry slug.",
14654
14661
  "enum": null,
14655
14662
  "name": "slug",
14656
14663
  "required": true,
14657
14664
  "type": "string"
14658
14665
  }],
14659
14666
  "queryParams": [{
14660
- "description": null,
14667
+ "description": "Maximum number of items to return (1-200).",
14661
14668
  "enum": null,
14662
14669
  "maximum": 200,
14663
14670
  "minimum": 1,
@@ -14708,7 +14715,7 @@ const operationManifest = [
14708
14715
  "operationId": "publishAgent",
14709
14716
  "path": "/registries/{slug}/agents",
14710
14717
  "pathParams": [{
14711
- "description": null,
14718
+ "description": "The registry slug.",
14712
14719
  "enum": null,
14713
14720
  "name": "slug",
14714
14721
  "required": true,
@@ -14761,13 +14768,13 @@ const operationManifest = [
14761
14768
  "operationId": "resolveRegistryHandle",
14762
14769
  "path": "/registries/{slug}/agents/{handle}",
14763
14770
  "pathParams": [{
14764
- "description": null,
14771
+ "description": "The registry slug.",
14765
14772
  "enum": null,
14766
14773
  "name": "slug",
14767
14774
  "required": true,
14768
14775
  "type": "string"
14769
14776
  }, {
14770
- "description": null,
14777
+ "description": "The registry-scoped handle the agent is published under.",
14771
14778
  "enum": null,
14772
14779
  "name": "handle",
14773
14780
  "required": true,
@@ -14816,13 +14823,13 @@ const operationManifest = [
14816
14823
  "operationId": "unpublishAgent",
14817
14824
  "path": "/registries/{slug}/agents/{handle}",
14818
14825
  "pathParams": [{
14819
- "description": null,
14826
+ "description": "The registry slug.",
14820
14827
  "enum": null,
14821
14828
  "name": "slug",
14822
14829
  "required": true,
14823
14830
  "type": "string"
14824
14831
  }, {
14825
- "description": null,
14832
+ "description": "The registry-scoped handle the agent is published under.",
14826
14833
  "enum": null,
14827
14834
  "name": "handle",
14828
14835
  "required": true,
@@ -197,12 +197,32 @@ declare function toPaymentPayload(network: string, auth: TransferAuthorization,
197
197
  */
198
198
  declare const DEFAULT_MAX_WINDOW_SEC: number;
199
199
  /**
200
- * Compute the EIP-3009 validity window for a payment. `validBefore` is the
201
- * value that governs on-chain validity, so it MUST cover the challenge's
202
- * `expires_at` plus a settlement margin; `validAfter` is set generously in the
203
- * past for clock skew. The total window is hard-capped at `maxWindowSec` so
204
- * neither a far-future `challengeExpiresAtSec` nor a widened margin can produce
205
- * a window the platform verifier would later reject.
200
+ * Minimum headroom between now and `validBefore`. The platform rejects a
201
+ * payment whose authorization is about to expire (it needs SMTP + DKIM + verify
202
+ * + settle latency to clear), so a `validBefore` less than this far in the
203
+ * future is a guaranteed-to-fail signature. The default window is minutes; this
204
+ * 60s floor is the absolute minimum the band tolerates.
205
+ */
206
+ declare const DEFAULT_MIN_SETTLEMENT_HEADROOM_SEC = 60;
207
+ /**
208
+ * Compute the EIP-3009 validity window for a payment, landing inside the band
209
+ * the platform accepts. `validBefore` governs on-chain validity, so it MUST
210
+ * stay far enough in the future to settle (>= `minHeadroomSec`) yet not so far
211
+ * that the total window exceeds the `maxWindowSec` cap; `validAfter` is set
212
+ * generously in the past for clock skew.
213
+ *
214
+ * Both ends of that band are payer landmines: a too-tight `validBefore` (low
215
+ * headroom, e.g. a near-expired challenge) is rejected for being about to
216
+ * expire, and a too-wide window (far-future expiry) is rejected as
217
+ * "authorization window too wide". By default this clamps the computed window
218
+ * into the band so a caller who does not override always gets a signable
219
+ * window.
220
+ *
221
+ * If the caller passes an explicit `validBeforeSec` or `validAfterSec`, that is
222
+ * an intent to pin the bound: when it falls outside the band this throws a
223
+ * specific error naming which bound was violated (rather than silently signing
224
+ * a doomed authorization), unless `clamp` is left enabled, in which case the
225
+ * pinned value is clamped into the band like the computed one.
206
226
  */
207
227
  declare function computePaymentValidityWindow(params: {
208
228
  /** The challenge's expires_at, unix seconds. */challengeExpiresAtSec: number; /** Current time, unix seconds. */
@@ -210,6 +230,27 @@ declare function computePaymentValidityWindow(params: {
210
230
  settlementMarginSec?: number; /** How far in the past to set validAfter for clock skew. Default 5 min. */
211
231
  clockSkewSec?: number; /** Hard ceiling on validBefore - validAfter. Default 24h. */
212
232
  maxWindowSec?: number;
233
+ /**
234
+ * Minimum `validBefore - nowSec`. Default 60s. A signature with less headroom
235
+ * cannot clear the SMTP+DKIM+settle latency and the platform rejects it.
236
+ */
237
+ minHeadroomSec?: number;
238
+ /**
239
+ * Explicit override for `validBefore` (unix seconds). When omitted it is
240
+ * derived from `challengeExpiresAtSec + settlementMarginSec`.
241
+ */
242
+ validBeforeSec?: number;
243
+ /**
244
+ * Explicit override for `validAfter` (unix seconds). When omitted it is
245
+ * derived from `nowSec - clockSkewSec`.
246
+ */
247
+ validAfterSec?: number;
248
+ /**
249
+ * When true (the default), an out-of-band window is clamped into the accepted
250
+ * band instead of throwing. Set `false` to reject a caller-pinned override
251
+ * that is out of band with a specific error rather than silently moving it.
252
+ */
253
+ clamp?: boolean;
213
254
  }): {
214
255
  validAfter: bigint;
215
256
  validBefore: bigint;
@@ -401,6 +442,27 @@ declare class X402Error extends Error {
401
442
  retryAfter?: string | null;
402
443
  });
403
444
  }
445
+ /**
446
+ * Parse the bytes of an inbound `interaction.json` MIME part into a typed
447
+ * {@link X402EmailChallenge} ready for {@link X402Client.payEmailChallenge}.
448
+ *
449
+ * A payer receives the x402 challenge as an `interaction.json` attachment on an
450
+ * inbound email (filename `interaction.json`, content type `application/json`).
451
+ * This validates the envelope (the strict snake_case wire shape, that it is the
452
+ * `x402.payment` `challenge` step, and that the embedded payload carries the
453
+ * fields a payer signs over) and re-assembles the nonce binding from the
454
+ * envelope's `interaction_id` + `step_id` + the payload's `challenge_nonce`, so
455
+ * the caller never has to hand-parse the part.
456
+ *
457
+ * Accepts the part body as a UTF-8 string, a `Uint8Array`/`Buffer`, or an
458
+ * already-parsed envelope object. Throws {@link X402Error} (status 0) on any
459
+ * malformed or non-challenge part.
460
+ *
461
+ * The resulting `challenge_id` is empty: the platform's private challenge id is
462
+ * not carried on the wire, and `payEmailChallenge` does not need it (it binds to
463
+ * the `interaction_id` and the challenge step id).
464
+ */
465
+ declare function parseEmailChallengeFromPart(part: string | Uint8Array | Record<string, unknown>): X402EmailChallenge;
404
466
  interface X402ClientOptions {
405
467
  /** API key. Defaults to `process.env.PRIMITIVE_API_KEY`. */
406
468
  apiKey?: string;
@@ -486,4 +548,4 @@ declare class X402Client {
486
548
  }
487
549
  declare function createX402Client(options?: X402ClientOptions): X402Client;
488
550
  //#endregion
489
- export { BuiltPaymentStep, DEFAULT_MAX_WINDOW_SEC, InteractionEnvelope, NonceBinding, PayoutRegistrationMessageInput, TRANSFER_WITH_AUTHORIZATION_TYPES, TokenDomain, TransferAuthorization, TransferWithAuthorizationTypedData, X402Challenge, X402ChargeInput, X402Client, X402ClientOptions, X402DeclinedPayment, X402EmailChallenge, X402EmailChallengeDetails, X402EmailChargeInput, X402Error, X402Network, X402NonceBinding, X402PaymentPayload, X402PaymentRequirements, X402PaymentStepPayload, X402PayoutAddress, X402Receipt, X402Signer, X402SpendPolicy, X402_INTERACTION_PROTOCOL, X402_INTERACTION_PROTOCOL_VERSION, buildExactEvmPaymentPayload, buildPaymentStepEnvelope, buildPayoutRegistrationMessage, computePaymentValidityWindow, createX402Client, deriveEip3009Nonce, signInteractionPayment, toPaymentPayload, transferWithAuthorizationTypedData };
551
+ export { BuiltPaymentStep, DEFAULT_MAX_WINDOW_SEC, DEFAULT_MIN_SETTLEMENT_HEADROOM_SEC, InteractionEnvelope, NonceBinding, PayoutRegistrationMessageInput, TRANSFER_WITH_AUTHORIZATION_TYPES, TokenDomain, TransferAuthorization, TransferWithAuthorizationTypedData, X402Challenge, X402ChargeInput, X402Client, X402ClientOptions, X402DeclinedPayment, X402EmailChallenge, X402EmailChallengeDetails, X402EmailChargeInput, X402Error, X402Network, X402NonceBinding, X402PaymentPayload, X402PaymentRequirements, X402PaymentStepPayload, X402PayoutAddress, X402Receipt, X402Signer, X402SpendPolicy, X402_INTERACTION_PROTOCOL, X402_INTERACTION_PROTOCOL_VERSION, buildExactEvmPaymentPayload, buildPaymentStepEnvelope, buildPayoutRegistrationMessage, computePaymentValidityWindow, createX402Client, deriveEip3009Nonce, parseEmailChallengeFromPart, signInteractionPayment, toPaymentPayload, transferWithAuthorizationTypedData };
@@ -164,24 +164,55 @@ function toPaymentPayload(network, auth, signature) {
164
164
  */
165
165
  const DEFAULT_MAX_WINDOW_SEC = 1440 * 60;
166
166
  /**
167
- * Compute the EIP-3009 validity window for a payment. `validBefore` is the
168
- * value that governs on-chain validity, so it MUST cover the challenge's
169
- * `expires_at` plus a settlement margin; `validAfter` is set generously in the
170
- * past for clock skew. The total window is hard-capped at `maxWindowSec` so
171
- * neither a far-future `challengeExpiresAtSec` nor a widened margin can produce
172
- * a window the platform verifier would later reject.
167
+ * Minimum headroom between now and `validBefore`. The platform rejects a
168
+ * payment whose authorization is about to expire (it needs SMTP + DKIM + verify
169
+ * + settle latency to clear), so a `validBefore` less than this far in the
170
+ * future is a guaranteed-to-fail signature. The default window is minutes; this
171
+ * 60s floor is the absolute minimum the band tolerates.
172
+ */
173
+ const DEFAULT_MIN_SETTLEMENT_HEADROOM_SEC = 60;
174
+ /**
175
+ * Compute the EIP-3009 validity window for a payment, landing inside the band
176
+ * the platform accepts. `validBefore` governs on-chain validity, so it MUST
177
+ * stay far enough in the future to settle (>= `minHeadroomSec`) yet not so far
178
+ * that the total window exceeds the `maxWindowSec` cap; `validAfter` is set
179
+ * generously in the past for clock skew.
180
+ *
181
+ * Both ends of that band are payer landmines: a too-tight `validBefore` (low
182
+ * headroom, e.g. a near-expired challenge) is rejected for being about to
183
+ * expire, and a too-wide window (far-future expiry) is rejected as
184
+ * "authorization window too wide". By default this clamps the computed window
185
+ * into the band so a caller who does not override always gets a signable
186
+ * window.
187
+ *
188
+ * If the caller passes an explicit `validBeforeSec` or `validAfterSec`, that is
189
+ * an intent to pin the bound: when it falls outside the band this throws a
190
+ * specific error naming which bound was violated (rather than silently signing
191
+ * a doomed authorization), unless `clamp` is left enabled, in which case the
192
+ * pinned value is clamped into the band like the computed one.
173
193
  */
174
194
  function computePaymentValidityWindow(params) {
175
195
  const margin = params.settlementMarginSec ?? 300;
176
196
  const skew = params.clockSkewSec ?? 300;
177
- const validBefore = BigInt(params.challengeExpiresAtSec + margin);
178
- const validAfter = BigInt(params.nowSec - skew);
179
- if (validBefore <= validAfter) throw new Error("invalid validity window: validBefore must be after validAfter (challenge already expired?)");
180
- const maxWindow = BigInt(params.maxWindowSec ?? 86400);
181
- if (validBefore - validAfter > maxWindow) throw new Error(`invalid validity window: total window exceeds the ${maxWindow}s cap (challenge expiry too far out?)`);
197
+ const maxWindow = params.maxWindowSec ?? 86400;
198
+ const minHeadroom = params.minHeadroomSec ?? 60;
199
+ const clamp = params.clamp ?? true;
200
+ if (maxWindow < minHeadroom) throw new Error(`invalid validity window config: maxWindowSec (${maxWindow}) is smaller than minHeadroomSec (${minHeadroom})`);
201
+ const validAfter = params.validAfterSec !== void 0 ? params.validAfterSec : params.nowSec - skew;
202
+ const rawValidBefore = params.validBeforeSec !== void 0 ? params.validBeforeSec : params.challengeExpiresAtSec + margin;
203
+ const floor = params.nowSec + minHeadroom;
204
+ const ceiling = validAfter + maxWindow;
205
+ const tooTight = rawValidBefore < floor;
206
+ const tooWide = rawValidBefore > ceiling;
207
+ if (!clamp && params.validBeforeSec !== void 0) {
208
+ if (tooTight) throw new Error(`invalid validity window: validBefore (${rawValidBefore}) is below the minimum settlement headroom (must be >= now + ${minHeadroom}s = ${floor}); the authorization would be rejected as about to expire`);
209
+ if (tooWide) throw new Error(`invalid validity window: validBefore (${rawValidBefore}) exceeds the ${maxWindow}s window cap (must be <= validAfter + ${maxWindow}s = ${ceiling}); the authorization window is too wide`);
210
+ }
211
+ const bandedValidBefore = tooTight ? floor : tooWide ? ceiling : rawValidBefore;
212
+ if (bandedValidBefore <= validAfter) throw new Error("invalid validity window: validBefore must be after validAfter (challenge already expired or validAfter pinned too late?)");
182
213
  return {
183
- validAfter,
184
- validBefore
214
+ validAfter: BigInt(validAfter),
215
+ validBefore: BigInt(bandedValidBefore)
185
216
  };
186
217
  }
187
218
  /**
@@ -280,6 +311,80 @@ var X402Error = class extends Error {
280
311
  this.retryAfter = options?.retryAfter ?? null;
281
312
  }
282
313
  };
314
+ /** A UUID, as carried by `interaction_id`'s local part and the step ids. */
315
+ const EXTRACT_UUID_RE = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
316
+ /** An interaction id is `uuid@domain`. */
317
+ const EXTRACT_WIRE_ID_RE = new RegExp(`^${EXTRACT_UUID_RE.source.slice(1, -1)}@[^\\s@]+$`, "i");
318
+ /**
319
+ * Parse the bytes of an inbound `interaction.json` MIME part into a typed
320
+ * {@link X402EmailChallenge} ready for {@link X402Client.payEmailChallenge}.
321
+ *
322
+ * A payer receives the x402 challenge as an `interaction.json` attachment on an
323
+ * inbound email (filename `interaction.json`, content type `application/json`).
324
+ * This validates the envelope (the strict snake_case wire shape, that it is the
325
+ * `x402.payment` `challenge` step, and that the embedded payload carries the
326
+ * fields a payer signs over) and re-assembles the nonce binding from the
327
+ * envelope's `interaction_id` + `step_id` + the payload's `challenge_nonce`, so
328
+ * the caller never has to hand-parse the part.
329
+ *
330
+ * Accepts the part body as a UTF-8 string, a `Uint8Array`/`Buffer`, or an
331
+ * already-parsed envelope object. Throws {@link X402Error} (status 0) on any
332
+ * malformed or non-challenge part.
333
+ *
334
+ * The resulting `challenge_id` is empty: the platform's private challenge id is
335
+ * not carried on the wire, and `payEmailChallenge` does not need it (it binds to
336
+ * the `interaction_id` and the challenge step id).
337
+ */
338
+ function parseEmailChallengeFromPart(part) {
339
+ const bad = (field) => {
340
+ throw new X402Error(`interaction.json part is not a valid x402 challenge: ${field}`, 0);
341
+ };
342
+ let envelope;
343
+ if (typeof part === "string" || part instanceof Uint8Array) {
344
+ const text = typeof part === "string" ? part : new TextDecoder().decode(part);
345
+ let parsed;
346
+ try {
347
+ parsed = JSON.parse(text);
348
+ } catch (cause) {
349
+ throw new X402Error(`interaction.json part is not valid JSON: ${cause instanceof Error ? cause.message : String(cause)}`, 0, void 0, { cause });
350
+ }
351
+ if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) bad("envelope (expected a JSON object)");
352
+ envelope = parsed;
353
+ } else if (part && typeof part === "object" && !Array.isArray(part) && !(part instanceof Uint8Array)) envelope = part;
354
+ else return bad("envelope (expected JSON bytes, a string, or an object)");
355
+ if (envelope.interaction_version !== 1) bad("interaction_version (expected 1)");
356
+ const interactionId = envelope.interaction_id;
357
+ if (typeof interactionId !== "string" || !EXTRACT_WIRE_ID_RE.test(interactionId)) bad("interaction_id (expected uuid@domain)");
358
+ if (envelope.protocol !== "x402.payment") bad(`protocol (expected "${X402_INTERACTION_PROTOCOL}")`);
359
+ if (envelope.protocol_version !== 1) bad(`protocol_version (expected 1)`);
360
+ if (envelope.step !== "challenge") bad(`step (expected "challenge", got "${String(envelope.step)}")`);
361
+ const stepId = envelope.step_id;
362
+ if (typeof stepId !== "string" || !EXTRACT_UUID_RE.test(stepId)) bad("step_id (expected a uuid)");
363
+ const expiresAt = envelope.expires_at;
364
+ if (typeof expiresAt !== "string" || !expiresAt) bad("expires_at (expected an ISO-8601 timestamp on the challenge step)");
365
+ const payload = envelope.payload;
366
+ if (!payload || typeof payload !== "object" || Array.isArray(payload)) bad("payload (expected an object)");
367
+ const p = payload;
368
+ const challengeNonce = p.challenge_nonce;
369
+ if (typeof challengeNonce !== "string" || !/^[0-9a-f]{64}$/.test(challengeNonce)) bad("payload.challenge_nonce (expected 64 lowercase hex chars)");
370
+ const paymentRequirements = p.payment_requirements;
371
+ if (!paymentRequirements || typeof paymentRequirements !== "object" || Array.isArray(paymentRequirements)) bad("payload.payment_requirements (expected an object)");
372
+ const challenge = {
373
+ interaction_id: interactionId,
374
+ challenge_id: "",
375
+ challenge: {
376
+ payment_requirements: paymentRequirements,
377
+ nonce_binding: {
378
+ interaction_id: interactionId,
379
+ challenge_step_id: stepId,
380
+ challenge_nonce: challengeNonce
381
+ },
382
+ expires_at: expiresAt
383
+ }
384
+ };
385
+ validateEmailChallenge(challenge);
386
+ return challenge;
387
+ }
283
388
  /**
284
389
  * Assert a challenge is fully hydrated before signing, so a missing field fails
285
390
  * with a named X402Error instead of an opaque viem/BigInt error mid-sign.
@@ -599,4 +704,4 @@ function createX402Client(options = {}) {
599
704
  return new X402Client(options);
600
705
  }
601
706
  //#endregion
602
- export { DEFAULT_MAX_WINDOW_SEC, TRANSFER_WITH_AUTHORIZATION_TYPES, X402Client, X402Error, X402_INTERACTION_PROTOCOL, X402_INTERACTION_PROTOCOL_VERSION, buildExactEvmPaymentPayload, buildPaymentStepEnvelope, buildPayoutRegistrationMessage, computePaymentValidityWindow, createX402Client, deriveEip3009Nonce, signInteractionPayment, toPaymentPayload, transferWithAuthorizationTypedData };
707
+ export { DEFAULT_MAX_WINDOW_SEC, DEFAULT_MIN_SETTLEMENT_HEADROOM_SEC, TRANSFER_WITH_AUTHORIZATION_TYPES, X402Client, X402Error, X402_INTERACTION_PROTOCOL, X402_INTERACTION_PROTOCOL_VERSION, buildExactEvmPaymentPayload, buildPaymentStepEnvelope, buildPayoutRegistrationMessage, computePaymentValidityWindow, createX402Client, deriveEip3009Nonce, parseEmailChallengeFromPart, signInteractionPayment, toPaymentPayload, transferWithAuthorizationTypedData };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@primitivedotdev/sdk",
3
- "version": "1.10.0",
3
+ "version": "1.11.0",
4
4
  "description": "Official Primitive Node.js SDK: webhook, api, openapi, contract, and parser runtime modules.",
5
5
  "type": "module",
6
6
  "module": "./dist/index.js",