@astrasyncai/verification-gateway 5.13.0 → 5.15.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 (98) hide show
  1. package/README.md +27 -17
  2. package/dist/adapters/express.d.mts +1 -1
  3. package/dist/adapters/express.d.ts +1 -1
  4. package/dist/adapters/express.js +504 -249
  5. package/dist/adapters/express.js.map +1 -1
  6. package/dist/adapters/express.mjs +504 -249
  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 +20 -6
  11. package/dist/adapters/mcp.js.map +1 -1
  12. package/dist/adapters/mcp.mjs +20 -6
  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 +487 -248
  17. package/dist/adapters/nextjs.js.map +1 -1
  18. package/dist/adapters/nextjs.mjs +487 -248
  19. package/dist/adapters/nextjs.mjs.map +1 -1
  20. package/dist/adapters/sdk.d.mts +18 -10
  21. package/dist/adapters/sdk.d.ts +18 -10
  22. package/dist/adapters/sdk.js +80 -23
  23. package/dist/adapters/sdk.js.map +1 -1
  24. package/dist/adapters/sdk.mjs +80 -23
  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 +82 -20
  31. package/dist/bin/astrasync-codex-hook.js +82 -20
  32. package/dist/bin/astrasync-guard.js +82 -20
  33. package/dist/bin/astrasync.js +316 -43
  34. package/dist/browser/background.js +77 -15
  35. package/dist/browser/background.js.map +1 -1
  36. package/dist/browser/background.mjs +87 -15
  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 +82 -20
  43. package/dist/codex/index.js.map +1 -1
  44. package/dist/codex/index.mjs +92 -20
  45. package/dist/codex/index.mjs.map +1 -1
  46. package/dist/cursor/extension.js +82 -20
  47. package/dist/cursor/extension.js.map +1 -1
  48. package/dist/cursor/extension.mjs +92 -20
  49. package/dist/cursor/extension.mjs.map +1 -1
  50. package/dist/edge-config.d.mts +31 -2
  51. package/dist/edge-config.d.ts +31 -2
  52. package/dist/edge-config.js +35 -5
  53. package/dist/edge-config.js.map +1 -1
  54. package/dist/edge-config.mjs +32 -4
  55. package/dist/edge-config.mjs.map +1 -1
  56. package/dist/edge-core/index.d.mts +43 -6
  57. package/dist/edge-core/index.d.ts +43 -6
  58. package/dist/edge-core/index.js +120 -19
  59. package/dist/edge-core/index.js.map +1 -1
  60. package/dist/edge-core/index.mjs +118 -19
  61. package/dist/edge-core/index.mjs.map +1 -1
  62. package/dist/gateway/gateway.js +77 -15
  63. package/dist/gateway/gateway.js.map +1 -1
  64. package/dist/gateway/gateway.mjs +87 -15
  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 +1314 -34
  69. package/dist/index.d.ts +1314 -34
  70. package/dist/index.js +5143 -2621
  71. package/dist/index.js.map +1 -1
  72. package/dist/index.mjs +5090 -2623
  73. package/dist/index.mjs.map +1 -1
  74. package/dist/registration/index.d.mts +28 -2
  75. package/dist/registration/index.d.ts +28 -2
  76. package/dist/registration/index.js +18 -3
  77. package/dist/registration/index.js.map +1 -1
  78. package/dist/registration/index.mjs +15 -2
  79. package/dist/registration/index.mjs.map +1 -1
  80. package/dist/transport/index.d.mts +7 -5
  81. package/dist/transport/index.d.ts +7 -5
  82. package/dist/transport/index.js +61 -5
  83. package/dist/transport/index.js.map +1 -1
  84. package/dist/transport/index.mjs +67 -11
  85. package/dist/transport/index.mjs.map +1 -1
  86. package/dist/{types-C_b4QTyO.d.ts → types-DtJjlW4O.d.ts} +104 -10
  87. package/dist/{types-BCkwBA84.d.mts → types-Dxf9DBpr.d.mts} +106 -12
  88. package/dist/{types-BCkwBA84.d.ts → types-Dxf9DBpr.d.ts} +106 -12
  89. package/dist/{types-DlshIIR-.d.mts → types-Eg6VoBNH.d.mts} +104 -10
  90. package/dist/ui/index.d.mts +1 -1
  91. package/dist/ui/index.d.ts +1 -1
  92. package/dist/verify.d.mts +1 -1
  93. package/dist/verify.d.ts +1 -1
  94. package/dist/verify.js +20 -6
  95. package/dist/verify.js.map +1 -1
  96. package/dist/verify.mjs +20 -6
  97. package/dist/verify.mjs.map +1 -1
  98. package/package.json +1 -1
