@astrasyncai/verification-gateway 5.19.0 → 5.21.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 (111) hide show
  1. package/CHANGELOG.md +130 -0
  2. package/README.md +53 -4
  3. package/dist/adapter-interface/interface.d.mts +2 -2
  4. package/dist/adapter-interface/interface.d.ts +2 -2
  5. package/dist/adapters/express.d.mts +1 -1
  6. package/dist/adapters/express.d.ts +1 -1
  7. package/dist/adapters/express.js +65 -16
  8. package/dist/adapters/express.js.map +1 -1
  9. package/dist/adapters/express.mjs +65 -16
  10. package/dist/adapters/express.mjs.map +1 -1
  11. package/dist/adapters/mcp.d.mts +23 -1
  12. package/dist/adapters/mcp.d.ts +23 -1
  13. package/dist/adapters/mcp.js +91 -16
  14. package/dist/adapters/mcp.js.map +1 -1
  15. package/dist/adapters/mcp.mjs +91 -16
  16. package/dist/adapters/mcp.mjs.map +1 -1
  17. package/dist/adapters/nextjs.d.mts +1 -1
  18. package/dist/adapters/nextjs.d.ts +1 -1
  19. package/dist/adapters/nextjs.js +57 -11
  20. package/dist/adapters/nextjs.js.map +1 -1
  21. package/dist/adapters/nextjs.mjs +57 -11
  22. package/dist/adapters/nextjs.mjs.map +1 -1
  23. package/dist/adapters/sdk.d.mts +35 -2
  24. package/dist/adapters/sdk.d.ts +35 -2
  25. package/dist/adapters/sdk.js +110 -11
  26. package/dist/adapters/sdk.js.map +1 -1
  27. package/dist/adapters/sdk.mjs +110 -11
  28. package/dist/adapters/sdk.mjs.map +1 -1
  29. package/dist/agent/index.d.mts +1 -1
  30. package/dist/agent/index.d.ts +1 -1
  31. package/dist/agent/index.js +1 -1
  32. package/dist/agent/index.js.map +1 -1
  33. package/dist/agent/index.mjs +1 -1
  34. package/dist/agent/index.mjs.map +1 -1
  35. package/dist/bin/astrasync-claude-hook.js +50 -12
  36. package/dist/bin/astrasync-codex-hook.js +50 -12
  37. package/dist/bin/astrasync-guard.js +50 -12
  38. package/dist/bin/astrasync.js +65 -13
  39. package/dist/browser/background.js +50 -12
  40. package/dist/browser/background.js.map +1 -1
  41. package/dist/browser/background.mjs +50 -12
  42. package/dist/browser/background.mjs.map +1 -1
  43. package/dist/cli/index.js +1 -1
  44. package/dist/cli/index.js.map +1 -1
  45. package/dist/cli/index.mjs +1 -1
  46. package/dist/cli/index.mjs.map +1 -1
  47. package/dist/codex/index.js +50 -12
  48. package/dist/codex/index.js.map +1 -1
  49. package/dist/codex/index.mjs +50 -12
  50. package/dist/codex/index.mjs.map +1 -1
  51. package/dist/cursor/extension.js +50 -12
  52. package/dist/cursor/extension.js.map +1 -1
  53. package/dist/cursor/extension.mjs +50 -12
  54. package/dist/cursor/extension.mjs.map +1 -1
  55. package/dist/edge-config.d.mts +1 -1
  56. package/dist/edge-config.d.ts +1 -1
  57. package/dist/edge-config.js +1 -1
  58. package/dist/edge-config.js.map +1 -1
  59. package/dist/edge-config.mjs +1 -1
  60. package/dist/edge-config.mjs.map +1 -1
  61. package/dist/edge-core/index.d.mts +1 -1
  62. package/dist/edge-core/index.d.ts +1 -1
  63. package/dist/edge-core/index.js +49 -11
  64. package/dist/edge-core/index.js.map +1 -1
  65. package/dist/edge-core/index.mjs +49 -11
  66. package/dist/edge-core/index.mjs.map +1 -1
  67. package/dist/gateway/gateway.d.mts +2 -2
  68. package/dist/gateway/gateway.d.ts +2 -2
  69. package/dist/gateway/gateway.js +50 -12
  70. package/dist/gateway/gateway.js.map +1 -1
  71. package/dist/gateway/gateway.mjs +50 -12
  72. package/dist/gateway/gateway.mjs.map +1 -1
  73. package/dist/git-trigger/git-hooks.d.mts +1 -1
  74. package/dist/git-trigger/git-hooks.d.ts +1 -1
  75. package/dist/index.d.mts +286 -8
  76. package/dist/index.d.ts +286 -8
  77. package/dist/index.js +532 -49
  78. package/dist/index.js.map +1 -1
  79. package/dist/index.mjs +522 -49
  80. package/dist/index.mjs.map +1 -1
  81. package/dist/local-evaluator/evaluator.d.mts +2 -2
  82. package/dist/local-evaluator/evaluator.d.ts +2 -2
  83. package/dist/registration/index.d.mts +11 -2
  84. package/dist/registration/index.d.ts +11 -2
  85. package/dist/registration/index.js +1 -1
  86. package/dist/registration/index.js.map +1 -1
  87. package/dist/registration/index.mjs +1 -1
  88. package/dist/registration/index.mjs.map +1 -1
  89. package/dist/transport/index.d.mts +1 -1
  90. package/dist/transport/index.d.ts +1 -1
  91. package/dist/transport/index.js +1 -1
  92. package/dist/transport/index.js.map +1 -1
  93. package/dist/transport/index.mjs +1 -1
  94. package/dist/transport/index.mjs.map +1 -1
  95. package/dist/{types-BoGjyon0.d.mts → types-B4zhOAlq.d.mts} +30 -1
  96. package/dist/{types-BRz2U0Pn.d.ts → types-B_HLhZ9n.d.ts} +1 -1
  97. package/dist/{types-BfILnheI.d.mts → types-CU17R4Nr.d.mts} +11 -0
  98. package/dist/{types-BfILnheI.d.ts → types-CU17R4Nr.d.ts} +11 -0
  99. package/dist/{types-eWyZuz-3.d.ts → types-CtBXnWuV.d.ts} +30 -1
  100. package/dist/{types-DqWPkiYl.d.mts → types-DHHyXtuZ.d.mts} +30 -1
  101. package/dist/{types-DqWPkiYl.d.ts → types-DHHyXtuZ.d.ts} +30 -1
  102. package/dist/{types-CfBpm3w5.d.mts → types-Djpz-L0w.d.mts} +1 -1
  103. package/dist/ui/index.d.mts +1 -1
  104. package/dist/ui/index.d.ts +1 -1
  105. package/dist/verify.d.mts +28 -3
  106. package/dist/verify.d.ts +28 -3
  107. package/dist/verify.js +71 -11
  108. package/dist/verify.js.map +1 -1
  109. package/dist/verify.mjs +69 -11
  110. package/dist/verify.mjs.map +1 -1
  111. package/package.json +1 -1
