@primitivedotdev/sdk 1.22.1 → 1.24.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.
@@ -1,5 +1,5 @@
1
- import { L as WebhookEvent, f as EmailReceivedEvent } from "./types-DJsEJwJ6.js";
2
- import { u as WebhookValidationError, y as ReceivedEmail } from "./errors-BSsdMlef.js";
1
+ import { L as WebhookEvent, f as EmailReceivedEvent } from "./types-DcXtFARL.js";
2
+ import { u as WebhookValidationError, y as ReceivedEmail } from "./errors-BgI9FKHK.js";
3
3
 
4
4
  //#region src/validation.d.ts
5
5
  interface ValidationSuccess<T> {
@@ -804,7 +804,7 @@ declare const emailReceivedEventJsonSchema: {
804
804
  };
805
805
  readonly forward: {
806
806
  readonly $ref: "#/definitions/ForwardAnalysis";
807
- readonly description: "Forward detection and analysis results.\n\nOptional. Present when the email was processed by a forward-detection pipeline (always present in Primitive's managed service). When absent, forward detection was not performed on this email.";
807
+ readonly description: "Forward detection and analysis results.\n\nOptional. In Primitive's managed service this object is included only when forwarded content is detected; when absent, no forward was detected or forward detection was not performed.";
808
808
  };
809
809
  readonly bounce: {
810
810
  readonly $ref: "#/definitions/BounceAnalysis";
package/dist/index.d.ts CHANGED
@@ -1,8 +1,9 @@
1
- import { A as client, B as PrimitiveApiError, C as SendAttachment, D as SendResult, Hr as CreateAgentClaimLinkInput, Ir as CreateAgentAccountInput, M as createPrimitiveClient, O as SendThreadInput, Rm as StartAgentClaimInput, T as SendInput, Zd as PlanLimits, _ as MemorySetInput, a as ForwardInput, b as ReplyInput, c as InboxStreamOptions, d as MemoryGetInput, dr as AgentAccountUpgradeHint, f as MemoryJsonValue, fr as AgentClaimLinkResult, g as MemorySearchResponse, h as MemorySearchInput, i as CreatedAgent, j as createAgent, k as WaitForNextOptions, l as MemoriesResource, m as MemoryRecordWithValue, mr as AgentClaimStartResult, nr as Account, o as InboundEmail, p as MemoryRecord, pr as AgentClaimResult, r as CreateAgentOptions, r_ as VerifyAgentClaimInput, s as InboxResource, t as AccountResource, u as MemoryDeleteInput, ur as AgentAccountResult, v as PrimitiveClient, y as PrimitiveClientOptions } from "./index-PTY8VraQ.js";
2
- import { $ as isPaymentFailedEvent, A as RawContentInline, B as InteractionEvent, C as ParsedData, D as ParsedStatus, E as ParsedError, F as ValidateEmailAuthResult, G as PaymentFailedEvent, H as InteractionX402Suffix, I as WebhookAttachment, J as WebhookEventType, K as PaymentSettledEvent, L as WebhookEvent, M as SpfResult, N as TlsReportAnalysis, O as RawContent, P as UnknownEvent, Q as isPaymentEvent, R as EMAIL_EVENT_TYPES, S as KnownWebhookEvent, T as ParsedDataFailed, U as PAYMENT_EVENT_TYPES, V as InteractionX402Event, W as PaymentEvent, X as isInteractionX402Event, Y as isEmailReceivedEvent, Z as isKnownWebhookEventType, _ as ForwardResultAttachmentAnalyzed, a as DkimSignature, b as ForwardVerdict, c as DmarcResult, d as EmailAuth, et as isPaymentSettledEvent, f as EmailReceivedEvent, g as ForwardResult, h as ForwardOriginalSender, i as DkimResult, j as RoutingDecision, k as RawContentDownloadOnly, l as EmailAddress, m as ForwardAnalysis, n as AuthVerdict, o as DmarcPolicy, p as EventType, q as WEBHOOK_EVENT_TYPES, 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 INTERACTION_EVENT_TYPES } from "./types-DJsEJwJ6.js";
3
- import { C as buildReplySubject, E as parseHeaderAddress, S as buildForwardSubject, T as normalizeReceivedEmail, _ as isTrustedSender, a as RawEmailDecodeErrorCode, b as ReceivedEmailAddress, c as WebhookPayloadError, d as WebhookValidationErrorCode, f as WebhookVerificationError, g as TrustedSenderResult, h as TrustedSenderOptions, i as RawEmailDecodeError, l as WebhookPayloadErrorCode, m as TrustReason, 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 validateEmailAuth, w as formatAddress, x as ReceivedEmailThread, y as ReceivedEmail } from "./errors-BSsdMlef.js";
4
- import { A as SignResult, B as validateEmailReceivedEvent, C as StandardWebhooksVerifyOptions, D as LEGACY_SIGNATURE_HEADER, E as LEGACY_CONFIRMED_HEADER, F as VerifyDownloadTokenOptions, I as VerifyDownloadTokenResult, L as generateDownloadToken, M as signWebhookPayload, N as verifyWebhookSignature, O as PRIMITIVE_CONFIRMED_HEADER, P as GenerateDownloadTokenOptions, R as verifyDownloadToken, S as StandardWebhooksSignResult, T as verifyStandardWebhooksSignature, _ as WEBHOOK_VERSION, a as WebhookHeaders, b as STANDARD_WEBHOOK_SIGNATURE_HEADER, c as getDownloadTimeRemaining, d as handleWebhookEvent, f as isDownloadExpired, g as verifyRawEmailDownload, h as receive, i as WEBHOOK_EVENT_HEADER, j as VerifyOptions, k as PRIMITIVE_SIGNATURE_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 emailReceivedEventJsonSchema, w as signStandardWebhooksPayload, x as STANDARD_WEBHOOK_TIMESTAMP_HEADER, y as STANDARD_WEBHOOK_ID_HEADER, z as safeValidateEmailReceivedEvent } from "./index-x795QzI4.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";
1
+ import { A as WaitForNextOptions, Cr as AgentClaimLinkResult, E as SendInput, Ei as CreateAgentClaimLinkInput, M as createAgent, N as createPrimitiveClient, O as SendResult, Ov as VerifyAgentClaimInput, Sr as AgentAccountUpgradeHint, Tr as AgentClaimStartResult, V as PrimitiveApiError, _ as MemorySearchResponse, a as CreatedAgent, b as PrimitiveClientOptions, bi as CreateAgentAccountInput, c as InboxResource, d as MemoryDeleteInput, f as MemoryGetInput, g as MemorySearchInput, h as MemoryRecordWithValue, i as CreateAgentOptions, j as client, k as SendThreadInput, l as InboxStreamOptions, m as MemoryRecord, ng as StartAgentClaimInput, o as ForwardInput, p as MemoryJsonValue, pr as Account, r as AttachmentPartDownload, s as InboundEmail, t as AccountResource, tp as PlanLimits, u as MemoriesResource, v as MemorySetInput, w as SendAttachment, wr as AgentClaimResult, x as ReplyInput, xr as AgentAccountResult, y as PrimitiveClient } from "./index-Dv1zvPCc.js";
2
+ import { $ as isPaymentFailedEvent, A as RawContentInline, B as InteractionEvent, C as ParsedData, D as ParsedStatus, E as ParsedError, F as ValidateEmailAuthResult, G as PaymentFailedEvent, H as InteractionX402Suffix, I as WebhookAttachment, J as WebhookEventType, K as PaymentSettledEvent, L as WebhookEvent, M as SpfResult, N as TlsReportAnalysis, O as RawContent, P as UnknownEvent, Q as isPaymentEvent, R as EMAIL_EVENT_TYPES, S as KnownWebhookEvent, T as ParsedDataFailed, U as PAYMENT_EVENT_TYPES, V as InteractionX402Event, W as PaymentEvent, X as isInteractionX402Event, Y as isEmailReceivedEvent, Z as isKnownWebhookEventType, _ as ForwardResultAttachmentAnalyzed, a as DkimSignature, b as ForwardVerdict, c as DmarcResult, d as EmailAuth, et as isPaymentSettledEvent, f as EmailReceivedEvent, g as ForwardResult, h as ForwardOriginalSender, i as DkimResult, j as RoutingDecision, k as RawContentDownloadOnly, l as EmailAddress, m as ForwardAnalysis, n as AuthVerdict, o as DmarcPolicy, p as EventType, q as WEBHOOK_EVENT_TYPES, 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 INTERACTION_EVENT_TYPES } from "./types-DcXtFARL.js";
3
+ import { C as buildReplySubject, E as parseHeaderAddress, S as buildForwardSubject, T as normalizeReceivedEmail, _ as isTrustedSender, a as RawEmailDecodeErrorCode, b as ReceivedEmailAddress, c as WebhookPayloadError, d as WebhookValidationErrorCode, f as WebhookVerificationError, g as TrustedSenderResult, h as TrustedSenderOptions, i as RawEmailDecodeError, l as WebhookPayloadErrorCode, m as TrustReason, 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 validateEmailAuth, w as formatAddress, x as ReceivedEmailThread, y as ReceivedEmail } from "./errors-BgI9FKHK.js";
4
+ import { A as SignResult, B as validateEmailReceivedEvent, C as StandardWebhooksVerifyOptions, D as LEGACY_SIGNATURE_HEADER, E as LEGACY_CONFIRMED_HEADER, F as VerifyDownloadTokenOptions, I as VerifyDownloadTokenResult, L as generateDownloadToken, M as signWebhookPayload, N as verifyWebhookSignature, O as PRIMITIVE_CONFIRMED_HEADER, P as GenerateDownloadTokenOptions, R as verifyDownloadToken, S as StandardWebhooksSignResult, T as verifyStandardWebhooksSignature, _ as WEBHOOK_VERSION, a as WebhookHeaders, b as STANDARD_WEBHOOK_SIGNATURE_HEADER, c as getDownloadTimeRemaining, d as handleWebhookEvent, f as isDownloadExpired, g as verifyRawEmailDownload, h as receive, i as WEBHOOK_EVENT_HEADER, j as VerifyOptions, k as PRIMITIVE_SIGNATURE_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 emailReceivedEventJsonSchema, w as signStandardWebhooksPayload, x as STANDARD_WEBHOOK_TIMESTAMP_HEADER, y as STANDARD_WEBHOOK_ID_HEADER, z as safeValidateEmailReceivedEvent } from "./index-fS1gVNuX.js";
5
+ import { a as NonceBinding, c as TokenDomain, f as X402PaymentPayload, l as TransferAuthorization, m as X402Signer, o as PayoutRegistrationMessageInput, x as deriveEip3009Nonce, y as buildPayoutRegistrationMessage } from "./sign-m3ZStnNw.js";
6
+ import { X402Challenge, X402ChargeInput, X402Client, X402ClientOptions, X402DeclinedPayment, X402Error, X402PaymentRequirements, X402PayoutAddress, X402Receipt, X402SpendPolicy, createX402Client, parseEmailChallengeFromPart } from "./x402/index.js";
6
7
 
7
8
  //#region src/index.d.ts
8
9
  declare const primitive: {
@@ -11,4 +12,4 @@ declare const primitive: {
11
12
  x402: typeof createX402Client;
12
13
  };
13
14
  //#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, MemoriesResource, type MemoryDeleteInput, type MemoryGetInput, type MemoryJsonValue, type MemoryRecord, type MemoryRecordWithValue, type MemorySearchInput, type MemorySearchResponse, type MemorySetInput, 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, RoutingDecision, 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, TrustReason, TrustedSenderOptions, TrustedSenderResult, 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, isTrustedSender, normalizeReceivedEmail, parseEmailChallengeFromPart, parseHeaderAddress, parseWebhookEvent, receive, safeValidateEmailReceivedEvent, signStandardWebhooksPayload, signWebhookPayload, validateEmailAuth, validateEmailReceivedEvent, verifyDownloadToken, verifyRawEmailDownload, verifyStandardWebhooksSignature, verifyWebhookSignature };
15
+ export { type Account, AccountResource, type AgentAccountResult, type AgentAccountUpgradeHint, type AgentClaimLinkResult, type AgentClaimResult, type AgentClaimStartResult, type AttachmentPartDownload, 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, MemoriesResource, type MemoryDeleteInput, type MemoryGetInput, type MemoryJsonValue, type MemoryRecord, type MemoryRecordWithValue, type MemorySearchInput, type MemorySearchResponse, type MemorySetInput, 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, RoutingDecision, 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, TrustReason, TrustedSenderOptions, TrustedSenderResult, 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, isTrustedSender, normalizeReceivedEmail, parseEmailChallengeFromPart, parseHeaderAddress, parseWebhookEvent, receive, safeValidateEmailReceivedEvent, signStandardWebhooksPayload, signWebhookPayload, validateEmailAuth, validateEmailReceivedEvent, verifyDownloadToken, verifyRawEmailDownload, verifyStandardWebhooksSignature, verifyWebhookSignature };
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
- import { a as PrimitiveClient, c as createPrimitiveClient, i as MemoriesResource, m as PrimitiveApiError, o as client, r as InboxResource, s as createAgent, t as AccountResource } from "./api-D18uroMD.js";
1
+ import { a as PrimitiveClient, c as createPrimitiveClient, i as MemoriesResource, m as PrimitiveApiError, o as client, r as InboxResource, s as createAgent, t as AccountResource } from "./api-C_OS8hb4.js";
2
2
  import { C as normalizeReceivedEmail, S as formatAddress, _ as ForwardVerdict, a as VERIFICATION_ERRORS, b as buildForwardSubject, c as WebhookVerificationError, d as AuthConfidence, f as AuthVerdict, g as EventType, h as DmarcResult, i as RawEmailDecodeError, l as isTrustedSender, m as DmarcPolicy, n as PrimitiveWebhookError, o as WebhookPayloadError, p as DkimResult, r as RAW_EMAIL_ERRORS, s as WebhookValidationError, t as PAYLOAD_ERRORS, u as validateEmailAuth, v as ParsedStatus, w as parseHeaderAddress, x as buildReplySubject, y as SpfResult } from "./errors-Bo0f7eId.js";
3
- import { A as isEmailReceivedEvent, C as PRIMITIVE_SIGNATURE_HEADER, D as INTERACTION_EVENT_TYPES, E as EMAIL_EVENT_TYPES, F as isPaymentSettledEvent, I as generateDownloadToken, L as verifyDownloadToken, M as isKnownWebhookEventType, N as isPaymentEvent, O as PAYMENT_EVENT_TYPES, P as isPaymentFailedEvent, R as safeValidateEmailReceivedEvent, S as PRIMITIVE_CONFIRMED_HEADER, T as verifyWebhookSignature, _ as STANDARD_WEBHOOK_TIMESTAMP_HEADER, a as getEventHeader, b as LEGACY_CONFIRMED_HEADER, c as isDownloadExpired, d as receive, f as verifyRawEmailDownload, g as STANDARD_WEBHOOK_SIGNATURE_HEADER, h as STANDARD_WEBHOOK_ID_HEADER, i as getDownloadTimeRemaining, j as isInteractionX402Event, k as WEBHOOK_EVENT_TYPES, l as isRawIncluded, m as emailReceivedEventJsonSchema, n as confirmedHeaders, o as handleWebhook, p as WEBHOOK_VERSION, r as decodeRawEmail, s as handleWebhookEvent, t as WEBHOOK_EVENT_HEADER, u as parseWebhookEvent, v as signStandardWebhooksPayload, w as signWebhookPayload, x as LEGACY_SIGNATURE_HEADER, y as verifyStandardWebhooksSignature, z as validateEmailReceivedEvent } from "./webhook-CTaEuJz2.js";
3
+ import { A as isEmailReceivedEvent, C as PRIMITIVE_SIGNATURE_HEADER, D as INTERACTION_EVENT_TYPES, E as EMAIL_EVENT_TYPES, F as isPaymentSettledEvent, I as generateDownloadToken, L as verifyDownloadToken, M as isKnownWebhookEventType, N as isPaymentEvent, O as PAYMENT_EVENT_TYPES, P as isPaymentFailedEvent, R as safeValidateEmailReceivedEvent, S as PRIMITIVE_CONFIRMED_HEADER, T as verifyWebhookSignature, _ as STANDARD_WEBHOOK_TIMESTAMP_HEADER, a as getEventHeader, b as LEGACY_CONFIRMED_HEADER, c as isDownloadExpired, d as receive, f as verifyRawEmailDownload, g as STANDARD_WEBHOOK_SIGNATURE_HEADER, h as STANDARD_WEBHOOK_ID_HEADER, i as getDownloadTimeRemaining, j as isInteractionX402Event, k as WEBHOOK_EVENT_TYPES, l as isRawIncluded, m as emailReceivedEventJsonSchema, n as confirmedHeaders, o as handleWebhook, p as WEBHOOK_VERSION, r as decodeRawEmail, s as handleWebhookEvent, t as WEBHOOK_EVENT_HEADER, u as parseWebhookEvent, v as signStandardWebhooksPayload, w as signWebhookPayload, x as LEGACY_SIGNATURE_HEADER, y as verifyStandardWebhooksSignature, z as validateEmailReceivedEvent } from "./webhook-BtyuJtUF.js";
4
4
  import { X402Client, X402Error, buildPayoutRegistrationMessage, createX402Client, deriveEip3009Nonce, parseEmailChallengeFromPart } from "./x402/index.js";
5
5
  //#region src/index.ts
6
6
  const primitive = {
@@ -0,0 +1,132 @@
1
+ import { i as InteractionEnvelope } from "../sign-m3ZStnNw.js";
2
+
3
+ //#region src/interactions/classify.d.ts
4
+ interface SignalContentPart {
5
+ filename: string | null;
6
+ contentType: string | null;
7
+ }
8
+ type SignalContentInventory = {
9
+ status: "complete";
10
+ parts: readonly SignalContentPart[];
11
+ } | {
12
+ status: "unavailable";
13
+ };
14
+ type SignalContentBodies = {
15
+ status: "complete";
16
+ text: string | null;
17
+ html: string | null;
18
+ } | {
19
+ status: "unavailable";
20
+ };
21
+ interface SignalContentInput {
22
+ /** Complete means the full outer inventory, including offloaded parts. */
23
+ inventory: SignalContentInventory;
24
+ bodies: SignalContentBodies;
25
+ /** Decoded bytes for the unique canonical part, never base64 text. */
26
+ canonicalPartBytes: Uint8Array | null;
27
+ }
28
+ type SignalContentReason = "inventory_unavailable" | "no_canonical_part" | "duplicate_canonical_parts" | "additional_parts" | "part_unavailable" | "invalid_interaction" | "unsupported_signal" | "unsupported_content_type" | "bodies_unavailable" | "html_present" | "text_mismatch" | "informational_signal";
29
+ interface SignalContentResult {
30
+ classification: "plain" | "informational_only" | "mixed_or_unsupported" | "unavailable";
31
+ reason: SignalContentReason;
32
+ /** Syntax/source evidence only. Never authentication or an interpreted receipt. */
33
+ interaction?: InteractionParseResult;
34
+ }
35
+ /** Pure content classification. It establishes no sender, receipt or task authority. */
36
+ declare function classifySignalContent(input: SignalContentInput): SignalContentResult;
37
+ //#endregion
38
+ //#region src/interactions/signals.d.ts
39
+ /** Explicit preparation of optional email signals. This module never sends automatically. */
40
+ interface SignalParent {
41
+ accountScope: string;
42
+ /** Authenticated original sender, as a bare mailbox. */
43
+ from: string;
44
+ /** Explicit authorized recipient identity to send from, as a bare mailbox. */
45
+ to: string;
46
+ messageId: string | null;
47
+ subject: string | null;
48
+ references: readonly string[];
49
+ }
50
+ type SignalInput = {
51
+ parent: SignalParent;
52
+ } & ({
53
+ kind: "ack";
54
+ status: "received" | "will_process" | "will_not_process";
55
+ note?: string;
56
+ } | {
57
+ kind: "read";
58
+ } | {
59
+ kind: "working";
60
+ expiresAtMs: number;
61
+ });
62
+ interface SignalDependencies {
63
+ uuid: () => string;
64
+ /** Unix time in integer milliseconds. */
65
+ now: () => number;
66
+ }
67
+ /** Persist this whole value before dispatch. requestJson fixes the ordinary send body. */
68
+ interface PreparedSignal {
69
+ readonly accountScope: string;
70
+ readonly preparedAtMs: number;
71
+ readonly expiresAtMs: number | null;
72
+ readonly idempotencyKey: string;
73
+ readonly requestJson: string;
74
+ }
75
+ type SignalPreparation = {
76
+ status: "waiting_on_parent";
77
+ } | {
78
+ status: "prepared";
79
+ prepared: PreparedSignal;
80
+ };
81
+ interface SignalSendBody {
82
+ from: string;
83
+ to: string;
84
+ subject: string;
85
+ body_text: string;
86
+ in_reply_to: string;
87
+ references: string[];
88
+ attachments: {
89
+ filename: string;
90
+ content_type: string;
91
+ content_base64: string;
92
+ }[];
93
+ }
94
+ type SignalSendResult<T> = {
95
+ status: "response";
96
+ result: T;
97
+ } | {
98
+ status: "expired";
99
+ idempotencyKey: string;
100
+ };
101
+ declare function prepareSignalEmail(input: SignalInput, dependencies: SignalDependencies): SignalPreparation;
102
+ /** One ordinary send attempt; the caller owns persistence, reconciliation and retries. */
103
+ declare function sendPreparedSignal<T>(sendMail: (body: SignalSendBody, idempotencyKey: string) => Promise<T>, prepared: PreparedSignal, options: {
104
+ accountScope: string;
105
+ now: () => number;
106
+ }): Promise<SignalSendResult<T>>;
107
+ //#endregion
108
+ //#region src/interactions/index.d.ts
109
+ declare const MAX_INTERACTION_BYTES = 65536;
110
+ declare const MAX_INTERACTION_DEPTH = 64;
111
+ type InteractionValidationResult = {
112
+ status: "valid";
113
+ envelope: InteractionEnvelope & Record<string, unknown>;
114
+ } | {
115
+ status: "unsupported";
116
+ version: number;
117
+ } | {
118
+ status: "invalid";
119
+ reason: "invalid_input" | "too_large" | "invalid_json" | "invalid_envelope";
120
+ };
121
+ type InteractionParseResult = InteractionValidationResult & {
122
+ /** Present on valid/unsupported input. Bytes are a defensive copy, never reserialized. */source?: {
123
+ text: string;
124
+ bytes?: Uint8Array;
125
+ };
126
+ };
127
+ /** Parse at most 64 KiB of strict UTF-8 JSON. Unknown protocols remain valid. */
128
+ declare function parseInteractionEnvelope(input: string | Uint8Array): InteractionParseResult;
129
+ /** Validate a decoded JSON value. Cannot detect lost duplicate keys or original bytes. */
130
+ declare function validateInteractionEnvelope(input: unknown): InteractionValidationResult;
131
+ //#endregion
132
+ export { type InteractionEnvelope, InteractionParseResult, InteractionValidationResult, MAX_INTERACTION_BYTES, MAX_INTERACTION_DEPTH, type PreparedSignal, type SignalContentBodies, type SignalContentInput, type SignalContentInventory, type SignalContentPart, type SignalContentReason, type SignalContentResult, type SignalDependencies, type SignalInput, type SignalParent, type SignalPreparation, type SignalSendBody, type SignalSendResult, classifySignalContent, parseInteractionEnvelope, prepareSignalEmail, sendPreparedSignal, validateInteractionEnvelope };