@@ -3986,7 +3986,7 @@ function getTrustLevel(score) {
3986
3986
  }
3987
3987
 
3988
3988
  // src/version.ts
3989
- var SDK_VERSION = "5.13.0";
3989
+ var SDK_VERSION = "5.15.0";
3990
3990
 
3991
3991
  // src/http.ts
3992
3992
  var SDK_USER_AGENT = `astrasync-sdk/${SDK_VERSION}`;
@@ -4305,6 +4305,7 @@ async function callVerifyAccessAPI(config, request) {
4305
4305
  if (requestData.invocationProtocol) body.invocationProtocol = requestData.invocationProtocol;
4306
4306
  if (requestData.commercePhase) body.commercePhase = requestData.commercePhase;
4307
4307
  if (requestData.checkoutSessionId) body.checkoutSessionId = requestData.checkoutSessionId;
4308
+ if (requestData.checkoutJwt) body.checkoutJwt = requestData.checkoutJwt;
4308
4309
  if (requestData.checkoutItems) body.checkoutItems = requestData.checkoutItems;
4309
4310
  if (requestData.buyerEmail) body.buyerEmail = requestData.buyerEmail;
4310
4311
  if (requestData.commerceArtifacts) body.commerceArtifacts = requestData.commerceArtifacts;
@@ -4455,7 +4456,8 @@ async function verify(config, request, options) {
4455
4456
  "[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."
4456
4457
  );
4457
4458
  }