@@ -53,6 +53,17 @@ interface GatewayConfig {
53
53
  debug?: boolean;
54
54
  /** Custom headers to send with verification requests */
55
55
  customHeaders?: Record<string, string>;
56
+ /**
57
+ * 5.20.0: proof that this caller may act as the agent, sent as
58
+ * `actingProof` in the verify-access body. Honoured only from a
59
+ * first-party AstraSync service caller (the bridge): the backend checks the
60
+ * connector's OAuth access token and records a `connector_owner` proof when
61
+ * its owner owns the agent. Ignored for any other key. A verify carrying it
62
+ * is never served from, or written to, the verdict cache.
63
+ */
64
+ actingProof?: {
65
+ connectorToken: string;
66
+ };
56
67
  /** This counterparty's URL (sent with verify-access requests for analytics) */
57
68
  counterpartyUrl?: string;
58
69
  /** This counterparty's type (sent with verify-access requests for analytics) */
@@ -303,7 +314,9 @@ interface StepUpApprovalInfo {
303
314
  * Lifecycle states of a step-up approval row (mirrors the backend's
304
315
  * step_up_approval_status_check constraint).
305
316
  */
306
- type StepUpApprovalStatus = 'pending' | 'approved' | 'denied' | 'expired' | 'consumed';
317
+ type StepUpApprovalStatus = 'pending' | 'approved' | 'denied' | 'expired' | 'consumed'
318
+ /** 5.20.0: approved but never redeemed inside the redemption window. */
319
+ | 'lapsed';
307
320
  /**
308
321
  * Terminal outcome of a hold-and-poll wait: any non-pending status, or
309
322
  * 'timeout' when the hold budget ran out while the approval was still pending.
@@ -495,6 +508,12 @@ interface VerificationResult {
495
508
  * (steer the user to add one via onboarding).
496
509
  */
497
510
  settlementOutcome?: SettlementOutcomeInfo;
511
+ /**
512
+ * 5.20.0 (round 29.1): non-fatal integration warnings for the caller —
513
+ * e.g. `events_url_missing` when a kit's held confirm is on an endpoint with
514
+ * no Events URL (the kit would never hear the owner's decision).
515
+ */
516
+ warnings?: VerificationWarning[];
498
517
  /**
499
518
  * Card settlement token. Present on a card purchase at a first-party
500
519
  * storefront (our Stripe tenant) — 5.14.1: always, there is no charge-here
@@ -695,6 +714,11 @@ interface CheckoutMetadata {
695
714
  /** The kit's own checkout session id (`chk_…` / `cs_…`). */
696
715
  kitSessionId?: string;
697
716
  protocol?: 'ucp' | 'acp';
717
+ /**
718
+ * 5.21.0: the card issuer programme whose cardholder price the cart carries;
719
+ * AstraSync refuses the purchase unless the buyer is that programme's cardholder.
720
+ */
721
+ issuerProgram?: string;
698
722
  }
699
723
  /** 5.19.0 — see {@link VerificationRequest.purposeSource}. */
700
724
  type PurposeSource = 'route_config' | 'header' | 'body' | 'default';
@@ -1071,5 +1095,10 @@ interface AstraSyncAepEvidence {
1071
1095
  platform_countersignature: string;
1072
1096
  }>;
1073
1097
  }
1098
+ /** 5.20.0: a non-fatal warning on a verify-access result (see `warnings`). */
1099
+ interface VerificationWarning {
1100
+ code: string;
1101
+ message: string;
1102
+ }
1074
1103
 
