@astrasyncai/verification-gateway 3.4.0 → 3.6.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 (84) hide show
  1. package/README.md +102 -0
  2. package/dist/adapter-interface/interface.d.mts +2 -2
  3. package/dist/adapter-interface/interface.d.ts +2 -2
  4. package/dist/adapters/express.d.mts +2 -2
  5. package/dist/adapters/express.d.ts +2 -2
  6. package/dist/adapters/express.js +113 -20
  7. package/dist/adapters/express.js.map +1 -1
  8. package/dist/adapters/express.mjs +113 -20
  9. package/dist/adapters/express.mjs.map +1 -1
  10. package/dist/adapters/mcp.d.mts +1 -1
  11. package/dist/adapters/mcp.d.ts +1 -1
  12. package/dist/adapters/mcp.js +96 -20
  13. package/dist/adapters/mcp.js.map +1 -1
  14. package/dist/adapters/mcp.mjs +96 -20
  15. package/dist/adapters/mcp.mjs.map +1 -1
  16. package/dist/adapters/nextjs.d.mts +2 -2
  17. package/dist/adapters/nextjs.d.ts +2 -2
  18. package/dist/adapters/nextjs.js +101 -20
  19. package/dist/adapters/nextjs.js.map +1 -1
  20. package/dist/adapters/nextjs.mjs +101 -20
  21. package/dist/adapters/nextjs.mjs.map +1 -1
  22. package/dist/adapters/sdk.d.mts +2 -2
  23. package/dist/adapters/sdk.d.ts +2 -2
  24. package/dist/adapters/sdk.js +19 -16
  25. package/dist/adapters/sdk.js.map +1 -1
  26. package/dist/adapters/sdk.mjs +19 -16
  27. package/dist/adapters/sdk.mjs.map +1 -1
  28. package/dist/agent/index.d.mts +2 -2
  29. package/dist/agent/index.d.ts +2 -2
  30. package/dist/browser/background.js +22 -16
  31. package/dist/browser/background.js.map +1 -1
  32. package/dist/browser/background.mjs +22 -16
  33. package/dist/browser/background.mjs.map +1 -1
  34. package/dist/browser/browser-adapter.d.mts +2 -2
  35. package/dist/browser/browser-adapter.d.ts +2 -2
  36. package/dist/cli/index.d.mts +2 -2
  37. package/dist/cli/index.d.ts +2 -2
  38. package/dist/cursor/cursor-adapter.d.mts +2 -2
  39. package/dist/cursor/cursor-adapter.d.ts +2 -2
  40. package/dist/cursor/extension.d.mts +2 -2
  41. package/dist/cursor/extension.d.ts +2 -2
  42. package/dist/cursor/extension.js +22 -16
  43. package/dist/cursor/extension.js.map +1 -1
  44. package/dist/cursor/extension.mjs +22 -16
  45. package/dist/cursor/extension.mjs.map +1 -1
  46. package/dist/{express-CeFvNWDD.d.mts → express-BnMO-H3y.d.mts} +1 -1
  47. package/dist/{express-RIh05wW2.d.ts → express-DQhDzNAt.d.ts} +1 -1
  48. package/dist/gateway/gateway.d.mts +2 -2
  49. package/dist/gateway/gateway.d.ts +2 -2
  50. package/dist/gateway/gateway.js +22 -16
  51. package/dist/gateway/gateway.js.map +1 -1
  52. package/dist/gateway/gateway.mjs +22 -16
  53. package/dist/gateway/gateway.mjs.map +1 -1
  54. package/dist/git-trigger/git-hooks.d.mts +2 -2
  55. package/dist/git-trigger/git-hooks.d.ts +2 -2
  56. package/dist/{index-DgVBEiwI.d.mts → index-BT_aRn-I.d.mts} +1 -1
  57. package/dist/{index-BYu1FKMy.d.ts → index-D8-dvUFA.d.ts} +1 -1
  58. package/dist/{index-Bw4FeHMY.d.mts → index-WHKq2v17.d.mts} +5 -1
  59. package/dist/{index-C-K0WCrk.d.ts → index-rftma0ln.d.ts} +5 -1
  60. package/dist/index.d.mts +55 -9
  61. package/dist/index.d.ts +55 -9
  62. package/dist/index.js +184 -34
  63. package/dist/index.js.map +1 -1
  64. package/dist/index.mjs +182 -34
  65. package/dist/index.mjs.map +1 -1
  66. package/dist/local-evaluator/evaluator.d.mts +2 -2
  67. package/dist/local-evaluator/evaluator.d.ts +2 -2
  68. package/dist/{nextjs-xciaMpsZ.d.mts → nextjs-DFKYhxe6.d.mts} +1 -1
  69. package/dist/{nextjs--xR9zbSJ.d.ts → nextjs-DPj7ZNlq.d.ts} +1 -1
  70. package/dist/{sdk-FP7xT9F8.d.ts → sdk-CAcHgB5x.d.ts} +1 -1
  71. package/dist/{sdk-CJYCLMI0.d.mts → sdk-Cy3wAmDt.d.mts} +1 -1
  72. package/dist/transport/index.d.mts +2 -2
  73. package/dist/transport/index.d.ts +2 -2
  74. package/dist/transport/index.js +22 -4
  75. package/dist/transport/index.js.map +1 -1
  76. package/dist/transport/index.mjs +22 -4
  77. package/dist/transport/index.mjs.map +1 -1
  78. package/dist/{types-Cj92yKeA.d.mts → types-B-ubjHER.d.mts} +1 -1
  79. package/dist/{types-DOeL-dIw.d.ts → types-Bgn5gxHQ.d.ts} +1 -1
  80. package/dist/{types-Cwrvo30g.d.mts → types-CKe8O0lR.d.mts} +65 -3
  81. package/dist/{types-Cwrvo30g.d.ts → types-CKe8O0lR.d.ts} +65 -3
  82. package/dist/ui/index.d.mts +1 -1
  83. package/dist/ui/index.d.ts +1 -1
  84. package/package.json +1 -1
