@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
@@ -3752,7 +3752,7 @@ function getTrustLevel(score) {
3752
3752
  }
3753
3753
 
3754
3754
  // src/version.ts
3755
- var SDK_VERSION = "5.19.0";
3755
+ var SDK_VERSION = "5.21.0";
3756
3756
 
3757
3757
  // src/http.ts
3758
3758
  var SDK_USER_AGENT = `astrasync-sdk/${SDK_VERSION}`;
@@ -4070,6 +4070,9 @@ async function callVerifyAccessAPI(config, request) {
4070
4070
  if (requestData.enableRuntimeChallenge)
4071
4071
  body.enableRuntimeChallenge = requestData.enableRuntimeChallenge;
4072
4072
  if (requestData.routePolicy) body.routePolicy = requestData.routePolicy;
4073
+ if (config.actingProof?.connectorToken) {
4074
+ body.actingProof = { connectorToken: config.actingProof.connectorToken };
4075
+ }
4073
4076
  if (requestData.approvalHeldByRoute) body.approvalHeldByRoute = true;
4074
4077
  if (requestData.createSession) body.createSession = requestData.createSession;
4075
4078
  if (requestData.durationRequired) body.durationRequired = requestData.durationRequired;
@@ -4237,22 +4240,43 @@ async function verify(config, request, options) {
4237
4240
  "[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."
4238
4241
  );
4239
4242
  }
4240
- const uncacheable = Boolean(request.commerceArtifacts);
4243
+ const uncacheable = Boolean(request.commerceArtifacts) || Boolean(mergedConfig.actingProof);
4241
4244
  if (mergedConfig.cacheTtl !== 0 && !options?.bypassCache && !uncacheable) {
4242
4245
  const cached = getCachedResult(request, mergedConfig.counterpartyId);
4243
4246
  if (cached) {
4244
4247
  if (mergedConfig.debug) {
4245
4248
  console.log("[VerificationGateway] Returning cached result");
4246
4249
  }
4247
- const hit = { ...cached };
4248
- if (request.attemptId) {
4249
- hit.attemptId = request.attemptId;
4250
- } else {
4251
- delete hit.attemptId;
4252
- }
4253
- return hit;
4250
+ return sharedVerdict(cached, request);
4254
4251
  }
4255
4252
  }
4253
+ if (mergedConfig.cacheTtl !== 0 && !options?.bypassCache && !uncacheable) {
4254
+ const key = getCacheKey(request, mergedConfig.counterpartyId);
4255
+ const pending = inflightVerifies.get(key);
4256
+ if (pending) return sharedVerdict(await pending, request);
4257
+ const flight = verifyViaApi(mergedConfig, request, urls, uncacheable);
4258
+ inflightVerifies.set(key, flight);
4259
+ try {
4260
+ return await flight;
4261
+ } finally {
4262
+ inflightVerifies.delete(key);
4263
+ }
4264
+ }
4265
+ return verifyViaApi(mergedConfig, request, urls, uncacheable);
4266
+ }
4267
+ var inflightVerifies = /* @__PURE__ */ new Map();
4268
+ var sharedVerdicts = /* @__PURE__ */ new WeakSet();
4269
+ function sharedVerdict(source, request) {
4270
+ const hit = { ...source };
4271
+ if (request.attemptId) {
4272
+ hit.attemptId = request.attemptId;
4273
+ } else {
4274
+ delete hit.attemptId;
4275
+ }
4276
+ sharedVerdicts.add(hit);
4277
+ return hit;
4278
+ }
4279
+ async function verifyViaApi(mergedConfig, request, urls, uncacheable) {
4256
4280
  const enrichedRequest = { ...request };
4257
4281
  if (!enrichedRequest.counterpartyUrl && mergedConfig.counterpartyUrl) {
4258
4282
  enrichedRequest.counterpartyUrl = mergedConfig.counterpartyUrl;
@@ -4331,7 +4355,9 @@ async function verify(config, request, options) {
4331
4355
  fulfilment: apiResponse.fulfilment,
4332
4356
  mandates: apiResponse.mandates,
4333
4357
  kyaToken: apiResponse.kyaToken,
4334
- aep: apiResponse.aep
4358
+ aep: apiResponse.aep,
4359
+ // 5.20.0 (round 29.1): non-fatal integration warnings (e.g. events_url_missing).
4360
+ warnings: apiResponse.warnings
4335
4361
  };
4336
4362
  return result2;
4337
4363
  }
@@ -4399,7 +4425,9 @@ async function verify(config, request, options) {
4399
4425
  // 5.15.0: merchant-lane AP2 mandates + KYAPay identity token.
4400
4426
  mandates: apiResponse.mandates,
4401
4427
  kyaToken: apiResponse.kyaToken,
4402
- aep: apiResponse.aep
4428
+ aep: apiResponse.aep,
4429
+ // 5.20.0 (round 29.1): non-fatal integration warnings (e.g. events_url_missing).
4430
+ warnings: apiResponse.warnings
4403
4431
  };
4404
4432
  if (result.recommendation === "deny") {
4405
4433
  result.policyAllowed = false;
@@ -4425,8 +4453,18 @@ async function verify(config, request, options) {
4425
4453
  cacheResult(request, result, mergedConfig.cacheTtl, mergedConfig.counterpartyId);
4426
4454
  }
4427
4455
  }
4456
+ notifyVerificationListeners(request, result);
4428
4457
  return result;
4429
4458
  }