1075
1104
  export type { AgentCredentials as A, CommerceArtifactsPayload as C, GatewayConfig as G, TokenGuidance as T, VerificationRequest as V, AttemptReport as a, CounterpartyType as b, VerificationResult as c };
@@ -1,4 +1,4 @@
1
- import { C as CounterpartyType, T as TokenGuidance } from './types-BfILnheI.js';
1
+ import { C as CounterpartyType, T as TokenGuidance } from './types-CU17R4Nr.js';
2
2
 
3
3
  /**
4
4
  * AstraSync Gateway - Types for gateway modes, local evaluation, and adapter interface.
@@ -34,6 +34,17 @@ interface GatewayConfig {
34
34
  debug?: boolean;
35
35
  /** Custom headers to send with verification requests */
36
36
  customHeaders?: Record<string, string>;
37
+ /**
38
+ * 5.20.0: proof that this caller may act as the agent, sent as
39
+ * `actingProof` in the verify-access body. Honoured only from a
40
+ * first-party AstraSync service caller (the bridge): the backend checks the
41
+ * connector's OAuth access token and records a `connector_owner` proof when
42
+ * its owner owns the agent. Ignored for any other key. A verify carrying it
43
+ * is never served from, or written to, the verdict cache.
44
+ */
45
+ actingProof?: {
46
+ connectorToken: string;
47
+ };
37
48
  /** This counterparty's URL (sent with verify-access requests for analytics) */
38
49
  counterpartyUrl?: string;
39
50
  /** This counterparty's type (sent with verify-access requests for analytics) */
