@astrasyncai/verification-gateway 5.4.2 → 5.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (94) hide show
  1. package/README.md +65 -21
  2. package/dist/adapters/express.d.mts +1 -1
  3. package/dist/adapters/express.d.ts +1 -1
  4. package/dist/adapters/express.js +7 -3
  5. package/dist/adapters/express.js.map +1 -1
  6. package/dist/adapters/express.mjs +7 -3
  7. package/dist/adapters/express.mjs.map +1 -1
  8. package/dist/adapters/mcp.d.mts +1 -1
  9. package/dist/adapters/mcp.d.ts +1 -1
  10. package/dist/adapters/mcp.js +7 -3
  11. package/dist/adapters/mcp.js.map +1 -1
  12. package/dist/adapters/mcp.mjs +7 -3
  13. package/dist/adapters/mcp.mjs.map +1 -1
  14. package/dist/adapters/nextjs.d.mts +1 -1
  15. package/dist/adapters/nextjs.d.ts +1 -1
  16. package/dist/adapters/nextjs.js +7 -3
  17. package/dist/adapters/nextjs.js.map +1 -1
  18. package/dist/adapters/nextjs.mjs +7 -3
  19. package/dist/adapters/nextjs.mjs.map +1 -1
  20. package/dist/adapters/sdk.d.mts +30 -1
  21. package/dist/adapters/sdk.d.ts +30 -1
  22. package/dist/adapters/sdk.js +40 -3
  23. package/dist/adapters/sdk.js.map +1 -1
  24. package/dist/adapters/sdk.mjs +40 -3
  25. package/dist/adapters/sdk.mjs.map +1 -1
  26. package/dist/agent/index.js +1 -1
  27. package/dist/agent/index.js.map +1 -1
  28. package/dist/agent/index.mjs +1 -1
  29. package/dist/agent/index.mjs.map +1 -1
  30. package/dist/bin/astrasync-claude-hook.js +7 -3
  31. package/dist/bin/astrasync-codex-hook.js +7 -3
  32. package/dist/bin/astrasync-guard.js +7 -3
  33. package/dist/bin/astrasync.js +8 -3
  34. package/dist/browser/background.js +7 -3
  35. package/dist/browser/background.js.map +1 -1
  36. package/dist/browser/background.mjs +7 -3
  37. package/dist/browser/background.mjs.map +1 -1
  38. package/dist/cli/index.js +1 -1
  39. package/dist/cli/index.js.map +1 -1
  40. package/dist/cli/index.mjs +1 -1
  41. package/dist/cli/index.mjs.map +1 -1
  42. package/dist/codex/index.js +7 -3
  43. package/dist/codex/index.js.map +1 -1
  44. package/dist/codex/index.mjs +7 -3
  45. package/dist/codex/index.mjs.map +1 -1
  46. package/dist/cursor/extension.js +7 -3
  47. package/dist/cursor/extension.js.map +1 -1
  48. package/dist/cursor/extension.mjs +7 -3
  49. package/dist/cursor/extension.mjs.map +1 -1
  50. package/dist/edge-config.d.mts +1 -1
  51. package/dist/edge-config.d.ts +1 -1
  52. package/dist/edge-config.js +1 -1
  53. package/dist/edge-config.js.map +1 -1
  54. package/dist/edge-config.mjs +1 -1
  55. package/dist/edge-config.mjs.map +1 -1
  56. package/dist/edge-core/index.d.mts +1 -1
  57. package/dist/edge-core/index.d.ts +1 -1
  58. package/dist/edge-core/index.js +7 -3
  59. package/dist/edge-core/index.js.map +1 -1
  60. package/dist/edge-core/index.mjs +7 -3
  61. package/dist/edge-core/index.mjs.map +1 -1
  62. package/dist/gateway/gateway.js +7 -3
  63. package/dist/gateway/gateway.js.map +1 -1
  64. package/dist/gateway/gateway.mjs +7 -3
  65. package/dist/gateway/gateway.mjs.map +1 -1
  66. package/dist/git-trigger/git-hooks.d.mts +1 -1
  67. package/dist/git-trigger/git-hooks.d.ts +1 -1
  68. package/dist/index.d.mts +77 -4
  69. package/dist/index.d.ts +77 -4
  70. package/dist/index.js +40 -3
  71. package/dist/index.js.map +1 -1
  72. package/dist/index.mjs +40 -3
  73. package/dist/index.mjs.map +1 -1
  74. package/dist/registration/index.js +1 -1
  75. package/dist/registration/index.js.map +1 -1
  76. package/dist/registration/index.mjs +1 -1
  77. package/dist/registration/index.mjs.map +1 -1
  78. package/dist/transport/index.js +1 -1
  79. package/dist/transport/index.js.map +1 -1
  80. package/dist/transport/index.mjs +1 -1
  81. package/dist/transport/index.mjs.map +1 -1
  82. package/dist/{types-Bd2O3eX1.d.mts → types-C-hPsi9M.d.mts} +45 -1
  83. package/dist/{types-DMChboN_.d.ts → types-CKouL1Tv.d.ts} +45 -1
  84. package/dist/{types-BU04qAAR.d.mts → types-D8DDG-qK.d.mts} +45 -1
  85. package/dist/{types-BU04qAAR.d.ts → types-D8DDG-qK.d.ts} +45 -1
  86. package/dist/ui/index.d.mts +1 -1
  87. package/dist/ui/index.d.ts +1 -1
  88. package/dist/verify.d.mts +1 -1
  89. package/dist/verify.d.ts +1 -1
  90. package/dist/verify.js +7 -3
  91. package/dist/verify.js.map +1 -1
  92. package/dist/verify.mjs +7 -3
  93. package/dist/verify.mjs.map +1 -1
  94. package/package.json +1 -1