@@ -1,4 +1,4 @@
1
- import { a as AccessLevel, d as CounterpartyType, T as TokenGuidance } from './types-Cwrvo30g.mjs';
1
+ import { a as AccessLevel, d as CounterpartyType, T as TokenGuidance } from './types-CKe8O0lR.mjs';
2
2
 
3
3
  /**
4
4
  * AstraSync Gateway - Types for gateway modes, local evaluation, and adapter interface.
@@ -1,4 +1,4 @@
1
- import { a as AccessLevel, d as CounterpartyType, T as TokenGuidance } from './types-Cwrvo30g.js';
1
+ import { a as AccessLevel, d as CounterpartyType, T as TokenGuidance } from './types-CKe8O0lR.js';
2
2
 
3
3
  /**
4
4
  * AstraSync Gateway - Types for gateway modes, local evaluation, and adapter interface.
@@ -101,6 +101,29 @@ interface GatewayConfig {
101
101
  * the registered origin
102
102
  */
103
103
  counterpartyId?: string;
104
+ /**
105
+ * Step-up hold-and-poll (3.6.0, opt-in). When set, adapters HOLD a request
106
+ * whose verify() came back step_up_required, poll the approval status, and
107
+ * on 'approved' re-verify the same request once (cache-bypassed) so the
108
+ * backend redeems the single-use approval — the MFA model the Java SDK
109
+ * ships default-on. Values:
110
+ * - undefined (default): feature OFF — adapters fail closed immediately,
111
+ * exactly as 3.5.0 (a minor release must not silently convert instant
112
+ * 403s into multi-minute holds).
113
+ * - 0: hold until the approval's expiresAt (+5s grace); 5-min fallback
114
+ * when expiresAt is missing/unparsable (Java parity).
115
+ * - >0: hold at most this many milliseconds.
116
+ * Next.js edge runtimes enforce ~25s wall-clock budgets — set a small value
117
+ * there (≤20000) or gate in a Node route handler instead.
118
+ */
119
+ stepUpMaxWaitMs?: number;
120
+ /**
121
+ * Poll interval for the step-up hold (3.6.0). Default 3000ms, clamped to a
122
+ * 250ms floor. At the default the backend's 60/min/IP poll rate limit
123
+ * tolerates ~3 concurrent holds per merchant IP; poll errors are treated as
124
+ * transient, so limiter hits degrade the hold to 'timeout', never an error.
125
+ */
126
+ stepUpPollIntervalMs?: number;
104
127
  /**
105
128
  * Disable the one-time init self-test. The SDK normally fires a HEAD/OPTIONS
106
129
  * to `${apiBaseUrl}/agents/verify-access` on first verify() call and warns
@@ -310,6 +333,16 @@ interface StepUpApprovalInfo {
310
333
  pollUrl: string;
311
334
  expiresAt: string;
312
335
  }
336
+ /**
337
+ * Lifecycle states of a step-up approval row (mirrors the backend's
338
+ * step_up_approval_status_check constraint).
339
+ */
340
+ type StepUpApprovalStatus = 'pending' | 'approved' | 'denied' | 'expired' | 'consumed';
341
+ /**
342
+ * Terminal outcome of a hold-and-poll wait: any non-pending status, or
343
+ * 'timeout' when the hold budget ran out while the approval was still pending.
344
+ */
345
+ type StepUpOutcome = Exclude<StepUpApprovalStatus, 'pending'> | 'timeout';
313
346
  interface SettlementArtifact {
314
347
  type: string;
315
348
  artifact: string;
@@ -401,6 +434,13 @@ interface VerificationResult {
401
434
  requiresApproval?: boolean;
402
435
  /** Step-up approval info (present when transaction is in the human-approval band). */
403
436
  stepUpApproval?: StepUpApprovalInfo;
437
+ /**
438
+ * Terminal outcome of an opt-in hold-and-poll wait (3.6.0). Set by adapters
439
+ * on the result they deny with when the hold ended in denied / expired /
440
+ * consumed / timeout. Absent when the feature is off or the hold succeeded
441
+ * (an approved hold re-verifies and the fresh grant result replaces this one).
442
+ */
443
+ stepUpOutcome?: StepUpOutcome;
404
444
  /** Settlement voucher (present on clean merchant-mediated grants with a verified wallet). */
405
445
  settlement?: SettlementArtifact;
406
446
  /** Timestamp of verification */
@@ -444,9 +484,14 @@ interface VerificationRequest {
444
484
  resource?: string;
445
485
  /** Jurisdiction for the request */
446
486
  jurisdiction?: string;
447
- /** Transaction value (if applicable) */
487
+ /**
488
+ * Transaction value in MAJOR units (dollars, euros, native token units —
489
+ * NOT cents/minor units). Diverges from Stripe (minor units). UCP/ACP
490
+ * extractors auto-convert from cents (÷100). x402 uses per-token decimals.
491
+ * See `transport/transaction-value.ts` for per-protocol normalization.
492
+ */
448
493
  transactionValue?: number;
449
- /** Currency for transaction value */
494
+ /** ISO-4217 currency code for transactionValue (e.g. 'USD', 'AUD', 'ETH'). Falls back to 'USD' server-side when unset. */
450
495
  currency?: string;
451
496
  /** Whether this is a sub-agent request */
452
497
  isSubAgentRequest?: boolean;
@@ -557,6 +602,23 @@ interface ExpressMiddlewareOptions extends GatewayConfig {
557
602
  * DELETE→data.delete). Dashboard route mapping still outranks it.
558
603
  */
559
604
  extractAction?: (req: unknown) => string | undefined;
605
+ /**
606
+ * Optional extractor for the transaction value from the incoming request.
607
+ * Must return the value in MAJOR units (dollars, euros — NOT cents/minor
608
+ * units). This diverges from Stripe and most payment rails which use minor
609
+ * units. If your source is in minor units (cents), divide by 100 before
610
+ * returning.
611
+ *
612
+ * When configured, the extracted value and currency are forwarded to
613
+ * verify-access so PDLSS limit evaluation runs at middleware time.
614
+ *
615
+ * NOTE: this is opt-in upfront enforcement. `authorizeSettlement()` remains
616
+ * the REQUIRED fail-closed settlement gate at settlement time.
617
+ */
618
+ extractTransactionValue?: (req: unknown) => {
619
+ value: number;
620
+ currency: string;
621
+ } | undefined;
560
622
  /** Skip verification for certain paths */
561
623
  skipPaths?: string[];
562
624
  /** Custom response for denied requests */
@@ -752,4 +814,4 @@ interface CommerceShieldProps {
752
814
  className?: string;
753
815
  }
754
816
 
755
- export type { AccessFailure as A, CommerceShieldProps as C, EnhancedVerificationResult as E, GatewayConfig as G, NextJsMiddlewareOptions as N, PDLSSInfo as P, RouteAccessConfig as R, SDKOptions as S, TokenGuidance as T, VerificationRequest as V, AccessLevel as a, AgentCredentials as b, AstraSyncCredentials as c, CounterpartyType as d, ExpressMiddlewareOptions as e, GuidanceInfo as f, ProtocolTransport as g, RuntimeChallengeResult as h, SettlementArtifact as i, StepUpApprovalInfo as j, TrustLevel as k, VerificationResult as l, VerifiedAgent as m, VerifiedDeveloper as n, VerifiedOrganization as o };
817
+ export type { AccessFailure as A, CommerceShieldProps as C, EnhancedVerificationResult as E, GatewayConfig as G, NextJsMiddlewareOptions as N, PDLSSInfo as P, RouteAccessConfig as R, SDKOptions as S, TokenGuidance as T, VerificationRequest as V, AccessLevel as a, AgentCredentials as b, AstraSyncCredentials as c, CounterpartyType as d, ExpressMiddlewareOptions as e, GuidanceInfo as f, ProtocolTransport as g, RuntimeChallengeResult as h, SettlementArtifact as i, StepUpApprovalInfo as j, StepUpApprovalStatus as k, StepUpOutcome as l, TrustLevel as m, VerificationResult as n, VerifiedAgent as o, VerifiedDeveloper as p, VerifiedOrganization as q };
@@ -101,6 +101,29 @@ interface GatewayConfig {
101
101
  * the registered origin
102
102
  */
103
103
  counterpartyId?: string;
104
+ /**
105
+ * Step-up hold-and-poll (3.6.0, opt-in). When set, adapters HOLD a request
106
+ * whose verify() came back step_up_required, poll the approval status, and
107
+ * on 'approved' re-verify the same request once (cache-bypassed) so the
108
+ * backend redeems the single-use approval — the MFA model the Java SDK
109
+ * ships default-on. Values:
110
+ * - undefined (default): feature OFF — adapters fail closed immediately,
111
+ * exactly as 3.5.0 (a minor release must not silently convert instant
112
+ * 403s into multi-minute holds).
113
+ * - 0: hold until the approval's expiresAt (+5s grace); 5-min fallback
114
+ * when expiresAt is missing/unparsable (Java parity).
115
+ * - >0: hold at most this many milliseconds.
116
+ * Next.js edge runtimes enforce ~25s wall-clock budgets — set a small value
117
+ * there (≤20000) or gate in a Node route handler instead.
118
+ */
119
+ stepUpMaxWaitMs?: number;
120
+ /**
121
+ * Poll interval for the step-up hold (3.6.0). Default 3000ms, clamped to a
122
+ * 250ms floor. At the default the backend's 60/min/IP poll rate limit
123
+ * tolerates ~3 concurrent holds per merchant IP; poll errors are treated as
124
+ * transient, so limiter hits degrade the hold to 'timeout', never an error.
125
+ */
126
+ stepUpPollIntervalMs?: number;
104
127
  /**
105
128
  * Disable the one-time init self-test. The SDK normally fires a HEAD/OPTIONS
106
129
  * to `${apiBaseUrl}/agents/verify-access` on first verify() call and warns
@@ -310,6 +333,16 @@ interface StepUpApprovalInfo {
310
333
  pollUrl: string;
311
334
  expiresAt: string;
312
335
  }
336
+ /**
337
+ * Lifecycle states of a step-up approval row (mirrors the backend's
338
+ * step_up_approval_status_check constraint).
339
+ */
340
+ type StepUpApprovalStatus = 'pending' | 'approved' | 'denied' | 'expired' | 'consumed';
341
+ /**
342
+ * Terminal outcome of a hold-and-poll wait: any non-pending status, or
343
+ * 'timeout' when the hold budget ran out while the approval was still pending.
344
+ */
345
+ type StepUpOutcome = Exclude<StepUpApprovalStatus, 'pending'> | 'timeout';
313
346
  interface SettlementArtifact {
314
347
  type: string;
315
348
  artifact: string;
@@ -401,6 +434,13 @@ interface VerificationResult {
401
434
  requiresApproval?: boolean;
402
435
  /** Step-up approval info (present when transaction is in the human-approval band). */
403
436
  stepUpApproval?: StepUpApprovalInfo;
437
+ /**
438
+ * Terminal outcome of an opt-in hold-and-poll wait (3.6.0). Set by adapters
439
+ * on the result they deny with when the hold ended in denied / expired /
440
+ * consumed / timeout. Absent when the feature is off or the hold succeeded
441
+ * (an approved hold re-verifies and the fresh grant result replaces this one).
442
+ */
443
+ stepUpOutcome?: StepUpOutcome;
404
444
  /** Settlement voucher (present on clean merchant-mediated grants with a verified wallet). */
405
445
  settlement?: SettlementArtifact;
406
446
  /** Timestamp of verification */
@@ -444,9 +484,14 @@ interface VerificationRequest {
444
484
  resource?: string;
445
485
  /** Jurisdiction for the request */
446
486
  jurisdiction?: string;
447
- /** Transaction value (if applicable) */
487
+ /**
488
+ * Transaction value in MAJOR units (dollars, euros, native token units —
489
+ * NOT cents/minor units). Diverges from Stripe (minor units). UCP/ACP
490
+ * extractors auto-convert from cents (÷100). x402 uses per-token decimals.
491
+ * See `transport/transaction-value.ts` for per-protocol normalization.
492
+ */
448
493
  transactionValue?: number;
449
- /** Currency for transaction value */
494
+ /** ISO-4217 currency code for transactionValue (e.g. 'USD', 'AUD', 'ETH'). Falls back to 'USD' server-side when unset. */
450
495
  currency?: string;
451
496
  /** Whether this is a sub-agent request */
452
497
  isSubAgentRequest?: boolean;
@@ -557,6 +602,23 @@ interface ExpressMiddlewareOptions extends GatewayConfig {
557
602
  * DELETE→data.delete). Dashboard route mapping still outranks it.
558
603
  */
559
604
  extractAction?: (req: unknown) => string | undefined;
605
+ /**
606
+ * Optional extractor for the transaction value from the incoming request.
607
+ * Must return the value in MAJOR units (dollars, euros — NOT cents/minor
608
+ * units). This diverges from Stripe and most payment rails which use minor
609
+ * units. If your source is in minor units (cents), divide by 100 before
610
+ * returning.
611
+ *
612
+ * When configured, the extracted value and currency are forwarded to
613
+ * verify-access so PDLSS limit evaluation runs at middleware time.
614
+ *
615
+ * NOTE: this is opt-in upfront enforcement. `authorizeSettlement()` remains
616
+ * the REQUIRED fail-closed settlement gate at settlement time.
617
+ */
618
+ extractTransactionValue?: (req: unknown) => {
619
+ value: number;
620
+ currency: string;
621
+ } | undefined;
560
622
  /** Skip verification for certain paths */
561
623
  skipPaths?: string[];
562
624
  /** Custom response for denied requests */
@@ -752,4 +814,4 @@ interface CommerceShieldProps {
752
814
  className?: string;
753
815
  }
754
816
 
755
- export type { AccessFailure as A, CommerceShieldProps as C, EnhancedVerificationResult as E, GatewayConfig as G, NextJsMiddlewareOptions as N, PDLSSInfo as P, RouteAccessConfig as R, SDKOptions as S, TokenGuidance as T, VerificationRequest as V, AccessLevel as a, AgentCredentials as b, AstraSyncCredentials as c, CounterpartyType as d, ExpressMiddlewareOptions as e, GuidanceInfo as f, ProtocolTransport as g, RuntimeChallengeResult as h, SettlementArtifact as i, StepUpApprovalInfo as j, TrustLevel as k, VerificationResult as l, VerifiedAgent as m, VerifiedDeveloper as n, VerifiedOrganization as o };
817
+ export type { AccessFailure as A, CommerceShieldProps as C, EnhancedVerificationResult as E, GatewayConfig as G, NextJsMiddlewareOptions as N, PDLSSInfo as P, RouteAccessConfig as R, SDKOptions as S, TokenGuidance as T, VerificationRequest as V, AccessLevel as a, AgentCredentials as b, AstraSyncCredentials as c, CounterpartyType as d, ExpressMiddlewareOptions as e, GuidanceInfo as f, ProtocolTransport as g, RuntimeChallengeResult as h, SettlementArtifact as i, StepUpApprovalInfo as j, StepUpApprovalStatus as k, StepUpOutcome as l, TrustLevel as m, VerificationResult as n, VerifiedAgent as o, VerifiedDeveloper as p, VerifiedOrganization as q };
@@ -1,4 +1,4 @@
1
- import { C as CommerceShieldProps, l as VerificationResult, b as AgentCredentials, f as GuidanceInfo, k as TrustLevel } from '../types-Cwrvo30g.mjs';
1
+ import { C as CommerceShieldProps, n as VerificationResult, b as AgentCredentials, f as GuidanceInfo, m as TrustLevel } from '../types-CKe8O0lR.mjs';
2
2
 
3
3
  /**
4
4
  * AstraSync Commerce Shield Component
@@ -1,4 +1,4 @@
1
- import { C as CommerceShieldProps, l as VerificationResult, b as AgentCredentials, f as GuidanceInfo, k as TrustLevel } from '../types-Cwrvo30g.js';
1
+ import { C as CommerceShieldProps, n as VerificationResult, b as AgentCredentials, f as GuidanceInfo, m as TrustLevel } from '../types-CKe8O0lR.js';
2
2
 
3
3
  /**
4
4
  * AstraSync Commerce Shield Component
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@astrasyncai/verification-gateway",
3
- "version": "3.4.0",
3
+ "version": "3.6.0",
4
4
  "description": "AstraSync KYA Platform SDK — counterparty verification gateway (verify incoming requests) + agent registration (register AI agents with the KYA backend).",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",