@@ -34,6 +34,17 @@ interface GatewayConfig {
34
34
  debug?: boolean;
35
35
  /** Custom headers to send with verification requests */
36
36
  customHeaders?: Record<string, string>;
37
+ /**
38
+ * 5.20.0: proof that this caller may act as the agent, sent as
39
+ * `actingProof` in the verify-access body. Honoured only from a
40
+ * first-party AstraSync service caller (the bridge): the backend checks the
41
+ * connector's OAuth access token and records a `connector_owner` proof when
42
+ * its owner owns the agent. Ignored for any other key. A verify carrying it
43
+ * is never served from, or written to, the verdict cache.
44
+ */
45
+ actingProof?: {
46
+ connectorToken: string;
47
+ };
37
48
  /** This counterparty's URL (sent with verify-access requests for analytics) */
38
49
  counterpartyUrl?: string;
39
50
  /** This counterparty's type (sent with verify-access requests for analytics) */
@@ -53,6 +53,17 @@ interface GatewayConfig {
53
53
  debug?: boolean;
54
54
  /** Custom headers to send with verification requests */
55
55
  customHeaders?: Record<string, string>;
56
+ /**
57
+ * 5.20.0: proof that this caller may act as the agent, sent as
58
+ * `actingProof` in the verify-access body. Honoured only from a
59
+ * first-party AstraSync service caller (the bridge): the backend checks the
60
+ * connector's OAuth access token and records a `connector_owner` proof when
61
+ * its owner owns the agent. Ignored for any other key. A verify carrying it
62
+ * is never served from, or written to, the verdict cache.
63
+ */
64
+ actingProof?: {
65
+ connectorToken: string;
66
+ };
56
67
  /** This counterparty's URL (sent with verify-access requests for analytics) */
57
68
  counterpartyUrl?: string;
58
69
  /** This counterparty's type (sent with verify-access requests for analytics) */
@@ -303,7 +314,9 @@ interface StepUpApprovalInfo {
303
314
  * Lifecycle states of a step-up approval row (mirrors the backend's
304
315
  * step_up_approval_status_check constraint).
305
316
  */
306
- type StepUpApprovalStatus = 'pending' | 'approved' | 'denied' | 'expired' | 'consumed';
317
+ type StepUpApprovalStatus = 'pending' | 'approved' | 'denied' | 'expired' | 'consumed'
318
+ /** 5.20.0: approved but never redeemed inside the redemption window. */
319
+ | 'lapsed';
307
320
  /**
308
321
  * Terminal outcome of a hold-and-poll wait: any non-pending status, or
309
322
  * 'timeout' when the hold budget ran out while the approval was still pending.
@@ -495,6 +508,12 @@ interface VerificationResult {
495
508
  * (steer the user to add one via onboarding).
496
509
  */
497
510
  settlementOutcome?: SettlementOutcomeInfo;
511
+ /**
512
+ * 5.20.0 (round 29.1): non-fatal integration warnings for the caller —
513
+ * e.g. `events_url_missing` when a kit's held confirm is on an endpoint with
514
+ * no Events URL (the kit would never hear the owner's decision).
515
+ */
516
+ warnings?: VerificationWarning[];
498
517
  /**
499
518
  * Card settlement token. Present on a card purchase at a first-party
500
519
  * storefront (our Stripe tenant) — 5.14.1: always, there is no charge-here
@@ -695,6 +714,11 @@ interface CheckoutMetadata {
695
714
  /** The kit's own checkout session id (`chk_…` / `cs_…`). */
696
715
  kitSessionId?: string;
697
716
  protocol?: 'ucp' | 'acp';
717
+ /**
718
+ * 5.21.0: the card issuer programme whose cardholder price the cart carries;
719
+ * AstraSync refuses the purchase unless the buyer is that programme's cardholder.
720
+ */
721
+ issuerProgram?: string;
698
722
  }
699
723
  /** 5.19.0 — see {@link VerificationRequest.purposeSource}. */
700
724
  type PurposeSource = 'route_config' | 'header' | 'body' | 'default';
@@ -1071,5 +1095,10 @@ interface AstraSyncAepEvidence {
1071
1095
  platform_countersignature: string;
1072
1096
  }>;
1073
1097
  }
1098
+ /** 5.20.0: a non-fatal warning on a verify-access result (see `warnings`). */
1099
+ interface VerificationWarning {
1100
+ code: string;
1101
+ message: string;
1102
+ }
1074
1103
 
1075
1104
  export type { AgentCredentials as A, CommerceArtifactsPayload as C, GatewayConfig as G, TokenGuidance as T, VerificationRequest as V, AttemptReport as a, CounterpartyType as b, VerificationResult as c };
@@ -111,6 +111,17 @@ interface GatewayConfig {
111
111
  debug?: boolean;
112
112
  /** Custom headers to send with verification requests */
113
113
  customHeaders?: Record<string, string>;
114
+ /**
115
+ * 5.20.0: proof that this caller may act as the agent, sent as
116
+ * `actingProof` in the verify-access body. Honoured only from a
117
+ * first-party AstraSync service caller (the bridge): the backend checks the
118
+ * connector's OAuth access token and records a `connector_owner` proof when
119
+ * its owner owns the agent. Ignored for any other key. A verify carrying it
120
+ * is never served from, or written to, the verdict cache.
121
+ */
122
+ actingProof?: {
123
+ connectorToken: string;
124
+ };
114
125
  /** This counterparty's URL (sent with verify-access requests for analytics) */
115
126
  counterpartyUrl?: string;
116
127
  /** This counterparty's type (sent with verify-access requests for analytics) */
@@ -361,7 +372,9 @@ interface StepUpApprovalInfo {
361
372
  * Lifecycle states of a step-up approval row (mirrors the backend's
362
373
  * step_up_approval_status_check constraint).
363
374
  */
364
- type StepUpApprovalStatus = 'pending' | 'approved' | 'denied' | 'expired' | 'consumed';
375
+ type StepUpApprovalStatus = 'pending' | 'approved' | 'denied' | 'expired' | 'consumed'
376
+ /** 5.20.0: approved but never redeemed inside the redemption window. */
377
+ | 'lapsed';
365
378
  /**
366
379
  * Terminal outcome of a hold-and-poll wait: any non-pending status, or
367
380
  * 'timeout' when the hold budget ran out while the approval was still pending.
@@ -553,6 +566,12 @@ interface VerificationResult {
553
566
  * (steer the user to add one via onboarding).
554
567
  */
555
568
  settlementOutcome?: SettlementOutcomeInfo;
569
+ /**
570
+ * 5.20.0 (round 29.1): non-fatal integration warnings for the caller —
571
+ * e.g. `events_url_missing` when a kit's held confirm is on an endpoint with
572
+ * no Events URL (the kit would never hear the owner's decision).
573
+ */
574
+ warnings?: VerificationWarning[];
556
575
  /**
557
576
  * Card settlement token. Present on a card purchase at a first-party
558
577
  * storefront (our Stripe tenant) — 5.14.1: always, there is no charge-here
@@ -753,6 +772,11 @@ interface CheckoutMetadata {
753
772
  /** The kit's own checkout session id (`chk_…` / `cs_…`). */
754
773
  kitSessionId?: string;
755
774
  protocol?: 'ucp' | 'acp';
775
+ /**
776
+ * 5.21.0: the card issuer programme whose cardholder price the cart carries;
777
+ * AstraSync refuses the purchase unless the buyer is that programme's cardholder.
778
+ */
779
+ issuerProgram?: string;
756
780
  }
757
781
  /** 5.19.0 — see {@link VerificationRequest.purposeSource}. */
758
782
  type PurposeSource = 'route_config' | 'header' | 'body' | 'default';
@@ -1289,5 +1313,10 @@ interface AstraSyncAepEvidence {
1289
1313
  platform_countersignature: string;
1290
1314
  }>;
1291
1315
  }
1316
+ /** 5.20.0: a non-fatal warning on a verify-access result (see `warnings`). */
1317
+ interface VerificationWarning {
1318
+ code: string;
1319
+ message: string;
1320
+ }
1292
1321
 
1293
1322
  export type { AgentArtifacts as A, CheckoutMetadata as C, ExpressMiddlewareOptions as E, GatewayConfig as G, NextJsMiddlewareOptions as N, SDKOptions as S, TrustLevel as T, VerificationInterstitialProps as V, AgentCredentials as a, AstraSyncCredentials as b, GuidanceInfo as c, VerificationRequest as d, VerificationResult as e };
@@ -111,6 +111,17 @@ interface GatewayConfig {
111
111
  debug?: boolean;
112
112
  /** Custom headers to send with verification requests */
113
113
  customHeaders?: Record<string, string>;
114
+ /**
115
+ * 5.20.0: proof that this caller may act as the agent, sent as
116
+ * `actingProof` in the verify-access body. Honoured only from a
117
+ * first-party AstraSync service caller (the bridge): the backend checks the
118
+ * connector's OAuth access token and records a `connector_owner` proof when
119
+ * its owner owns the agent. Ignored for any other key. A verify carrying it
120
+ * is never served from, or written to, the verdict cache.
121
+ */
122
+ actingProof?: {
123
+ connectorToken: string;
124
+ };
114
125
  /** This counterparty's URL (sent with verify-access requests for analytics) */
115
126
  counterpartyUrl?: string;
116
127
  /** This counterparty's type (sent with verify-access requests for analytics) */
@@ -361,7 +372,9 @@ interface StepUpApprovalInfo {
361
372
  * Lifecycle states of a step-up approval row (mirrors the backend's
362
373
  * step_up_approval_status_check constraint).
363
374
  */
364
- type StepUpApprovalStatus = 'pending' | 'approved' | 'denied' | 'expired' | 'consumed';
375
+ type StepUpApprovalStatus = 'pending' | 'approved' | 'denied' | 'expired' | 'consumed'
376
+ /** 5.20.0: approved but never redeemed inside the redemption window. */
377
+ | 'lapsed';
365
378
  /**
366
379
  * Terminal outcome of a hold-and-poll wait: any non-pending status, or
367
380
  * 'timeout' when the hold budget ran out while the approval was still pending.
@@ -553,6 +566,12 @@ interface VerificationResult {
553
566
  * (steer the user to add one via onboarding).
554
567
  */
555
568
  settlementOutcome?: SettlementOutcomeInfo;
569
+ /**
570
+ * 5.20.0 (round 29.1): non-fatal integration warnings for the caller —
571
+ * e.g. `events_url_missing` when a kit's held confirm is on an endpoint with
572
+ * no Events URL (the kit would never hear the owner's decision).
573
+ */
574
+ warnings?: VerificationWarning[];
556
575
  /**
557
576
  * Card settlement token. Present on a card purchase at a first-party
558
577
  * storefront (our Stripe tenant) — 5.14.1: always, there is no charge-here
@@ -753,6 +772,11 @@ interface CheckoutMetadata {
753
772
  /** The kit's own checkout session id (`chk_…` / `cs_…`). */
754
773
  kitSessionId?: string;
755
774
  protocol?: 'ucp' | 'acp';
775
+ /**
776
+ * 5.21.0: the card issuer programme whose cardholder price the cart carries;
777
+ * AstraSync refuses the purchase unless the buyer is that programme's cardholder.
778
+ */
779
+ issuerProgram?: string;
756
780
  }
757
781
  /** 5.19.0 — see {@link VerificationRequest.purposeSource}. */
758
782
  type PurposeSource = 'route_config' | 'header' | 'body' | 'default';
@@ -1289,5 +1313,10 @@ interface AstraSyncAepEvidence {
1289
1313
  platform_countersignature: string;
1290
1314
  }>;
1291
1315
  }
1316
+ /** 5.20.0: a non-fatal warning on a verify-access result (see `warnings`). */
1317
+ interface VerificationWarning {
1318
+ code: string;
1319
+ message: string;
1320
+ }
1292
1321
 
1293
1322
  export type { AgentArtifacts as A, CheckoutMetadata as C, ExpressMiddlewareOptions as E, GatewayConfig as G, NextJsMiddlewareOptions as N, SDKOptions as S, TrustLevel as T, VerificationInterstitialProps as V, AgentCredentials as a, AstraSyncCredentials as b, GuidanceInfo as c, VerificationRequest as d, VerificationResult as e };
@@ -1,4 +1,4 @@
1
- import { C as CounterpartyType, T as TokenGuidance } from './types-BfILnheI.mjs';
1
+ import { C as CounterpartyType, T as TokenGuidance } from './types-CU17R4Nr.mjs';
2
2
 
3
3
  /**
4
4
  * AstraSync Gateway - Types for gateway modes, local evaluation, and adapter interface.
@@ -1,4 +1,4 @@
1
- import { V as VerificationInterstitialProps, e as VerificationResult, a as AgentCredentials, c as GuidanceInfo, T as TrustLevel } from '../types-DqWPkiYl.mjs';
1
+ import { V as VerificationInterstitialProps, e as VerificationResult, a as AgentCredentials, c as GuidanceInfo, T as TrustLevel } from '../types-DHHyXtuZ.mjs';
2
2
 
3
3
  /**
4
4
  * AstraSync Verification Interstitial Component
@@ -1,4 +1,4 @@
1
- import { V as VerificationInterstitialProps, e as VerificationResult, a as AgentCredentials, c as GuidanceInfo, T as TrustLevel } from '../types-DqWPkiYl.js';
1
+ import { V as VerificationInterstitialProps, e as VerificationResult, a as AgentCredentials, c as GuidanceInfo, T as TrustLevel } from '../types-DHHyXtuZ.js';
2
2
 
3
3
  /**
4
4
  * AstraSync Verification Interstitial Component
package/dist/verify.d.mts CHANGED
@@ -1,4 +1,4 @@
1
- import { A as AgentCredentials, G as GatewayConfig, a as AttemptReport, V as VerificationRequest, c as VerificationResult } from './types-BoGjyon0.mjs';
1
+ import { A as AgentCredentials, G as GatewayConfig, c as VerificationResult, V as VerificationRequest, a as AttemptReport } from './types-B4zhOAlq.mjs';
2
2
  import { ObservedMetadata } from './metadata-capture.mjs';
3
3
 
4
4
  /**
@@ -11,7 +11,8 @@ import { ObservedMetadata } from './metadata-capture.mjs';
11
11
  /** Test-only: re-arm the one-time init self-check. */
12
12
  declare function _resetInitCheck(): void;
13
13
  /**
14
- * Clear the verification cache
14
+ * Clear the verification cache, and (5.20.0) forget in-flight single-flight
15
+ * calls so a later identical request reaches the backend on its own.
15
16
  */
16
17
  declare function clearCache(): void;
17
18
  /**
@@ -48,6 +49,24 @@ interface VerifyOptions {
48
49
  * Main verification function
49
50
  */
50
51
  declare function verify(config: GatewayConfig, request: VerificationRequest, options?: VerifyOptions): Promise<VerificationResult>;
52
+ /**
53
+ * Whether `result` was served from the verdict cache or shared from a
54
+ * concurrent identical call (5.20.0). The adapters skip the decision POST for
55
+ * these: the session already has its decision from the call that created it.
56
+ */
57
+ declare function isSharedVerdict(result: VerificationResult): boolean;
58
+ type VerificationListener = (result: VerificationResult, request: VerificationRequest) => void;
59
+ /**
60
+ * 5.20.0: observe every verdict this process fetched from verify-access
61
+ * (cache hits and single-flight followers are not repeated). Listeners run
62
+ * synchronously after the result is built and must not throw (a throw is
63
+ * swallowed). Returns an unsubscribe function.
64
+ *
65
+ * The MCP bridge uses it to size its per-agent rate limit from the trust
66
+ * score its tools' own verifies return, instead of paying for a second
67
+ * verify-access call in the gate.
68
+ */
69
+ declare function onVerificationResult(listener: VerificationListener): () => void;
51
70
  /**
52
71
  * Record a counterparty's grant/deny decision for a verification session.
53
72
  * Fire-and-forget — errors are silently swallowed.
@@ -86,6 +105,12 @@ declare function fetchRoutes(config: GatewayConfig, counterpartyId: string, opti
86
105
  * here can only add checks".
87
106
  */
88
107
  codeGates?: string[];
108
+ /**
109
+ * 5.20.0: called with the endpoint's `counterpartyType` when the routes
110
+ * response carries it (backend round 29.1+). The MCP middleware uses it
111
+ * to warn when it is pointed at a non-`mcp_server` endpoint.
112
+ */
113
+ onEndpointType?: (counterpartyType: string) => void;
89
114
  }): Promise<RouteAccessConfigShape[] | null>;