@@ -1,4 +1,4 @@
1
- import { T as TokenGuidance, b as CounterpartyType } from '../types-Bd2O3eX1.mjs';
1
+ import { T as TokenGuidance, b as CounterpartyType } from '../types-C-hPsi9M.mjs';
2
2
  import '../metadata-capture.mjs';
3
3
 
4
4
  /**
@@ -1,4 +1,4 @@
1
- import { T as TokenGuidance, b as CounterpartyType } from '../types-DMChboN_.js';
1
+ import { T as TokenGuidance, b as CounterpartyType } from '../types-CKouL1Tv.js';
2
2
  import '../metadata-capture.js';
3
3
 
4
4
  /**
package/dist/index.d.mts CHANGED
@@ -653,11 +653,48 @@ interface VerificationResult {
653
653
  * instrument on file (steer the user to add one via onboarding).
654
654
  */
655
655
  settlementOutcome?: SettlementOutcomeInfo;
656
+ /**
657
+ * 5.5.0 (astra-pay): interim merchant self-settlement token. Present ONLY
658
+ * for firstParty merchants opted into settlement_mode='self_settle' on the
659
+ * confirm leg — YOUR server charges with this material on the shared Stripe
660
+ * account and reports the outcome via `client.reportSettlement()`.
661
+ * MERCHANT-ONLY lane: never expose it to the agent plane, never log it,
662
+ * never echo it back over the bridge handoff (the bridge strips it
663
+ * defensively). Charge with idempotency key `voucher:<jti>` and
664
+ * `metadata.jti` — that lets the platform webhook auto-reconcile even if
665
+ * your report never arrives.
666
+ */
667
+ settlementToken?: MerchantSettlementToken;
656
668
  /** Timestamp of verification */
657
669
  verifiedAt: Date;
658
670
  /** TTL for this result (seconds) */
659
671
  cacheTtl?: number;
660
672
  }
673
+ /**
674
+ * 5.5.0 (astra-pay): agent-blind settlement token for self-settling
675
+ * first-party merchants. Self-describing via `type`, so a Stripe Shared
676
+ * Payment Token can replace the raw customer/payment-method pair without a
677
+ * contract change.
678
+ */
679
+ interface MerchantSettlementToken {
680
+ type: 'stripe_delegated_charge';
681
+ stripeCustomerId: string;
682
+ stripePaymentMethodId: string;
683
+ /** Integer minor units — money is never a float on the wire. */
684
+ amountMinor: number;
685
+ /** Upper-case ISO-4217. */
686
+ currency: string;
687
+ /** Verification session id — the report-back key. */
688
+ sessionId: string | null;
689
+ /** The pending kya_shop_order row your report resolves. */
690
+ orderId: string;
691
+ /** Settlement spine: charge with Stripe idempotency key `voucher:<jti>`
692
+ * and set `metadata.jti` on the PaymentIntent. */
693
+ jti: string;
694
+ statementSuffix: string | null;
695
+ /** Advisory charge-by bound (ISO); stuck orders are ops-swept after it. */
696
+ expiresAt: string;
697
+ }
661
698
  /**
662
699
  * 5.3.0 (astra-pay): sanitized outcome of first-party charge-at-redeem
663
700
  * settlement. Carries NO voucher/instrument material — the settlement channel
@@ -668,9 +705,16 @@ interface VerificationResult {
668
705
  * approves, the platform re-drives the confirm with the SAME
669
706
  * checkoutSessionId and that re-drive carries the settling outcome
670
707
  * (one order row per session — the re-drive claims the same row).
708
+ *
709
+ * 5.5.0: OPEN union — the platform may introduce statuses (e.g.
710
+ * `pending_merchant` for self-settling merchants) ahead of your SDK version.
711
+ * Rule: treat any status you don't recognize as PENDING, never as failed.
712
+ * Also 5.5.0: `no_instrument` on a held/approved session is NON-terminal —
713
+ * the human's approval is NOT consumed; a re-drive with the same
714
+ * checkoutSessionId settles once a card is on file.
671
715
  */