4458
- if (mergedConfig.cacheTtl !== 0 && !options?.bypassCache) {
4459
+ const uncacheable = Boolean(request.commerceArtifacts);
4460
+ if (mergedConfig.cacheTtl !== 0 && !options?.bypassCache && !uncacheable) {
4459
4461
  const cached = getCachedResult(request, mergedConfig.counterpartyId);
4460
4462
  if (cached) {
4461
4463
  if (mergedConfig.debug) {
@@ -4536,7 +4538,10 @@ async function verify(config, request, options) {
4536
4538
  // MERCHANT caller only (bridge callers strip it before the agent plane).
4537
4539
  settlementToken: apiResponse.settlementToken,
4538
4540
  // 5.6.0: fulfilment contact — merchant-only lane, same strip rule.
4539
- fulfilment: apiResponse.fulfilment
4541
+ fulfilment: apiResponse.fulfilment,
4542
+ mandates: apiResponse.mandates,
4543
+ kyaToken: apiResponse.kyaToken,
4544
+ aep: apiResponse.aep
4540
4545
  };
4541
4546
  return result2;
4542
4547
  }
@@ -4546,7 +4551,10 @@ async function verify(config, request, options) {
4546
4551
  trustScore: apiResponse.agent.trustScore,
4547
4552
  trustLevel: getTrustLevel(apiResponse.agent.trustScore),
4548
4553
  blockchainAnchored: apiResponse.agent.blockchainStatus === "anchored",
4549
- status: apiResponse.agent.agentStatus
4554
+ status: apiResponse.agent.agentStatus,
4555
+ ...apiResponse.agent.protocolIdentities && {
4556
+ protocolIdentities: apiResponse.agent.protocolIdentities
4557
+ }
4550
4558
  } : void 0;
4551
4559
  const developer = apiResponse.developer ? {
4552
4560
  astradId: apiResponse.developer.kyaOwnerId,
@@ -4597,7 +4605,11 @@ async function verify(config, request, options) {
4597
4605
  settlementOutcome: apiResponse.settlementOutcome,
4598
4606
  settlementToken: apiResponse.settlementToken,
4599
4607
  // 5.6.0: fulfilment contact — merchant-only lane, same strip rule.
4600
- fulfilment: apiResponse.fulfilment
4608
+ fulfilment: apiResponse.fulfilment,
4609
+ // 5.15.0: merchant-lane AP2 mandates + KYAPay identity token.
4610
+ mandates: apiResponse.mandates,
4611
+ kyaToken: apiResponse.kyaToken,
4612
+ aep: apiResponse.aep
4601
4613
  };
4602
4614
  if (result.recommendation === "deny") {
4603
4615
  result.policyAllowed = false;
@@ -4617,7 +4629,9 @@ async function verify(config, request, options) {
4617
4629
  }
4618
4630
  const escalates = result.requiresStepUp === true || result.requiresApproval === true || result.recommendation === "step_up_required";
4619
4631
  if (mergedConfig.cacheTtl !== 0 && result.recommendation !== "deny" && !escalates) {
4620
- cacheResult(request, result, mergedConfig.cacheTtl, mergedConfig.counterpartyId);
4632
+ if (!uncacheable) {
4633
+ cacheResult(request, result, mergedConfig.cacheTtl, mergedConfig.counterpartyId);
4634
+ }
4621
4635
  }
4622
4636
  return result;
4623
4637
  }
@@ -4628,6 +4642,9 @@ var FALLBACK_MAX_WAIT_MS = 5 * 60 * 1e3;
4628
4642
  // src/metadata-capture.ts
4629
4643
  var MAX_TOTAL_BYTES = 16 * 1024;
4630
4644
 
4645
+ // src/adapters/commerce-detect.ts
4646
+ var MAX_BODY_BYTES = 64 * 1024;
4647
+
4631
4648
  // src/edge-config.ts
4632
4649
  var DEFAULT_EDGE_CONFIG = Object.freeze({
4633
4650
  version: 1,
@@ -4656,6 +4673,11 @@ async function withBudget(promise, ms) {
4656
4673
  if (timer) clearTimeout(timer);
4657
4674
  }
4658
4675
  }
4676
+ var CONTAINER_ID = (() => {
4677
+ const c = globalThis.crypto;
4678
+ if (c?.randomUUID) return c.randomUUID();
4679
+ return `c-${Date.now().toString(36)}-${Math.random().toString(36).slice(2, 12)}`;
4680
+ })();
4659
4681
  var destKeyOf = (d) => `${d.apiBaseUrl}\0${d.apiKey ?? ""}\0${d.counterparty}\0${d.adapter ?? ""}`;
4660
4682
  var BeaconBuffer = class {
4661
4683
  constructor(options = {}) {
@@ -4663,6 +4685,7 @@ var BeaconBuffer = class {
4663
4685
  this.droppedSinceLast = 0;
4664
4686
  this.droppedTotal = 0;
4665
4687
  this.deliveredTotal = 0;
4688
+ this.enqueuedTotal = 0;
4666
4689
  this.backoffUntil = 0;
4667
4690
  this.collapse = /* @__PURE__ */ new Map();
4668
4691
  /** Keys the backend answered 401 for — later batches go unauthenticated. */
@@ -4675,13 +4698,16 @@ var BeaconBuffer = class {
4675
4698
  collapseMaxKeys: options.collapseMaxKeys ?? 1e3,
4676
4699
  requestTimeoutMs: options.requestTimeoutMs ?? 1e4,
4677
4700
  retryBackoffMs: options.retryBackoffMs ?? 1e3,
4701
+ holdRepeats: options.holdRepeats ?? false,
4702
+ containerId: options.containerId ?? CONTAINER_ID,
4678
4703
  now: options.now ?? Date.now
4679
4704
  };
4680
4705
  }
4681
4706
  /**
4682
4707
  * Queue one beacon. With a `collapseKey`, a repeat inside the window is
4683
- * merged into a held aggregate (sent when the window closes) instead of
4684
- * becoming its own item.
4708
+ * merged into this key's item while that item is still queued (not yet in
4709
+ * flight). Once it has left, the repeat becomes a new item, sendable on
4710
+ * this flush — nothing waits for a later invocation (round 27.6).
4685
4711
  */
4686
4712
  enqueue(dest, item, collapseKey) {
4687
4713
  const now = this.opts.now();
@@ -4694,12 +4720,15 @@ var BeaconBuffer = class {
4694
4720
  return;
4695
4721
  }
4696
4722
  }
4697
- const held = this.push(
4698
- dest,
4699
- { ...item, repeatCount: 1 },
4700
- entry.firstSeenAt + this.opts.collapseWindowMs
4701
- );
4702
- entry.held = held;
4723
+ if (this.opts.holdRepeats) {
4724
+ entry.held = this.push(
4725
+ dest,
4726
+ { ...item, repeatCount: 1 },
4727
+ entry.firstSeenAt + this.opts.collapseWindowMs
4728
+ );
4729
+ return;
4730
+ }
4731
+ entry.first = this.push(dest, { ...item, repeatCount: 1 }, now);
4703
4732
  return;
4704
4733
  }
4705
4734
  this.collapse.delete(collapseKey);
@@ -4735,6 +4764,7 @@ var BeaconBuffer = class {
4735
4764
  droppedSinceLast: this.droppedSinceLast,
4736
4765
  droppedTotal: this.droppedTotal,
4737
4766
  deliveredTotal: this.deliveredTotal,
4767
+ enqueuedTotal: this.enqueuedTotal,
4738
4768
  flushing: this.inFlight !== void 0
4739
4769
  };
4740
4770
  }
@@ -4749,6 +4779,7 @@ var BeaconBuffer = class {
4749
4779
  inFlight: false
4750
4780
  };
4751
4781
  this.queue.push(entry);
4782
+ this.enqueuedTotal += 1;
4752
4783
  return entry;
4753
4784
  }
4754
4785
  dropOldest() {
@@ -4794,7 +4825,11 @@ var BeaconBuffer = class {
4794
4825
  droppedSinceLast: reportedDropped,
4795
4826
  queueDepth: this.queue.length,
4796
4827
  adapter: dest.adapter ?? "edge-core",
4797
- version: SDK_VERSION
4828
+ version: SDK_VERSION,
4829
+ containerId: this.opts.containerId,
4830
+ enqueuedTotal: this.enqueuedTotal,
4831
+ deliveredTotal: this.deliveredTotal,
4832
+ droppedTotal: this.droppedTotal
4798
4833
  };
4799
4834
  const controller = typeof AbortController !== "undefined" ? new AbortController() : void 0;
4800
4835
  const response = await withBudget(
@@ -4922,6 +4957,43 @@ import { createHash as createHash3, webcrypto } from "crypto";
4922
4957
  // src/transport/registry/visa.ts
4923
4958
  import { createRemoteJWKSet } from "jose";
4924
4959
 
4960
+ // src/ucp/profile.ts
4961
+ var UCP_VERSION = "2026-08-25";
4962
+ var SPEC = `https://ucp.dev/${UCP_VERSION}/specification`;
4963
+ var SCHEMAS = `https://ucp.dev/${UCP_VERSION}/schemas`;
4964
+
4965
+ // src/ucp/signatures.ts
4966
+ import { httpbis as httpbis3, createSigner as createSigner2 } from "http-message-signatures";
4967
+
4968
+ // src/http-signatures/sign.ts
4969
+ import { httpbis as httpbis2, createSigner } from "http-message-signatures";
4970
+
4971
+ // src/ucp/checkout-kit.ts
4972
+ import { CompactSign as CompactSign2 } from "jose";
4973
+
4974
+ // src/mandates/sd-jwt.ts
4975
+ import {
4976
+ CompactSign,
4977
+ compactVerify,
4978
+ importJWK,
4979
+ decodeProtectedHeader
4980
+ } from "jose";
4981
+
4982
+ // src/idempotency/index.ts
4983
+ var DEFAULT_IDEMPOTENCY_TTL_MS = 24 * 60 * 60 * 1e3;
4984
+
4985
+ // src/payments/kyapay.ts
4986
+ import {
4987
+ createLocalJWKSet,
4988
+ createRemoteJWKSet as createRemoteJWKSet2,
4989
+ decodeProtectedHeader as decodeProtectedHeader2,
4990
+ jwtVerify
4991
+ } from "jose";
4992
+
4993
+ // src/aep/core.ts
4994
+ var ED25519_PKCS8_PREFIX = Buffer.from("302e020100300506032b657004220420", "hex");
4995
+ var ED25519_SPKI_PREFIX = Buffer.from("302a300506032b6570032100", "hex");
4996
+
4925
4997
  // src/gateway/modes/online.ts
4926
4998
  function toGatewayConfig(config) {
4927
4999
  return {