90
115
  /**
91
116
  * Minimal shape of an EndpointRoute as the SDK consumes it. Mirrors the
@@ -215,4 +240,4 @@ declare function quickVerify(config: GatewayConfig, credentials: AgentCredential
215
240
  retryAfterMs?: number;
216
241
  }>;
217
242
 
218
- export { type ReportAttemptOptions, type RouteAccessConfigShape, type VerifyOptions, _resetInitCheck, clearCache, extractCredentials, fetchRoutes, hasCredentials, parseRetryAfterMs, quickVerify, recordDecision, reportAttempt, reportCounterpartyPreCheckFailure, reportUnregisteredAttempt, verify, verifyAndRecord };
243
+ export { type ReportAttemptOptions, type RouteAccessConfigShape, type VerifyOptions, _resetInitCheck, clearCache, extractCredentials, fetchRoutes, hasCredentials, isSharedVerdict, onVerificationResult, parseRetryAfterMs, quickVerify, recordDecision, reportAttempt, reportCounterpartyPreCheckFailure, reportUnregisteredAttempt, verify, verifyAndRecord };
package/dist/verify.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { A as AgentCredentials, G as GatewayConfig, a as AttemptReport, V as VerificationRequest, c as VerificationResult } from './types-eWyZuz-3.js';
1
+ import { A as AgentCredentials, G as GatewayConfig, c as VerificationResult, V as VerificationRequest, a as AttemptReport } from './types-CtBXnWuV.js';
2
2
  import { ObservedMetadata } from './metadata-capture.js';
3
3
 
4
4
  /**
@@ -11,7 +11,8 @@ import { ObservedMetadata } from './metadata-capture.js';
11
11
  /** Test-only: re-arm the one-time init self-check. */