672
716
  interface SettlementOutcomeInfo {
673
- status: 'settled' | 'failed' | 'requires_action' | 'no_instrument' | 'requires_approval';
717
+ status: 'settled' | 'failed' | 'requires_action' | 'no_instrument' | 'requires_approval' | 'pending_merchant' | (string & {});
674
718
  /** First-party order id — the buyer sees the purchase in their AstraSync
675
719
  * dashboard orders view (no public receipt page). */
676
720
  orderId?: string;
@@ -1685,6 +1729,13 @@ declare class VerificationGatewayClient {
1685
1729
  * settled/failed/requires_action/no_instrument outcome (+ `orderId`), and the
1686
1730
  * identity/policy/`failures` fields for a denial. On any non-`confirm`/first-
1687
1731
  * party path `settlementOutcome` is simply absent — no money moves.
1732
+ *
1733
+ * 5.5.0 self-settling merchants (settlement_mode='self_settle'): the result
1734
+ * carries `.settlementToken` instead of a completed charge. Charge on your
1735
+ * own integration with Stripe idempotency key `voucher:<token.jti>` and
1736
+ * `metadata: { jti: token.jti, sessionId: token.sessionId }`, then call
1737
+ * `reportSettlement()` with the outcome. Treat any `settlementOutcome.status`
1738
+ * you don't recognize (e.g. `pending_merchant`) as PENDING, never failed.
1688
1739
  */
1689
1740
  confirmCheckout(options: {
1690
1741
  astraId?: string;
@@ -1699,6 +1750,28 @@ declare class VerificationGatewayClient {
1699
1750
  counterpartyUrl?: string;
1700
1751
  counterpartyType?: string;
1701
1752
  }): Promise<VerificationResult>;
1753
+ /**
1754
+ * 5.5.0 (astra-pay): report a self-settled charge outcome back to the
1755
+ * platform — the other half of the `settlementToken` contract. Call after
1756
+ * your PaymentIntent reaches a terminal state so the buyer's dashboard,
1757
+ * /orders and the agent's poll surface reconcile. Authenticated with this
1758
+ * client's api key (must be the merchant's own). Amounts must match the
1759
+ * order EXACTLY (integer minor units) or the report is rejected whole
1760
+ * (409 amount_mismatch). Replays of the same terminal state are safe.
1761
+ */
1762
+ reportSettlement(options: {
1763
+ sessionId: string;
1764
+ status: 'settled' | 'declined' | 'failed';
1765
+ amountMinor: number;
1766
+ currency: string;
1767
+ /** Stripe PaymentIntent id — REQUIRED when status is 'settled'. */
1768
+ processorRef?: string;
1769
+ failureCode?: string;
1770
+ }): Promise<{
1771
+ orderId: string;
1772
+ status: string;
1773
+ alreadySettled?: boolean;
1774
+ }>;
1702
1775
  /**
1703
1776
  * Quick verification — checks credentials and policy in one call.
1704
1777
  *
@@ -4641,7 +4714,7 @@ declare function detectRuntime(userAgent: string | undefined | null): string | u
4641
4714
  * silently (never throwing), so this is a no-op there — which is correct:
4642
4715
  * in a browser the page's real UA is the honest identity.
4643
4716
  */
4644
- declare const SDK_USER_AGENT = "astrasync-sdk/5.4.1";
4717
+ declare const SDK_USER_AGENT = "astrasync-sdk/5.5.0";
4645
4718
  declare const sdkFetch: typeof fetch;
4646
4719
 
4647
4720
  /**
@@ -4662,6 +4735,6 @@ declare const sdkFetch: typeof fetch;
4662
4735
  * is fine — bumping both in the release-ceremony commit keeps them
4663
4736
  * lockstep.
4664
4737
  */
4665
- declare const SDK_VERSION = "5.4.1";
4738
+ declare const SDK_VERSION = "5.5.0";
4666
4739
 
4667
- export { AgentClient, type AgentCredentials, type AgentProtocol, type AgentRecord, AstraSync, type AstraSyncConfig, type AstraSyncCredentials, AstraSyncError, type AttemptOutcome, type AttemptReport, AuthenticationError, type BuildGuidanceParams, CAPTURE_SCHEMA_VERSION, type CallerMetadata, ChallengeHandler, type CommerceArtifactsPayload, type CommerceContext, type CommercePipelineInput, type CommerceShieldProps, type ConsiderationItem, type ConsiderationSet, type CounterpartyType, DEFAULT_EDGE_CONFIG, type DynamicPlatformFingerprint, type EdgeConfig, type EdgeMode, type EdgePathRule, type EdgeVerificationDepth, type EnhancedVerificationResult, type ExpressMiddlewareOptions, type FetchEdgeConfigResult, type FetchEdgeConfigSuccess, type FiatSettlementBinding, type FrameworkConfig, type GatewayConfig, type GuidanceEnvelope, type GuidanceInfo, type HealthResponse, KYDRequiredError, MAX_HEADERS, MAX_HEADER_VALUE_BYTES, MAX_TOTAL_BYTES, MCP_VERIFIED_HOP_HEADER, MCP_VERIFIED_HOP_MAX_AGE_MS, type McpMiddlewareOptions, type ModelConfig, type NextJsMiddlewareOptions, type ObservedMetadata, type PDLSSConfig$1 as PDLSSConfig, type PDLSSDuration, type PDLSSInfo, type PDLSSLimits, type PDLSSPurpose, type PDLSSScope, type PDLSSSelfInstantiation, PLATFORM_AGENT_SIGNATURES, type PendingRegistrationResponse, type PlatformAgentVendor, type PlatformDetectionInput, type PlatformFingerprint, type PlatformSignatureDef, type PollRegistrationResult, type ProtocolTransport, RUNTIME_SIGNATURES, type RegisterOptions, type RegisterResult, RegistrationDeniedError, RegistrationExpiredError, type RegistrationResponse, RegistrationTimeoutError, type RouteAccessConfig, type RuntimeChallengeResult, type RuntimeSignature, type SDKOptions, SDK_USER_AGENT, type SanitizeHeadersResult, type SettlementArtifact, type SettlementArtifactBinding, type SettlementArtifactBindingBase, type SettlementDecision, type SettlementOutcomeInfo, type SettlementRequest, type StablecoinSettlementBinding, type StepUpApprovalInfo, type StepUpApprovalStatus, type StepUpOutcome, TRUST_LEVEL_RANGES, type TokenGuidance, type ToolGate, type ToolGateConfig, type TrustLevel, SDK_VERSION as VERSION, type VerificationInterstitialProps, type VerificationRequest, type VerificationResult, type VerifiedAgent, type VerifiedDeveloper, type VerifiedHopMarker, type VerifiedOrganization, type VerifyOptions, type VerifyResponse, type WaitForApprovalOptions, type WellKnownAgenticCommerce, _resetEdgeConfigCache, index as agent, authorizeSettlement, awaitStepUpApproval, buildGuidance, buildSdkObservedMetadata, clearCache, createMcpMiddleware, degradeToObserve, deriveConnectionFromHeaders, detectPlatformFingerprint, detectRuntime, express, extractApiKeyFormat, extractCredentials, extractMcpCredentials, extractPlatformHeaders, fetchEdgeConfig, fetchRoutes, getCachedWellKnownUrls, getEdgeConfig, getTrustLevel, getWellKnownUrls, hasCredentials, isEdgeConfig, isVerifiedHopValidFor, matchEdgePathRule, matchPlatformSignature, nextjs, parseVerifiedHop, pollStepUpStatus, prefetchWellKnown, quickVerify, recordDecision, reportAttempt, reportUnregisteredAttempt, sanitizeHeaders, sdk, sdkFetch, serializeVerifiedHop, setMcpMeta, index$1 as transport, verify };
4740
+ export { AgentClient, type AgentCredentials, type AgentProtocol, type AgentRecord, AstraSync, type AstraSyncConfig, type AstraSyncCredentials, AstraSyncError, type AttemptOutcome, type AttemptReport, AuthenticationError, type BuildGuidanceParams, CAPTURE_SCHEMA_VERSION, type CallerMetadata, ChallengeHandler, type CommerceArtifactsPayload, type CommerceContext, type CommercePipelineInput, type CommerceShieldProps, type ConsiderationItem, type ConsiderationSet, type CounterpartyType, DEFAULT_EDGE_CONFIG, type DynamicPlatformFingerprint, type EdgeConfig, type EdgeMode, type EdgePathRule, type EdgeVerificationDepth, type EnhancedVerificationResult, type ExpressMiddlewareOptions, type FetchEdgeConfigResult, type FetchEdgeConfigSuccess, type FiatSettlementBinding, type FrameworkConfig, type GatewayConfig, type GuidanceEnvelope, type GuidanceInfo, type HealthResponse, KYDRequiredError, MAX_HEADERS, MAX_HEADER_VALUE_BYTES, MAX_TOTAL_BYTES, MCP_VERIFIED_HOP_HEADER, MCP_VERIFIED_HOP_MAX_AGE_MS, type McpMiddlewareOptions, type MerchantSettlementToken, type ModelConfig, type NextJsMiddlewareOptions, type ObservedMetadata, type PDLSSConfig$1 as PDLSSConfig, type PDLSSDuration, type PDLSSInfo, type PDLSSLimits, type PDLSSPurpose, type PDLSSScope, type PDLSSSelfInstantiation, PLATFORM_AGENT_SIGNATURES, type PendingRegistrationResponse, type PlatformAgentVendor, type PlatformDetectionInput, type PlatformFingerprint, type PlatformSignatureDef, type PollRegistrationResult, type ProtocolTransport, RUNTIME_SIGNATURES, type RegisterOptions, type RegisterResult, RegistrationDeniedError, RegistrationExpiredError, type RegistrationResponse, RegistrationTimeoutError, type RouteAccessConfig, type RuntimeChallengeResult, type RuntimeSignature, type SDKOptions, SDK_USER_AGENT, type SanitizeHeadersResult, type SettlementArtifact, type SettlementArtifactBinding, type SettlementArtifactBindingBase, type SettlementDecision, type SettlementOutcomeInfo, type SettlementRequest, type StablecoinSettlementBinding, type StepUpApprovalInfo, type StepUpApprovalStatus, type StepUpOutcome, TRUST_LEVEL_RANGES, type TokenGuidance, type ToolGate, type ToolGateConfig, type TrustLevel, SDK_VERSION as VERSION, type VerificationInterstitialProps, type VerificationRequest, type VerificationResult, type VerifiedAgent, type VerifiedDeveloper, type VerifiedHopMarker, type VerifiedOrganization, type VerifyOptions, type VerifyResponse, type WaitForApprovalOptions, type WellKnownAgenticCommerce, _resetEdgeConfigCache, index as agent, authorizeSettlement, awaitStepUpApproval, buildGuidance, buildSdkObservedMetadata, clearCache, createMcpMiddleware, degradeToObserve, deriveConnectionFromHeaders, detectPlatformFingerprint, detectRuntime, express, extractApiKeyFormat, extractCredentials, extractMcpCredentials, extractPlatformHeaders, fetchEdgeConfig, fetchRoutes, getCachedWellKnownUrls, getEdgeConfig, getTrustLevel, getWellKnownUrls, hasCredentials, isEdgeConfig, isVerifiedHopValidFor, matchEdgePathRule, matchPlatformSignature, nextjs, parseVerifiedHop, pollStepUpStatus, prefetchWellKnown, quickVerify, recordDecision, reportAttempt, reportUnregisteredAttempt, sanitizeHeaders, sdk, sdkFetch, serializeVerifiedHop, setMcpMeta, index$1 as transport, verify };
package/dist/index.d.ts CHANGED
@@ -653,11 +653,48 @@ interface VerificationResult {
653
653
  * instrument on file (steer the user to add one via onboarding).
654
654
  */
655
655
  settlementOutcome?: SettlementOutcomeInfo;
656
+ /**
657
+ * 5.5.0 (astra-pay): interim merchant self-settlement token. Present ONLY
658
+ * for firstParty merchants opted into settlement_mode='self_settle' on the
659
+ * confirm leg — YOUR server charges with this material on the shared Stripe
660
+ * account and reports the outcome via `client.reportSettlement()`.
661
+ * MERCHANT-ONLY lane: never expose it to the agent plane, never log it,
662
+ * never echo it back over the bridge handoff (the bridge strips it
663
+ * defensively). Charge with idempotency key `voucher:<jti>` and
664
+ * `metadata.jti` — that lets the platform webhook auto-reconcile even if
665
+ * your report never arrives.
666
+ */
667
+ settlementToken?: MerchantSettlementToken;
656
668
  /** Timestamp of verification */
657
669
  verifiedAt: Date;
658
670
  /** TTL for this result (seconds) */
659
671
  cacheTtl?: number;
660
672
  }
673
+ /**
674
+ * 5.5.0 (astra-pay): agent-blind settlement token for self-settling
675
+ * first-party merchants. Self-describing via `type`, so a Stripe Shared
676
+ * Payment Token can replace the raw customer/payment-method pair without a
677
+ * contract change.
678
+ */
679
+ interface MerchantSettlementToken {
680
+ type: 'stripe_delegated_charge';
681
+ stripeCustomerId: string;
682
+ stripePaymentMethodId: string;
683
+ /** Integer minor units — money is never a float on the wire. */
684
+ amountMinor: number;
685
+ /** Upper-case ISO-4217. */
686
+ currency: string;
687
+ /** Verification session id — the report-back key. */
688
+ sessionId: string | null;
689
+ /** The pending kya_shop_order row your report resolves. */
690
+ orderId: string;
691
+ /** Settlement spine: charge with Stripe idempotency key `voucher:<jti>`
692
+ * and set `metadata.jti` on the PaymentIntent. */
693
+ jti: string;
694
+ statementSuffix: string | null;
695
+ /** Advisory charge-by bound (ISO); stuck orders are ops-swept after it. */
696
+ expiresAt: string;
697
+ }
661
698
  /**
662
699
  * 5.3.0 (astra-pay): sanitized outcome of first-party charge-at-redeem
663
700
  * settlement. Carries NO voucher/instrument material — the settlement channel
@@ -668,9 +705,16 @@ interface VerificationResult {
668
705
  * approves, the platform re-drives the confirm with the SAME
669
706
  * checkoutSessionId and that re-drive carries the settling outcome
670
707
  * (one order row per session — the re-drive claims the same row).
708
+ *
709
+ * 5.5.0: OPEN union — the platform may introduce statuses (e.g.
710
+ * `pending_merchant` for self-settling merchants) ahead of your SDK version.
711
+ * Rule: treat any status you don't recognize as PENDING, never as failed.
712
+ * Also 5.5.0: `no_instrument` on a held/approved session is NON-terminal —
713
+ * the human's approval is NOT consumed; a re-drive with the same
714
+ * checkoutSessionId settles once a card is on file.
671
715
  */
672
716
  interface SettlementOutcomeInfo {
673
- status: 'settled' | 'failed' | 'requires_action' | 'no_instrument' | 'requires_approval';
717
+ status: 'settled' | 'failed' | 'requires_action' | 'no_instrument' | 'requires_approval' | 'pending_merchant' | (string & {});
674
718
  /** First-party order id — the buyer sees the purchase in their AstraSync
675
719
  * dashboard orders view (no public receipt page). */
676
720
  orderId?: string;
@@ -1685,6 +1729,13 @@ declare class VerificationGatewayClient {
1685
1729
  * settled/failed/requires_action/no_instrument outcome (+ `orderId`), and the
1686
1730
  * identity/policy/`failures` fields for a denial. On any non-`confirm`/first-
1687
1731
  * party path `settlementOutcome` is simply absent — no money moves.
1732
+ *
1733
+ * 5.5.0 self-settling merchants (settlement_mode='self_settle'): the result
1734
+ * carries `.settlementToken` instead of a completed charge. Charge on your
1735
+ * own integration with Stripe idempotency key `voucher:<token.jti>` and
1736
+ * `metadata: { jti: token.jti, sessionId: token.sessionId }`, then call
1737
+ * `reportSettlement()` with the outcome. Treat any `settlementOutcome.status`
1738
+ * you don't recognize (e.g. `pending_merchant`) as PENDING, never failed.
1688
1739
  */
1689
1740
  confirmCheckout(options: {
1690
1741
  astraId?: string;
@@ -1699,6 +1750,28 @@ declare class VerificationGatewayClient {
1699
1750
  counterpartyUrl?: string;
1700
1751
  counterpartyType?: string;
1701
1752
  }): Promise<VerificationResult>;
1753
+ /**
1754
+ * 5.5.0 (astra-pay): report a self-settled charge outcome back to the
1755
+ * platform — the other half of the `settlementToken` contract. Call after
1756
+ * your PaymentIntent reaches a terminal state so the buyer's dashboard,
1757
+ * /orders and the agent's poll surface reconcile. Authenticated with this
1758
+ * client's api key (must be the merchant's own). Amounts must match the
1759
+ * order EXACTLY (integer minor units) or the report is rejected whole
1760
+ * (409 amount_mismatch). Replays of the same terminal state are safe.
1761
+ */
1762
+ reportSettlement(options: {
1763
+ sessionId: string;
1764
+ status: 'settled' | 'declined' | 'failed';
1765
+ amountMinor: number;
1766
+ currency: string;
1767
+ /** Stripe PaymentIntent id — REQUIRED when status is 'settled'. */
1768
+ processorRef?: string;
1769
+ failureCode?: string;
1770
+ }): Promise<{
1771
+ orderId: string;
1772
+ status: string;
1773
+ alreadySettled?: boolean;
1774
+ }>;
1702
1775
  /**
1703
1776
  * Quick verification — checks credentials and policy in one call.
1704
1777
  *
@@ -4641,7 +4714,7 @@ declare function detectRuntime(userAgent: string | undefined | null): string | u
4641
4714
  * silently (never throwing), so this is a no-op there — which is correct:
4642
4715
  * in a browser the page's real UA is the honest identity.
4643
4716
  */
4644
- declare const SDK_USER_AGENT = "astrasync-sdk/5.4.1";
4717
+ declare const SDK_USER_AGENT = "astrasync-sdk/5.5.0";
4645
4718
  declare const sdkFetch: typeof fetch;
4646
4719
 
4647
4720
  /**
@@ -4662,6 +4735,6 @@ declare const sdkFetch: typeof fetch;
4662
4735
  * is fine — bumping both in the release-ceremony commit keeps them
4663
4736
  * lockstep.
4664
4737
  */
4665
- declare const SDK_VERSION = "5.4.1";
4738
+ declare const SDK_VERSION = "5.5.0";
4666
4739
 
4667
- export { AgentClient, type AgentCredentials, type AgentProtocol, type AgentRecord, AstraSync, type AstraSyncConfig, type AstraSyncCredentials, AstraSyncError, type AttemptOutcome, type AttemptReport, AuthenticationError, type BuildGuidanceParams, CAPTURE_SCHEMA_VERSION, type CallerMetadata, ChallengeHandler, type CommerceArtifactsPayload, type CommerceContext, type CommercePipelineInput, type CommerceShieldProps, type ConsiderationItem, type ConsiderationSet, type CounterpartyType, DEFAULT_EDGE_CONFIG, type DynamicPlatformFingerprint, type EdgeConfig, type EdgeMode, type EdgePathRule, type EdgeVerificationDepth, type EnhancedVerificationResult, type ExpressMiddlewareOptions, type FetchEdgeConfigResult, type FetchEdgeConfigSuccess, type FiatSettlementBinding, type FrameworkConfig, type GatewayConfig, type GuidanceEnvelope, type GuidanceInfo, type HealthResponse, KYDRequiredError, MAX_HEADERS, MAX_HEADER_VALUE_BYTES, MAX_TOTAL_BYTES, MCP_VERIFIED_HOP_HEADER, MCP_VERIFIED_HOP_MAX_AGE_MS, type McpMiddlewareOptions, type ModelConfig, type NextJsMiddlewareOptions, type ObservedMetadata, type PDLSSConfig$1 as PDLSSConfig, type PDLSSDuration, type PDLSSInfo, type PDLSSLimits, type PDLSSPurpose, type PDLSSScope, type PDLSSSelfInstantiation, PLATFORM_AGENT_SIGNATURES, type PendingRegistrationResponse, type PlatformAgentVendor, type PlatformDetectionInput, type PlatformFingerprint, type PlatformSignatureDef, type PollRegistrationResult, type ProtocolTransport, RUNTIME_SIGNATURES, type RegisterOptions, type RegisterResult, RegistrationDeniedError, RegistrationExpiredError, type RegistrationResponse, RegistrationTimeoutError, type RouteAccessConfig, type RuntimeChallengeResult, type RuntimeSignature, type SDKOptions, SDK_USER_AGENT, type SanitizeHeadersResult, type SettlementArtifact, type SettlementArtifactBinding, type SettlementArtifactBindingBase, type SettlementDecision, type SettlementOutcomeInfo, type SettlementRequest, type StablecoinSettlementBinding, type StepUpApprovalInfo, type StepUpApprovalStatus, type StepUpOutcome, TRUST_LEVEL_RANGES, type TokenGuidance, type ToolGate, type ToolGateConfig, type TrustLevel, SDK_VERSION as VERSION, type VerificationInterstitialProps, type VerificationRequest, type VerificationResult, type VerifiedAgent, type VerifiedDeveloper, type VerifiedHopMarker, type VerifiedOrganization, type VerifyOptions, type VerifyResponse, type WaitForApprovalOptions, type WellKnownAgenticCommerce, _resetEdgeConfigCache, index as agent, authorizeSettlement, awaitStepUpApproval, buildGuidance, buildSdkObservedMetadata, clearCache, createMcpMiddleware, degradeToObserve, deriveConnectionFromHeaders, detectPlatformFingerprint, detectRuntime, express, extractApiKeyFormat, extractCredentials, extractMcpCredentials, extractPlatformHeaders, fetchEdgeConfig, fetchRoutes, getCachedWellKnownUrls, getEdgeConfig, getTrustLevel, getWellKnownUrls, hasCredentials, isEdgeConfig, isVerifiedHopValidFor, matchEdgePathRule, matchPlatformSignature, nextjs, parseVerifiedHop, pollStepUpStatus, prefetchWellKnown, quickVerify, recordDecision, reportAttempt, reportUnregisteredAttempt, sanitizeHeaders, sdk, sdkFetch, serializeVerifiedHop, setMcpMeta, index$1 as transport, verify };
4740
+ export { AgentClient, type AgentCredentials, type AgentProtocol, type AgentRecord, AstraSync, type AstraSyncConfig, type AstraSyncCredentials, AstraSyncError, type AttemptOutcome, type AttemptReport, AuthenticationError, type BuildGuidanceParams, CAPTURE_SCHEMA_VERSION, type CallerMetadata, ChallengeHandler, type CommerceArtifactsPayload, type CommerceContext, type CommercePipelineInput, type CommerceShieldProps, type ConsiderationItem, type ConsiderationSet, type CounterpartyType, DEFAULT_EDGE_CONFIG, type DynamicPlatformFingerprint, type EdgeConfig, type EdgeMode, type EdgePathRule, type EdgeVerificationDepth, type EnhancedVerificationResult, type ExpressMiddlewareOptions, type FetchEdgeConfigResult, type FetchEdgeConfigSuccess, type FiatSettlementBinding, type FrameworkConfig, type GatewayConfig, type GuidanceEnvelope, type GuidanceInfo, type HealthResponse, KYDRequiredError, MAX_HEADERS, MAX_HEADER_VALUE_BYTES, MAX_TOTAL_BYTES, MCP_VERIFIED_HOP_HEADER, MCP_VERIFIED_HOP_MAX_AGE_MS, type McpMiddlewareOptions, type MerchantSettlementToken, type ModelConfig, type NextJsMiddlewareOptions, type ObservedMetadata, type PDLSSConfig$1 as PDLSSConfig, type PDLSSDuration, type PDLSSInfo, type PDLSSLimits, type PDLSSPurpose, type PDLSSScope, type PDLSSSelfInstantiation, PLATFORM_AGENT_SIGNATURES, type PendingRegistrationResponse, type PlatformAgentVendor, type PlatformDetectionInput, type PlatformFingerprint, type PlatformSignatureDef, type PollRegistrationResult, type ProtocolTransport, RUNTIME_SIGNATURES, type RegisterOptions, type RegisterResult, RegistrationDeniedError, RegistrationExpiredError, type RegistrationResponse, RegistrationTimeoutError, type RouteAccessConfig, type RuntimeChallengeResult, type RuntimeSignature, type SDKOptions, SDK_USER_AGENT, type SanitizeHeadersResult, type SettlementArtifact, type SettlementArtifactBinding, type SettlementArtifactBindingBase, type SettlementDecision, type SettlementOutcomeInfo, type SettlementRequest, type StablecoinSettlementBinding, type StepUpApprovalInfo, type StepUpApprovalStatus, type StepUpOutcome, TRUST_LEVEL_RANGES, type TokenGuidance, type ToolGate, type ToolGateConfig, type TrustLevel, SDK_VERSION as VERSION, type VerificationInterstitialProps, type VerificationRequest, type VerificationResult, type VerifiedAgent, type VerifiedDeveloper, type VerifiedHopMarker, type VerifiedOrganization, type VerifyOptions, type VerifyResponse, type WaitForApprovalOptions, type WellKnownAgenticCommerce, _resetEdgeConfigCache, index as agent, authorizeSettlement, awaitStepUpApproval, buildGuidance, buildSdkObservedMetadata, clearCache, createMcpMiddleware, degradeToObserve, deriveConnectionFromHeaders, detectPlatformFingerprint, detectRuntime, express, extractApiKeyFormat, extractCredentials, extractMcpCredentials, extractPlatformHeaders, fetchEdgeConfig, fetchRoutes, getCachedWellKnownUrls, getEdgeConfig, getTrustLevel, getWellKnownUrls, hasCredentials, isEdgeConfig, isVerifiedHopValidFor, matchEdgePathRule, matchPlatformSignature, nextjs, parseVerifiedHop, pollStepUpStatus, prefetchWellKnown, quickVerify, recordDecision, reportAttempt, reportUnregisteredAttempt, sanitizeHeaders, sdk, sdkFetch, serializeVerifiedHop, setMcpMeta, index$1 as transport, verify };
package/dist/index.js CHANGED
@@ -112,7 +112,7 @@ function getTrustLevel(score) {
112
112
  }
113
113
 
114
114
  // src/version.ts
115
- var SDK_VERSION = "5.4.1";
115
+ var SDK_VERSION = "5.5.0";
116
116
 
117
117
  // src/http.ts
118
118
  var SDK_USER_AGENT = `astrasync-sdk/${SDK_VERSION}`;
@@ -647,7 +647,10 @@ async function verify(config, request, options) {
647
647
  recommendationReasons: apiResponse.recommendationReasons,
648
648
  stepUpApproval: apiResponse.stepUpApproval,
649
649
  settlement: apiResponse.settlement,
650
- settlementOutcome: apiResponse.settlementOutcome
650
+ settlementOutcome: apiResponse.settlementOutcome,
651
+ // 5.5.0 self-settlement: merchant-only material — passes through to the
652
+ // MERCHANT caller only (bridge callers strip it before the agent plane).
653
+ settlementToken: apiResponse.settlementToken
651
654
  };
652
655
  return result2;
653
656
  }
@@ -705,7 +708,8 @@ async function verify(config, request, options) {
705
708
  warningHeader: apiResponse.warningHeader,
706
709
  stepUpApproval: apiResponse.stepUpApproval,
707
710
  settlement: apiResponse.settlement,
708
- settlementOutcome: apiResponse.settlementOutcome
711
+ settlementOutcome: apiResponse.settlementOutcome,
712
+ settlementToken: apiResponse.settlementToken
709
713
  };
710
714
  if (result.recommendation === "deny") {
711
715
  result.policyAllowed = false;
@@ -2737,6 +2741,13 @@ var VerificationGatewayClient = class {
2737
2741
  * settled/failed/requires_action/no_instrument outcome (+ `orderId`), and the
2738
2742
  * identity/policy/`failures` fields for a denial. On any non-`confirm`/first-
2739
2743
  * party path `settlementOutcome` is simply absent — no money moves.
2744
+ *
2745
+ * 5.5.0 self-settling merchants (settlement_mode='self_settle'): the result
2746
+ * carries `.settlementToken` instead of a completed charge. Charge on your
2747
+ * own integration with Stripe idempotency key `voucher:<token.jti>` and
2748
+ * `metadata: { jti: token.jti, sessionId: token.sessionId }`, then call
2749
+ * `reportSettlement()` with the outcome. Treat any `settlementOutcome.status`
2750
+ * you don't recognize (e.g. `pending_merchant`) as PENDING, never failed.
2740
2751
  */
2741
2752
  async confirmCheckout(options) {
2742
2753
  const credentials = {
@@ -2766,6 +2777,32 @@ var VerificationGatewayClient = class {
2766
2777
  )
2767
2778
  );
2768
2779
  }
2780
+ /**
2781
+ * 5.5.0 (astra-pay): report a self-settled charge outcome back to the
2782
+ * platform — the other half of the `settlementToken` contract. Call after
2783
+ * your PaymentIntent reaches a terminal state so the buyer's dashboard,
2784
+ * /orders and the agent's poll surface reconcile. Authenticated with this
2785
+ * client's api key (must be the merchant's own). Amounts must match the
2786
+ * order EXACTLY (integer minor units) or the report is rejected whole
2787
+ * (409 amount_mismatch). Replays of the same terminal state are safe.
2788
+ */
2789
+ async reportSettlement(options) {
2790
+ const base = this.config.apiBaseUrl.replace(/\/+$/, "");
2791
+ const res = await sdkFetch(`${base}/merchant/settlements/report`, {
2792
+ method: "POST",
2793
+ headers: {
2794
+ "Content-Type": "application/json",
2795
+ // Same auth pair as every backend call the SDK makes (verify.ts).
2796
+ ...this.config.apiKey ? { Authorization: `Bearer ${this.config.apiKey}`, "X-API-Key": this.config.apiKey } : {}
2797
+ },
2798
+ body: JSON.stringify(options)
2799
+ });
2800
+ const json = await res.json().catch(() => ({}));
2801
+ if (!res.ok || !json.success || !json.data) {
2802
+ throw new Error(`reportSettlement failed (${res.status}): ${json.error ?? "unknown error"}`);
2803
+ }
2804
+ return json.data;
2805
+ }
2769
2806
  /**
2770
2807
  * Quick verification — checks credentials and policy in one call.
2771
2808
  *