4459
+ var verificationListeners = /* @__PURE__ */ new Set();
4460
+ function notifyVerificationListeners(request, result) {
4461
+ for (const listener of verificationListeners) {
4462
+ try {
4463
+ listener(result, request);
4464
+ } catch {
4465
+ }
4466
+ }
4467
+ }
4430
4468
 
4431
4469
  // src/adapters/stepup-poll.ts
4432
4470
  var FALLBACK_MAX_WAIT_MS = 5 * 60 * 1e3;
@@ -4795,7 +4833,7 @@ var ED25519_SPKI_PREFIX = Buffer.from("302a300506032b6570032100", "hex");
4795
4833
  // src/gateway/modes/online.ts
4796
4834
  function toGatewayConfig(config) {
4797
4835
  return {
4798
- apiBaseUrl: config.apiBaseUrl || "https://api.astrasync.ai",
4836
+ apiBaseUrl: config.apiBaseUrl || "https://astrasync.ai/api",
4799
4837
  apiKey: config.apiKey,
4800
4838
  minTrustScore: config.minTrustScore,
4801
4839
  minTrustScoreForFull: config.minTrustScoreForFull,
@@ -3751,7 +3751,7 @@ function getTrustLevel(score) {
3751
3751
  }
3752
3752
 
3753
3753
  // src/version.ts
3754
- var SDK_VERSION = "5.19.0";
3754
+ var SDK_VERSION = "5.21.0";
3755
3755
 
3756
3756
  // src/http.ts
3757
3757
  var SDK_USER_AGENT = `astrasync-sdk/${SDK_VERSION}`;
@@ -4069,6 +4069,9 @@ async function callVerifyAccessAPI(config, request) {
4069
4069
  if (requestData.enableRuntimeChallenge)
4070
4070
  body.enableRuntimeChallenge = requestData.enableRuntimeChallenge;
4071
4071
  if (requestData.routePolicy) body.routePolicy = requestData.routePolicy;
4072
+ if (config.actingProof?.connectorToken) {
4073
+ body.actingProof = { connectorToken: config.actingProof.connectorToken };
4074
+ }
4072
4075
  if (requestData.approvalHeldByRoute) body.approvalHeldByRoute = true;
4073
4076
  if (requestData.createSession) body.createSession = requestData.createSession;
4074
4077
  if (requestData.durationRequired) body.durationRequired = requestData.durationRequired;
@@ -4236,22 +4239,43 @@ async function verify(config, request, options) {
4236
4239
  "[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."
4237
4240
  );
4238
4241
  }
4239
- const uncacheable = Boolean(request.commerceArtifacts);
4242
+ const uncacheable = Boolean(request.commerceArtifacts) || Boolean(mergedConfig.actingProof);
4240
4243
  if (mergedConfig.cacheTtl !== 0 && !options?.bypassCache && !uncacheable) {
4241
4244
  const cached = getCachedResult(request, mergedConfig.counterpartyId);
4242
4245
  if (cached) {
4243
4246
  if (mergedConfig.debug) {
4244
4247
  console.log("[VerificationGateway] Returning cached result");
4245
4248
  }
4246
- const hit = { ...cached };
4247
- if (request.attemptId) {
4248
- hit.attemptId = request.attemptId;
4249
- } else {
4250
- delete hit.attemptId;
4251
- }
4252
- return hit;
4249
+ return sharedVerdict(cached, request);
4253
4250
  }
4254
4251
  }
4252
+ if (mergedConfig.cacheTtl !== 0 && !options?.bypassCache && !uncacheable) {
4253
+ const key = getCacheKey(request, mergedConfig.counterpartyId);
4254
+ const pending = inflightVerifies.get(key);
4255
+ if (pending) return sharedVerdict(await pending, request);
4256
+ const flight = verifyViaApi(mergedConfig, request, urls, uncacheable);
4257
+ inflightVerifies.set(key, flight);
4258
+ try {
4259
+ return await flight;
4260
+ } finally {
4261
+ inflightVerifies.delete(key);
4262
+ }
4263
+ }
4264
+ return verifyViaApi(mergedConfig, request, urls, uncacheable);
4265
+ }
4266
+ var inflightVerifies = /* @__PURE__ */ new Map();
4267
+ var sharedVerdicts = /* @__PURE__ */ new WeakSet();
4268
+ function sharedVerdict(source, request) {
4269
+ const hit = { ...source };
4270
+ if (request.attemptId) {
4271
+ hit.attemptId = request.attemptId;
4272
+ } else {
4273
+ delete hit.attemptId;
4274
+ }
4275
+ sharedVerdicts.add(hit);
4276
+ return hit;
4277
+ }
4278
+ async function verifyViaApi(mergedConfig, request, urls, uncacheable) {
4255
4279
  const enrichedRequest = { ...request };
4256
4280
  if (!enrichedRequest.counterpartyUrl && mergedConfig.counterpartyUrl) {
4257
4281
  enrichedRequest.counterpartyUrl = mergedConfig.counterpartyUrl;
@@ -4330,7 +4354,9 @@ async function verify(config, request, options) {
4330
4354
  fulfilment: apiResponse.fulfilment,
4331
4355
  mandates: apiResponse.mandates,
4332
4356
  kyaToken: apiResponse.kyaToken,
4333
- aep: apiResponse.aep
4357
+ aep: apiResponse.aep,
4358
+ // 5.20.0 (round 29.1): non-fatal integration warnings (e.g. events_url_missing).
4359
+ warnings: apiResponse.warnings
4334
4360
  };
4335
4361
  return result2;
4336
4362
  }
@@ -4398,7 +4424,9 @@ async function verify(config, request, options) {
4398
4424
  // 5.15.0: merchant-lane AP2 mandates + KYAPay identity token.
4399
4425
  mandates: apiResponse.mandates,
4400
4426
  kyaToken: apiResponse.kyaToken,
4401
- aep: apiResponse.aep
4427
+ aep: apiResponse.aep,
4428
+ // 5.20.0 (round 29.1): non-fatal integration warnings (e.g. events_url_missing).
4429
+ warnings: apiResponse.warnings
4402
4430
  };
4403
4431
  if (result.recommendation === "deny") {
4404
4432
  result.policyAllowed = false;
@@ -4424,8 +4452,18 @@ async function verify(config, request, options) {
4424
4452
  cacheResult(request, result, mergedConfig.cacheTtl, mergedConfig.counterpartyId);
4425
4453
  }
4426
4454
  }
4455
+ notifyVerificationListeners(request, result);
4427
4456
  return result;
4428
4457
  }
4458
+ var verificationListeners = /* @__PURE__ */ new Set();
4459
+ function notifyVerificationListeners(request, result) {
4460
+ for (const listener of verificationListeners) {
4461
+ try {
4462
+ listener(result, request);
4463
+ } catch {
4464
+ }
4465
+ }
4466
+ }
4429
4467
 
4430
4468
  // src/adapters/stepup-poll.ts
4431
4469
  var FALLBACK_MAX_WAIT_MS = 5 * 60 * 1e3;
@@ -4794,7 +4832,7 @@ var ED25519_SPKI_PREFIX = Buffer.from("302a300506032b6570032100", "hex");
4794
4832
  // src/gateway/modes/online.ts
4795
4833
  function toGatewayConfig(config) {
4796
4834
  return {
4797
- apiBaseUrl: config.apiBaseUrl || "https://api.astrasync.ai",
4835
+ apiBaseUrl: config.apiBaseUrl || "https://astrasync.ai/api",
4798
4836
  apiKey: config.apiKey,
4799
4837
  minTrustScore: config.minTrustScore,
4800
4838
  minTrustScoreForFull: config.minTrustScoreForFull,
@@ -3713,7 +3713,7 @@ Policy saved to ${outputPath}`);
3713
3713
  };
3714
3714
 
3715
3715
  // src/version.ts
3716
- var SDK_VERSION = "5.19.0";
3716
+ var SDK_VERSION = "5.21.0";
3717
3717
 
3718
3718
  // src/http.ts
3719
3719
  var SDK_USER_AGENT = `astrasync-sdk/${SDK_VERSION}`;
@@ -4935,6 +4935,9 @@ async function callVerifyAccessAPI(config, request2) {
4935
4935
  if (requestData.enableRuntimeChallenge)
4936
4936
  body.enableRuntimeChallenge = requestData.enableRuntimeChallenge;
4937
4937
  if (requestData.routePolicy) body.routePolicy = requestData.routePolicy;
4938
+ if (config.actingProof?.connectorToken) {
4939
+ body.actingProof = { connectorToken: config.actingProof.connectorToken };
4940
+ }
4938
4941
  if (requestData.approvalHeldByRoute) body.approvalHeldByRoute = true;
4939
4942
  if (requestData.createSession) body.createSession = requestData.createSession;
4940
4943
  if (requestData.durationRequired) body.durationRequired = requestData.durationRequired;
@@ -5102,22 +5105,43 @@ async function verify(config, request2, options) {
5102
5105
  "[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."
5103
5106
  );
5104
5107
  }
5105
- const uncacheable = Boolean(request2.commerceArtifacts);
5108
+ const uncacheable = Boolean(request2.commerceArtifacts) || Boolean(mergedConfig.actingProof);
5106
5109
  if (mergedConfig.cacheTtl !== 0 && !options?.bypassCache && !uncacheable) {
5107
5110
  const cached = getCachedResult(request2, mergedConfig.counterpartyId);
5108
5111
  if (cached) {
5109
5112
  if (mergedConfig.debug) {
5110
5113
  console.log("[VerificationGateway] Returning cached result");
5111
5114
  }
5112
- const hit = { ...cached };
5113
- if (request2.attemptId) {
5114
- hit.attemptId = request2.attemptId;
5115
- } else {
5116
- delete hit.attemptId;
5117
- }
5118
- return hit;
5115
+ return sharedVerdict(cached, request2);
5119
5116
  }
5120
5117
  }
5118
+ if (mergedConfig.cacheTtl !== 0 && !options?.bypassCache && !uncacheable) {
5119
+ const key = getCacheKey(request2, mergedConfig.counterpartyId);
5120
+ const pending = inflightVerifies.get(key);
5121
+ if (pending) return sharedVerdict(await pending, request2);
5122
+ const flight = verifyViaApi(mergedConfig, request2, urls, uncacheable);
5123
+ inflightVerifies.set(key, flight);
5124
+ try {
5125
+ return await flight;
5126
+ } finally {
5127
+ inflightVerifies.delete(key);
5128
+ }
5129
+ }
5130
+ return verifyViaApi(mergedConfig, request2, urls, uncacheable);
5131
+ }
5132
+ var inflightVerifies = /* @__PURE__ */ new Map();
5133
+ var sharedVerdicts = /* @__PURE__ */ new WeakSet();
5134
+ function sharedVerdict(source, request2) {
5135
+ const hit = { ...source };
5136
+ if (request2.attemptId) {
5137
+ hit.attemptId = request2.attemptId;
5138
+ } else {
5139
+ delete hit.attemptId;
5140
+ }
5141
+ sharedVerdicts.add(hit);
5142
+ return hit;
5143
+ }
5144
+ async function verifyViaApi(mergedConfig, request2, urls, uncacheable) {
5121
5145
  const enrichedRequest = { ...request2 };
5122
5146
  if (!enrichedRequest.counterpartyUrl && mergedConfig.counterpartyUrl) {
5123
5147
  enrichedRequest.counterpartyUrl = mergedConfig.counterpartyUrl;
@@ -5196,7 +5220,9 @@ async function verify(config, request2, options) {
5196
5220
  fulfilment: apiResponse.fulfilment,
5197
5221
  mandates: apiResponse.mandates,
5198
5222
  kyaToken: apiResponse.kyaToken,
5199
- aep: apiResponse.aep
5223
+ aep: apiResponse.aep,
5224
+ // 5.20.0 (round 29.1): non-fatal integration warnings (e.g. events_url_missing).
5225
+ warnings: apiResponse.warnings
5200
5226
  };
5201
5227
  return result2;
5202
5228
  }
@@ -5264,7 +5290,9 @@ async function verify(config, request2, options) {
5264
5290
  // 5.15.0: merchant-lane AP2 mandates + KYAPay identity token.
5265
5291
  mandates: apiResponse.mandates,
5266
5292
  kyaToken: apiResponse.kyaToken,
5267
- aep: apiResponse.aep
5293
+ aep: apiResponse.aep,
5294
+ // 5.20.0 (round 29.1): non-fatal integration warnings (e.g. events_url_missing).
5295
+ warnings: apiResponse.warnings
5268
5296
  };
5269
5297
  if (result.recommendation === "deny") {
5270
5298
  result.policyAllowed = false;
@@ -5290,8 +5318,18 @@ async function verify(config, request2, options) {
5290
5318
  cacheResult(request2, result, mergedConfig.cacheTtl, mergedConfig.counterpartyId);
5291
5319
  }
5292
5320
  }
5321
+ notifyVerificationListeners(request2, result);
5293
5322
  return result;
5294
5323
  }
5324
+ var verificationListeners = /* @__PURE__ */ new Set();
5325
+ function notifyVerificationListeners(request2, result) {
5326
+ for (const listener of verificationListeners) {
5327
+ try {
5328
+ listener(result, request2);
5329
+ } catch {
5330
+ }
5331
+ }
5332
+ }
5295
5333
 
5296
5334
  // src/adapters/stepup-poll.ts
5297
5335
  var FALLBACK_MAX_WAIT_MS = 5 * 60 * 1e3;
@@ -5660,7 +5698,7 @@ var ED25519_SPKI_PREFIX = Buffer.from("302a300506032b6570032100", "hex");
5660
5698
  // src/gateway/modes/online.ts
5661
5699
  function toGatewayConfig(config) {
5662
5700
  return {
5663
- apiBaseUrl: config.apiBaseUrl || "https://api.astrasync.ai",
5701
+ apiBaseUrl: config.apiBaseUrl || "https://astrasync.ai/api",
5664
5702
  apiKey: config.apiKey,
5665
5703
  minTrustScore: config.minTrustScore,
5666
5704
  minTrustScoreForFull: config.minTrustScoreForFull,
@@ -36,7 +36,7 @@ var SDK_VERSION;
36
36
  var init_version = __esm({
37
37
  "src/version.ts"() {
38
38
  "use strict";
39
- SDK_VERSION = "5.19.0";
39
+ SDK_VERSION = "5.21.0";
40
40
  }
41
41
  });
42
42
 
@@ -5347,6 +5347,9 @@ async function callVerifyAccessAPI(config, request2) {
5347
5347
  if (requestData.enableRuntimeChallenge)
5348
5348
  body.enableRuntimeChallenge = requestData.enableRuntimeChallenge;
5349
5349
  if (requestData.routePolicy) body.routePolicy = requestData.routePolicy;
5350
+ if (config.actingProof?.connectorToken) {
5351
+ body.actingProof = { connectorToken: config.actingProof.connectorToken };
5352
+ }
5350
5353
  if (requestData.approvalHeldByRoute) body.approvalHeldByRoute = true;
5351
5354
  if (requestData.createSession) body.createSession = requestData.createSession;
5352
5355
  if (requestData.durationRequired) body.durationRequired = requestData.durationRequired;
@@ -5514,22 +5517,41 @@ async function verify(config, request2, options) {
5514
5517
  "[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."
5515
5518
  );
5516
5519
  }
5517
- const uncacheable = Boolean(request2.commerceArtifacts);
5520
+ const uncacheable = Boolean(request2.commerceArtifacts) || Boolean(mergedConfig.actingProof);
5518
5521
  if (mergedConfig.cacheTtl !== 0 && !options?.bypassCache && !uncacheable) {
5519
5522
  const cached = getCachedResult(request2, mergedConfig.counterpartyId);
5520
5523
  if (cached) {
5521
5524
  if (mergedConfig.debug) {
5522
5525
  console.log("[VerificationGateway] Returning cached result");
5523
5526
  }
5524
- const hit = { ...cached };
5525
- if (request2.attemptId) {
5526
- hit.attemptId = request2.attemptId;
5527
- } else {
5528
- delete hit.attemptId;
5529
- }
5530
- return hit;
5527
+ return sharedVerdict(cached, request2);
5531
5528
  }
5532
5529
  }
5530
+ if (mergedConfig.cacheTtl !== 0 && !options?.bypassCache && !uncacheable) {
5531
+ const key = getCacheKey(request2, mergedConfig.counterpartyId);
5532
+ const pending = inflightVerifies.get(key);
5533
+ if (pending) return sharedVerdict(await pending, request2);
5534
+ const flight = verifyViaApi(mergedConfig, request2, urls, uncacheable);
5535
+ inflightVerifies.set(key, flight);
5536
+ try {
5537
+ return await flight;
5538
+ } finally {
5539
+ inflightVerifies.delete(key);
5540
+ }
5541
+ }
5542
+ return verifyViaApi(mergedConfig, request2, urls, uncacheable);
5543
+ }
5544
+ function sharedVerdict(source, request2) {
5545
+ const hit = { ...source };
5546
+ if (request2.attemptId) {
5547
+ hit.attemptId = request2.attemptId;
5548
+ } else {
5549
+ delete hit.attemptId;
5550
+ }
5551
+ sharedVerdicts.add(hit);
5552
+ return hit;
5553
+ }
5554
+ async function verifyViaApi(mergedConfig, request2, urls, uncacheable) {
5533
5555
  const enrichedRequest = { ...request2 };
5534
5556
  if (!enrichedRequest.counterpartyUrl && mergedConfig.counterpartyUrl) {
5535
5557
  enrichedRequest.counterpartyUrl = mergedConfig.counterpartyUrl;
@@ -5608,7 +5630,9 @@ async function verify(config, request2, options) {
5608
5630
  fulfilment: apiResponse.fulfilment,
5609
5631
  mandates: apiResponse.mandates,
5610
5632
  kyaToken: apiResponse.kyaToken,
5611
- aep: apiResponse.aep
5633
+ aep: apiResponse.aep,
5634
+ // 5.20.0 (round 29.1): non-fatal integration warnings (e.g. events_url_missing).
5635
+ warnings: apiResponse.warnings
5612
5636
  };
5613
5637
  return result2;
5614
5638
  }
@@ -5676,7 +5700,9 @@ async function verify(config, request2, options) {
5676
5700
  // 5.15.0: merchant-lane AP2 mandates + KYAPay identity token.
5677
5701
  mandates: apiResponse.mandates,
5678
5702
  kyaToken: apiResponse.kyaToken,
5679
- aep: apiResponse.aep
5703
+ aep: apiResponse.aep,
5704
+ // 5.20.0 (round 29.1): non-fatal integration warnings (e.g. events_url_missing).
5705
+ warnings: apiResponse.warnings
5680
5706
  };
5681
5707
  if (result.recommendation === "deny") {
5682
5708
  result.policyAllowed = false;
@@ -5702,9 +5728,18 @@ async function verify(config, request2, options) {
5702
5728
  cacheResult(request2, result, mergedConfig.cacheTtl, mergedConfig.counterpartyId);
5703
5729
  }
5704
5730
  }
5731
+ notifyVerificationListeners(request2, result);
5705
5732
  return result;
5706
5733
  }
5707
- var DEFAULT_CONFIG, initCheckPerformed, deprecationWarningShown, verificationCache, DEFAULT_CACHE_TTL_SECONDS, MAX_RETRY_AFTER_MS;
5734
+ function notifyVerificationListeners(request2, result) {
5735
+ for (const listener of verificationListeners) {
5736
+ try {
5737
+ listener(result, request2);
5738
+ } catch {
5739
+ }
5740
+ }
5741
+ }
5742
+ var DEFAULT_CONFIG, initCheckPerformed, deprecationWarningShown, verificationCache, DEFAULT_CACHE_TTL_SECONDS, MAX_RETRY_AFTER_MS, inflightVerifies, sharedVerdicts, verificationListeners;
5708
5743
  var init_verify = __esm({
5709
5744
  "src/verify.ts"() {
5710
5745
  "use strict";
@@ -5727,6 +5762,9 @@ var init_verify = __esm({
5727
5762
  verificationCache = /* @__PURE__ */ new Map();
5728
5763
  DEFAULT_CACHE_TTL_SECONDS = 60;
5729
5764
  MAX_RETRY_AFTER_MS = 15 * 60 * 1e3;
5765
+ inflightVerifies = /* @__PURE__ */ new Map();
5766
+ sharedVerdicts = /* @__PURE__ */ new WeakSet();
5767
+ verificationListeners = /* @__PURE__ */ new Set();
5730
5768
  }
5731
5769
  });
5732
5770
 
@@ -6624,6 +6662,16 @@ var init_signatures = __esm({
6624
6662
  }
6625
6663
  });
6626
6664
 
6665
+ // src/ucp/agent-commerce.ts
6666
+ var init_agent_commerce = __esm({
6667
+ "src/ucp/agent-commerce.ts"() {
6668
+ "use strict";
6669
+ init_http();
6670
+ init_verified_hop();
6671
+ init_version();
6672
+ }
6673
+ });
6674
+
6627
6675
  // src/mandates/sd-jwt.ts
6628
6676
  var import_jose2;
6629
6677
  var init_sd_jwt = __esm({
@@ -6686,6 +6734,7 @@ var import_jose3;
6686
6734
  var init_checkout_kit = __esm({
6687
6735
  "src/ucp/checkout-kit.ts"() {
6688
6736
  "use strict";
6737
+ init_agent_commerce();
6689
6738
  import_jose3 = require("jose");
6690
6739
  init_mandates();
6691
6740
  init_idempotency();
@@ -6747,6 +6796,7 @@ var init_ucp2 = __esm({
6747
6796
  init_checkout_kit();
6748
6797
  init_jcs();
6749
6798
  init_approval_events();
6799
+ init_agent_commerce();
6750
6800
  }
6751
6801
  });
6752
6802
 
@@ -6805,7 +6855,9 @@ var init_aep = __esm({
6805
6855
  var init_checkout_kit2 = __esm({
6806
6856
  "src/acp/checkout-kit.ts"() {
6807
6857
  "use strict";
6858
+ init_agent_commerce();
6808
6859
  init_idempotency();
6860
+ init_checkout_kit();
6809
6861
  init_report_amount();
6810
6862
  init_kit_shared();
6811
6863
  init_errors();
@@ -6887,7 +6939,7 @@ var init_src = __esm({
6887
6939
  // src/gateway/modes/online.ts
6888
6940
  function toGatewayConfig(config) {
6889
6941
  return {
6890
- apiBaseUrl: config.apiBaseUrl || "https://api.astrasync.ai",
6942
+ apiBaseUrl: config.apiBaseUrl || "https://astrasync.ai/api",
6891
6943
  apiKey: config.apiKey,
6892
6944
  minTrustScore: config.minTrustScore,
6893
6945
  minTrustScoreForFull: config.minTrustScoreForFull,
@@ -3988,7 +3988,7 @@ function getTrustLevel(score) {
3988
3988
  }
3989
3989
 
3990
3990
  // src/version.ts
3991
- var SDK_VERSION = "5.19.0";
3991
+ var SDK_VERSION = "5.21.0";
3992
3992
 
3993
3993
  // src/http.ts
3994
3994
  var SDK_USER_AGENT = `astrasync-sdk/${SDK_VERSION}`;
@@ -4306,6 +4306,9 @@ async function callVerifyAccessAPI(config, request) {
4306
4306
  if (requestData.enableRuntimeChallenge)
4307
4307
  body.enableRuntimeChallenge = requestData.enableRuntimeChallenge;
4308
4308
  if (requestData.routePolicy) body.routePolicy = requestData.routePolicy;
4309
+ if (config.actingProof?.connectorToken) {
4310
+ body.actingProof = { connectorToken: config.actingProof.connectorToken };
4311
+ }
4309
4312
  if (requestData.approvalHeldByRoute) body.approvalHeldByRoute = true;
4310
4313
  if (requestData.createSession) body.createSession = requestData.createSession;
4311
4314
  if (requestData.durationRequired) body.durationRequired = requestData.durationRequired;
@@ -4473,22 +4476,43 @@ async function verify(config, request, options) {
4473
4476
  "[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."
4474
4477
  );
4475
4478
  }
4476
- const uncacheable = Boolean(request.commerceArtifacts);
4479
+ const uncacheable = Boolean(request.commerceArtifacts) || Boolean(mergedConfig.actingProof);
4477
4480
  if (mergedConfig.cacheTtl !== 0 && !options?.bypassCache && !uncacheable) {
4478
4481
  const cached = getCachedResult(request, mergedConfig.counterpartyId);
4479
4482
  if (cached) {
4480
4483
  if (mergedConfig.debug) {
4481
4484
  console.log("[VerificationGateway] Returning cached result");
4482
4485
  }
4483
- const hit = { ...cached };
4484
- if (request.attemptId) {
4485
- hit.attemptId = request.attemptId;
4486
- } else {
4487
- delete hit.attemptId;
4488
- }
4489
- return hit;
4486
+ return sharedVerdict(cached, request);
4490
4487
  }
4491
4488
  }
4489
+ if (mergedConfig.cacheTtl !== 0 && !options?.bypassCache && !uncacheable) {
4490
+ const key = getCacheKey(request, mergedConfig.counterpartyId);
4491
+ const pending = inflightVerifies.get(key);
4492
+ if (pending) return sharedVerdict(await pending, request);
4493
+ const flight = verifyViaApi(mergedConfig, request, urls, uncacheable);
4494
+ inflightVerifies.set(key, flight);
4495
+ try {
4496
+ return await flight;
4497
+ } finally {
4498
+ inflightVerifies.delete(key);
4499
+ }
4500
+ }
4501
+ return verifyViaApi(mergedConfig, request, urls, uncacheable);
4502
+ }
4503
+ var inflightVerifies = /* @__PURE__ */ new Map();
4504
+ var sharedVerdicts = /* @__PURE__ */ new WeakSet();
4505
+ function sharedVerdict(source, request) {
4506
+ const hit = { ...source };
4507
+ if (request.attemptId) {
4508
+ hit.attemptId = request.attemptId;
4509
+ } else {
4510
+ delete hit.attemptId;
4511
+ }
4512
+ sharedVerdicts.add(hit);
4513
+ return hit;
4514
+ }
4515
+ async function verifyViaApi(mergedConfig, request, urls, uncacheable) {
4492
4516
  const enrichedRequest = { ...request };
4493
4517
  if (!enrichedRequest.counterpartyUrl && mergedConfig.counterpartyUrl) {
4494
4518
  enrichedRequest.counterpartyUrl = mergedConfig.counterpartyUrl;
@@ -4567,7 +4591,9 @@ async function verify(config, request, options) {
4567
4591
  fulfilment: apiResponse.fulfilment,
4568
4592
  mandates: apiResponse.mandates,
4569
4593
  kyaToken: apiResponse.kyaToken,
4570
- aep: apiResponse.aep
4594
+ aep: apiResponse.aep,
4595
+ // 5.20.0 (round 29.1): non-fatal integration warnings (e.g. events_url_missing).
4596
+ warnings: apiResponse.warnings
4571
4597
  };
4572
4598
  return result2;
4573
4599
  }
@@ -4635,7 +4661,9 @@ async function verify(config, request, options) {
4635
4661
  // 5.15.0: merchant-lane AP2 mandates + KYAPay identity token.
4636
4662
  mandates: apiResponse.mandates,
4637
4663
  kyaToken: apiResponse.kyaToken,
4638
- aep: apiResponse.aep
4664
+ aep: apiResponse.aep,
4665
+ // 5.20.0 (round 29.1): non-fatal integration warnings (e.g. events_url_missing).
4666
+ warnings: apiResponse.warnings
4639
4667
  };
4640
4668
  if (result.recommendation === "deny") {
4641
4669
  result.policyAllowed = false;
@@ -4661,8 +4689,18 @@ async function verify(config, request, options) {
4661
4689
  cacheResult(request, result, mergedConfig.cacheTtl, mergedConfig.counterpartyId);
4662
4690
  }
4663
4691
  }
4692
+ notifyVerificationListeners(request, result);
4664
4693
  return result;
4665
4694
  }
4695
+ var verificationListeners = /* @__PURE__ */ new Set();
4696
+ function notifyVerificationListeners(request, result) {
4697
+ for (const listener of verificationListeners) {
4698
+ try {
4699
+ listener(result, request);
4700
+ } catch {
4701
+ }
4702
+ }
4703
+ }
4666
4704
 
4667
4705
  // src/adapters/stepup-poll.ts
4668
4706
  var FALLBACK_MAX_WAIT_MS = 5 * 60 * 1e3;
@@ -5031,7 +5069,7 @@ var ED25519_SPKI_PREFIX = Buffer.from("302a300506032b6570032100", "hex");
5031
5069
  // src/gateway/modes/online.ts
5032
5070
  function toGatewayConfig(config) {
5033
5071
  return {
5034
- apiBaseUrl: config.apiBaseUrl || "https://api.astrasync.ai",
5072
+ apiBaseUrl: config.apiBaseUrl || "https://astrasync.ai/api",
5035
5073
  apiKey: config.apiKey,
5036
5074
  minTrustScore: config.minTrustScore,
5037
5075
  minTrustScoreForFull: config.minTrustScoreForFull,