12
12
  declare function _resetInitCheck(): void;
13
13
  /**
14
- * Clear the verification cache
14
+ * Clear the verification cache, and (5.20.0) forget in-flight single-flight
15
+ * calls so a later identical request reaches the backend on its own.
15
16
  */
16
17
  declare function clearCache(): void;
17
18
  /**
@@ -48,6 +49,24 @@ interface VerifyOptions {
48
49
  * Main verification function
49
50
  */
50
51
  declare function verify(config: GatewayConfig, request: VerificationRequest, options?: VerifyOptions): Promise<VerificationResult>;
52
+ /**
53
+ * Whether `result` was served from the verdict cache or shared from a
54
+ * concurrent identical call (5.20.0). The adapters skip the decision POST for
55
+ * these: the session already has its decision from the call that created it.
56
+ */
57
+ declare function isSharedVerdict(result: VerificationResult): boolean;
58
+ type VerificationListener = (result: VerificationResult, request: VerificationRequest) => void;
59
+ /**
60
+ * 5.20.0: observe every verdict this process fetched from verify-access
61
+ * (cache hits and single-flight followers are not repeated). Listeners run
62
+ * synchronously after the result is built and must not throw (a throw is
63
+ * swallowed). Returns an unsubscribe function.
64
+ *
65
+ * The MCP bridge uses it to size its per-agent rate limit from the trust
66
+ * score its tools' own verifies return, instead of paying for a second
67
+ * verify-access call in the gate.
68
+ */
69
+ declare function onVerificationResult(listener: VerificationListener): () => void;
51
70
  /**
52
71
  * Record a counterparty's grant/deny decision for a verification session.
53
72
  * Fire-and-forget — errors are silently swallowed.
@@ -86,6 +105,12 @@ declare function fetchRoutes(config: GatewayConfig, counterpartyId: string, opti
86
105
  * here can only add checks".
87
106
  */
88
107
  codeGates?: string[];
108
+ /**
109
+ * 5.20.0: called with the endpoint's `counterpartyType` when the routes
110
+ * response carries it (backend round 29.1+). The MCP middleware uses it
111
+ * to warn when it is pointed at a non-`mcp_server` endpoint.
112
+ */
113
+ onEndpointType?: (counterpartyType: string) => void;
89
114
  }): Promise<RouteAccessConfigShape[] | null>;
90
115
  /**
91
116
  * Minimal shape of an EndpointRoute as the SDK consumes it. Mirrors the
@@ -215,4 +240,4 @@ declare function quickVerify(config: GatewayConfig, credentials: AgentCredential
215
240
  retryAfterMs?: number;
216
241
  }>;
217
242
 
218
- export { type ReportAttemptOptions, type RouteAccessConfigShape, type VerifyOptions, _resetInitCheck, clearCache, extractCredentials, fetchRoutes, hasCredentials, parseRetryAfterMs, quickVerify, recordDecision, reportAttempt, reportCounterpartyPreCheckFailure, reportUnregisteredAttempt, verify, verifyAndRecord };
243
+ export { type ReportAttemptOptions, type RouteAccessConfigShape, type VerifyOptions, _resetInitCheck, clearCache, extractCredentials, fetchRoutes, hasCredentials, isSharedVerdict, onVerificationResult, parseRetryAfterMs, quickVerify, recordDecision, reportAttempt, reportCounterpartyPreCheckFailure, reportUnregisteredAttempt, verify, verifyAndRecord };
package/dist/verify.js CHANGED
@@ -25,6 +25,8 @@ __export(verify_exports, {
25
25
  extractCredentials: () => extractCredentials,
26
26
  fetchRoutes: () => fetchRoutes,
27
27
  hasCredentials: () => hasCredentials,
28
+ isSharedVerdict: () => isSharedVerdict,
29
+ onVerificationResult: () => onVerificationResult,
28
30
  parseRetryAfterMs: () => parseRetryAfterMs,
29
31
  quickVerify: () => quickVerify,
30
32
  recordDecision: () => recordDecision,
@@ -37,7 +39,7 @@ __export(verify_exports, {
37
39
  module.exports = __toCommonJS(verify_exports);
38
40
 
39
41
  // src/version.ts
40
- var SDK_VERSION = "5.19.0";
42
+ var SDK_VERSION = "5.21.0";
41
43
 
42
44
  // src/http.ts
43
45
  var SDK_USER_AGENT = `astrasync-sdk/${SDK_VERSION}`;
@@ -248,6 +250,7 @@ function cacheResult(request, result, configuredTtl, counterpartyId) {
248
250
  }
249
251
  function clearCache() {
250
252
  verificationCache.clear();
253
+ inflightVerifies.clear();
251
254
  }
252
255
  function extractCredentials(headers, query) {
253
256
  const credentials = {};
@@ -421,6 +424,9 @@ async function callVerifyAccessAPI(config, request) {
421
424
  if (requestData.enableRuntimeChallenge)
422
425
  body.enableRuntimeChallenge = requestData.enableRuntimeChallenge;
423
426
  if (requestData.routePolicy) body.routePolicy = requestData.routePolicy;
427
+ if (config.actingProof?.connectorToken) {
428
+ body.actingProof = { connectorToken: config.actingProof.connectorToken };
429
+ }
424
430
  if (requestData.approvalHeldByRoute) body.approvalHeldByRoute = true;
425
431
  if (requestData.createSession) body.createSession = requestData.createSession;
426
432
  if (requestData.durationRequired) body.durationRequired = requestData.durationRequired;
@@ -588,22 +594,46 @@ async function verify(config, request, options) {
588
594
  "[VerificationGateway] minTrustScore / minTrustScoreForFull are deprecated in v2.3.0 and have no effect. Server is now the single source of truth for access decisions (verified ID + runtime challenge + PDLSS + trust score). To gate access to an endpoint, configure the endpoint's trust_score_requirement server-side."
589
595
  );
590
596
  }
591
- const uncacheable = Boolean(request.commerceArtifacts);
597
+ const uncacheable = Boolean(request.commerceArtifacts) || Boolean(mergedConfig.actingProof);
592
598
  if (mergedConfig.cacheTtl !== 0 && !options?.bypassCache && !uncacheable) {
593
599
  const cached = getCachedResult(request, mergedConfig.counterpartyId);
594
600
  if (cached) {
595
601
  if (mergedConfig.debug) {
596
602
  console.log("[VerificationGateway] Returning cached result");
597
603
  }
598
- const hit = { ...cached };
599
- if (request.attemptId) {
600
- hit.attemptId = request.attemptId;
601
- } else {
602
- delete hit.attemptId;
603
- }
604
- return hit;
604
+ return sharedVerdict(cached, request);
605
+ }
606
+ }
607
+ if (mergedConfig.cacheTtl !== 0 && !options?.bypassCache && !uncacheable) {
608
+ const key = getCacheKey(request, mergedConfig.counterpartyId);
609
+ const pending = inflightVerifies.get(key);
610
+ if (pending) return sharedVerdict(await pending, request);
611
+ const flight = verifyViaApi(mergedConfig, request, urls, uncacheable);
612
+ inflightVerifies.set(key, flight);
613
+ try {
614
+ return await flight;
615
+ } finally {
616
+ inflightVerifies.delete(key);
605
617
  }
606
618
  }
619
+ return verifyViaApi(mergedConfig, request, urls, uncacheable);
620
+ }
621
+ var inflightVerifies = /* @__PURE__ */ new Map();
622
+ var sharedVerdicts = /* @__PURE__ */ new WeakSet();
623
+ function isSharedVerdict(result) {
624
+ return sharedVerdicts.has(result);
625
+ }
626
+ function sharedVerdict(source, request) {
627
+ const hit = { ...source };
628
+ if (request.attemptId) {
629
+ hit.attemptId = request.attemptId;
630
+ } else {
631
+ delete hit.attemptId;
632
+ }
633
+ sharedVerdicts.add(hit);
634
+ return hit;
635
+ }
636
+ async function verifyViaApi(mergedConfig, request, urls, uncacheable) {
607
637
  const enrichedRequest = { ...request };
608
638
  if (!enrichedRequest.counterpartyUrl && mergedConfig.counterpartyUrl) {
609
639
  enrichedRequest.counterpartyUrl = mergedConfig.counterpartyUrl;
@@ -682,7 +712,9 @@ async function verify(config, request, options) {
682
712
  fulfilment: apiResponse.fulfilment,
683
713
  mandates: apiResponse.mandates,
684
714
  kyaToken: apiResponse.kyaToken,
685
- aep: apiResponse.aep
715
+ aep: apiResponse.aep,
716
+ // 5.20.0 (round 29.1): non-fatal integration warnings (e.g. events_url_missing).
717
+ warnings: apiResponse.warnings
686
718
  };
687
719
  return result2;
688
720
  }
@@ -750,7 +782,9 @@ async function verify(config, request, options) {
750
782
  // 5.15.0: merchant-lane AP2 mandates + KYAPay identity token.
751
783
  mandates: apiResponse.mandates,
752
784
  kyaToken: apiResponse.kyaToken,
753
- aep: apiResponse.aep
785
+ aep: apiResponse.aep,
786
+ // 5.20.0 (round 29.1): non-fatal integration warnings (e.g. events_url_missing).
787
+ warnings: apiResponse.warnings
754
788
  };
755
789
  if (result.recommendation === "deny") {
756
790
  result.policyAllowed = false;
@@ -776,8 +810,24 @@ async function verify(config, request, options) {
776
810
  cacheResult(request, result, mergedConfig.cacheTtl, mergedConfig.counterpartyId);
777
811
  }
778
812
  }
813
+ notifyVerificationListeners(request, result);
779
814
  return result;
780
815
  }
816
+ var verificationListeners = /* @__PURE__ */ new Set();
817
+ function onVerificationResult(listener) {
818
+ verificationListeners.add(listener);
819
+ return () => {
820
+ verificationListeners.delete(listener);
821
+ };
822
+ }
823
+ function notifyVerificationListeners(request, result) {
824
+ for (const listener of verificationListeners) {
825
+ try {
826
+ listener(result, request);
827
+ } catch {
828
+ }
829
+ }
830
+ }
781
831
  async function recordDecision(config, sessionId, decision, reason) {
782
832
  const headers = { "Content-Type": "application/json" };
783
833
  if (config.apiKey) {
@@ -842,6 +892,7 @@ async function fetchRoutes(config, counterpartyId, options = {}) {
842
892
  headers["X-API-Key"] = config.apiKey;
843
893
  }
844
894
  try {
895
+ headers["X-AstraSync-SDK-Version"] = SDK_VERSION;
845
896
  const response = await sdkFetch(
846
897
  `${config.apiBaseUrl}/endpoints/${encodeURIComponent(counterpartyId)}/routes` + (options.codeGates?.length ? `?codeGates=${options.codeGates.map(encodeURIComponent).join(",")}` : ""),
847
898
  { method: "GET", headers }
@@ -856,6 +907,13 @@ async function fetchRoutes(config, counterpartyId, options = {}) {
856
907
  return null;
857
908
  }
858
909
  const body = await response.json();
910
+ const type = body.data?.counterpartyType;
911
+ if (typeof type === "string" && options.onEndpointType) {
912
+ try {
913
+ options.onEndpointType(type);
914
+ } catch {
915
+ }
916
+ }
859
917
  return body.data?.routes ?? [];
860
918
  } catch {
861
919
  return null;
@@ -925,6 +983,8 @@ async function quickVerify(config, credentials) {
925
983
  extractCredentials,
926
984
  fetchRoutes,
927
985
  hasCredentials,
986
+ isSharedVerdict,
987
+ onVerificationResult,
928
988
  parseRetryAfterMs,
929
989
  quickVerify,
930
990
  recordDecision,