@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
@@ -3752,7 +3752,7 @@ function getTrustLevel(score) {
3752
3752
  }
3753
3753
 
3754
3754
  // src/version.ts
3755
- var SDK_VERSION = "5.13.0";
3755
+ var SDK_VERSION = "5.15.0";
3756
3756
 
3757
3757
  // src/http.ts
3758
3758
  var SDK_USER_AGENT = `astrasync-sdk/${SDK_VERSION}`;
@@ -4071,6 +4071,7 @@ async function callVerifyAccessAPI(config, request) {
4071
4071
  if (requestData.invocationProtocol) body.invocationProtocol = requestData.invocationProtocol;
4072
4072
  if (requestData.commercePhase) body.commercePhase = requestData.commercePhase;
4073
4073
  if (requestData.checkoutSessionId) body.checkoutSessionId = requestData.checkoutSessionId;
4074
+ if (requestData.checkoutJwt) body.checkoutJwt = requestData.checkoutJwt;
4074
4075
  if (requestData.checkoutItems) body.checkoutItems = requestData.checkoutItems;
4075
4076
  if (requestData.buyerEmail) body.buyerEmail = requestData.buyerEmail;
4076
4077
  if (requestData.commerceArtifacts) body.commerceArtifacts = requestData.commerceArtifacts;
@@ -4221,7 +4222,8 @@ async function verify(config, request, options) {
4221
4222
  "[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."
4222
4223
  );
4223
4224
  }
4224
- if (mergedConfig.cacheTtl !== 0 && !options?.bypassCache) {
4225
+ const uncacheable = Boolean(request.commerceArtifacts);
4226
+ if (mergedConfig.cacheTtl !== 0 && !options?.bypassCache && !uncacheable) {
4225
4227
  const cached = getCachedResult(request, mergedConfig.counterpartyId);
4226
4228
  if (cached) {
4227
4229
  if (mergedConfig.debug) {
@@ -4302,7 +4304,10 @@ async function verify(config, request, options) {
4302
4304
  // MERCHANT caller only (bridge callers strip it before the agent plane).
4303
4305
  settlementToken: apiResponse.settlementToken,
4304
4306
  // 5.6.0: fulfilment contact — merchant-only lane, same strip rule.
4305
- fulfilment: apiResponse.fulfilment
4307
+ fulfilment: apiResponse.fulfilment,
4308
+ mandates: apiResponse.mandates,
4309
+ kyaToken: apiResponse.kyaToken,
4310
+ aep: apiResponse.aep
4306
4311
  };
4307
4312
  return result2;
4308
4313
  }
@@ -4312,7 +4317,10 @@ async function verify(config, request, options) {
4312
4317
  trustScore: apiResponse.agent.trustScore,
4313
4318
  trustLevel: getTrustLevel(apiResponse.agent.trustScore),
4314
4319
  blockchainAnchored: apiResponse.agent.blockchainStatus === "anchored",
4315
- status: apiResponse.agent.agentStatus
4320
+ status: apiResponse.agent.agentStatus,
4321
+ ...apiResponse.agent.protocolIdentities && {
4322
+ protocolIdentities: apiResponse.agent.protocolIdentities
4323
+ }
4316
4324
  } : void 0;
4317
4325
  const developer = apiResponse.developer ? {
4318
4326
  astradId: apiResponse.developer.kyaOwnerId,
@@ -4363,7 +4371,11 @@ async function verify(config, request, options) {
4363
4371
  settlementOutcome: apiResponse.settlementOutcome,
4364
4372
  settlementToken: apiResponse.settlementToken,
4365
4373
  // 5.6.0: fulfilment contact — merchant-only lane, same strip rule.
4366
- fulfilment: apiResponse.fulfilment
4374
+ fulfilment: apiResponse.fulfilment,
4375
+ // 5.15.0: merchant-lane AP2 mandates + KYAPay identity token.
4376
+ mandates: apiResponse.mandates,
4377
+ kyaToken: apiResponse.kyaToken,
4378
+ aep: apiResponse.aep
4367
4379
  };
4368
4380
  if (result.recommendation === "deny") {
4369
4381
  result.policyAllowed = false;
@@ -4383,7 +4395,9 @@ async function verify(config, request, options) {
4383
4395
  }
4384
4396
  const escalates = result.requiresStepUp === true || result.requiresApproval === true || result.recommendation === "step_up_required";
4385
4397
  if (mergedConfig.cacheTtl !== 0 && result.recommendation !== "deny" && !escalates) {
4386
- cacheResult(request, result, mergedConfig.cacheTtl, mergedConfig.counterpartyId);
4398
+ if (!uncacheable) {
4399
+ cacheResult(request, result, mergedConfig.cacheTtl, mergedConfig.counterpartyId);
4400
+ }
4387
4401
  }
4388
4402
  return result;
4389
4403
  }
@@ -4394,6 +4408,9 @@ var FALLBACK_MAX_WAIT_MS = 5 * 60 * 1e3;
4394
4408
  // src/metadata-capture.ts
4395
4409
  var MAX_TOTAL_BYTES = 16 * 1024;
4396
4410
 
4411
+ // src/adapters/commerce-detect.ts
4412
+ var MAX_BODY_BYTES = 64 * 1024;
4413
+
4397
4414
  // src/edge-config.ts
4398
4415
  var DEFAULT_EDGE_CONFIG = Object.freeze({
4399
4416
  version: 1,
@@ -4422,6 +4439,11 @@ async function withBudget(promise, ms) {
4422
4439
  if (timer) clearTimeout(timer);
4423
4440
  }
4424
4441
  }
4442
+ var CONTAINER_ID = (() => {
4443
+ const c = globalThis.crypto;
4444
+ if (c?.randomUUID) return c.randomUUID();
4445
+ return `c-${Date.now().toString(36)}-${Math.random().toString(36).slice(2, 12)}`;
4446
+ })();
4425
4447
  var destKeyOf = (d) => `${d.apiBaseUrl}\0${d.apiKey ?? ""}\0${d.counterparty}\0${d.adapter ?? ""}`;
4426
4448
  var BeaconBuffer = class {
4427
4449
  constructor(options = {}) {
@@ -4429,6 +4451,7 @@ var BeaconBuffer = class {
4429
4451
  this.droppedSinceLast = 0;
4430
4452
  this.droppedTotal = 0;
4431
4453
  this.deliveredTotal = 0;
4454
+ this.enqueuedTotal = 0;
4432
4455
  this.backoffUntil = 0;
4433
4456
  this.collapse = /* @__PURE__ */ new Map();
4434
4457
  /** Keys the backend answered 401 for — later batches go unauthenticated. */
@@ -4441,13 +4464,16 @@ var BeaconBuffer = class {
4441
4464
  collapseMaxKeys: options.collapseMaxKeys ?? 1e3,
4442
4465
  requestTimeoutMs: options.requestTimeoutMs ?? 1e4,
4443
4466
  retryBackoffMs: options.retryBackoffMs ?? 1e3,
4467
+ holdRepeats: options.holdRepeats ?? false,
4468
+ containerId: options.containerId ?? CONTAINER_ID,
4444
4469
  now: options.now ?? Date.now
4445
4470
  };
4446
4471
  }
4447
4472
  /**
4448
4473
  * Queue one beacon. With a `collapseKey`, a repeat inside the window is
4449
- * merged into a held aggregate (sent when the window closes) instead of
4450
- * becoming its own item.
4474
+ * merged into this key's item while that item is still queued (not yet in
4475
+ * flight). Once it has left, the repeat becomes a new item, sendable on
4476
+ * this flush — nothing waits for a later invocation (round 27.6).
4451
4477
  */
4452
4478
  enqueue(dest, item, collapseKey) {
4453
4479
  const now = this.opts.now();
@@ -4460,12 +4486,15 @@ var BeaconBuffer = class {
4460
4486
  return;
4461
4487
  }
4462
4488
  }
4463
- const held = this.push(
4464
- dest,
4465
- { ...item, repeatCount: 1 },
4466
- entry.firstSeenAt + this.opts.collapseWindowMs
4467
- );
4468
- entry.held = held;
4489
+ if (this.opts.holdRepeats) {
4490
+ entry.held = this.push(
4491
+ dest,
4492
+ { ...item, repeatCount: 1 },
4493
+ entry.firstSeenAt + this.opts.collapseWindowMs
4494
+ );
4495
+ return;
4496
+ }
4497
+ entry.first = this.push(dest, { ...item, repeatCount: 1 }, now);
4469
4498
  return;
4470
4499
  }
4471
4500
  this.collapse.delete(collapseKey);
@@ -4501,6 +4530,7 @@ var BeaconBuffer = class {
4501
4530
  droppedSinceLast: this.droppedSinceLast,
4502
4531
  droppedTotal: this.droppedTotal,
4503
4532
  deliveredTotal: this.deliveredTotal,
4533
+ enqueuedTotal: this.enqueuedTotal,
4504
4534
  flushing: this.inFlight !== void 0
4505
4535
  };
4506
4536
  }
@@ -4515,6 +4545,7 @@ var BeaconBuffer = class {
4515
4545
  inFlight: false
4516
4546
  };
4517
4547
  this.queue.push(entry);
4548
+ this.enqueuedTotal += 1;
4518
4549
  return entry;
4519
4550
  }
4520
4551
  dropOldest() {
@@ -4560,7 +4591,11 @@ var BeaconBuffer = class {
4560
4591
  droppedSinceLast: reportedDropped,
4561
4592
  queueDepth: this.queue.length,
4562
4593
  adapter: dest.adapter ?? "edge-core",
4563
- version: SDK_VERSION
4594
+ version: SDK_VERSION,
4595
+ containerId: this.opts.containerId,
4596
+ enqueuedTotal: this.enqueuedTotal,
4597
+ deliveredTotal: this.deliveredTotal,
4598
+ droppedTotal: this.droppedTotal
4564
4599
  };
4565
4600
  const controller = typeof AbortController !== "undefined" ? new AbortController() : void 0;
4566
4601
  const response = await withBudget(
@@ -4685,6 +4720,33 @@ var import_node_crypto4 = require("crypto");
4685
4720
  // src/transport/registry/visa.ts
4686
4721
  var import_jose = require("jose");
4687
4722
 
4723
+ // src/ucp/profile.ts
4724
+ var UCP_VERSION = "2026-08-25";
4725
+ var SPEC = `https://ucp.dev/${UCP_VERSION}/specification`;
4726
+ var SCHEMAS = `https://ucp.dev/${UCP_VERSION}/schemas`;
4727
+
4728
+ // src/ucp/signatures.ts
4729
+ var import_http_message_signatures3 = require("http-message-signatures");
4730
+
4731
+ // src/http-signatures/sign.ts
4732
+ var import_http_message_signatures2 = require("http-message-signatures");
4733
+
4734
+ // src/ucp/checkout-kit.ts
4735
+ var import_jose3 = require("jose");
4736
+
4737
+ // src/mandates/sd-jwt.ts
4738
+ var import_jose2 = require("jose");
4739
+
4740
+ // src/idempotency/index.ts
4741
+ var DEFAULT_IDEMPOTENCY_TTL_MS = 24 * 60 * 60 * 1e3;
4742
+
4743
+ // src/payments/kyapay.ts
4744
+ var import_jose4 = require("jose");
4745
+
4746
+ // src/aep/core.ts
4747
+ var ED25519_PKCS8_PREFIX = Buffer.from("302e020100300506032b657004220420", "hex");
4748
+ var ED25519_SPKI_PREFIX = Buffer.from("302a300506032b6570032100", "hex");
4749
+
4688
4750
  // src/gateway/modes/online.ts
4689
4751
  function toGatewayConfig(config) {
4690
4752
  return {
@@ -5675,7 +5737,7 @@ async function sendHeartbeat(enrolment, request, timeoutMs = 1500) {
5675
5737
 
5676
5738
  // src/fleet/policy-verify.ts
5677
5739
  var import_crypto = require("crypto");
5678
- var import_jose2 = require("jose");
5740
+ var import_jose5 = require("jose");
5679
5741
 
5680
5742
  // src/fleet/types.ts
5681
5743
  var FLEET_POLICY_TYP = "fleet-policy+jwt";
@@ -5724,8 +5786,8 @@ async function verifyFleetPolicy(jws, jwks, options) {
5724
5786
  let payloadBytes;
5725
5787
  let header;
5726
5788
  try {
5727
- const keySet = (0, import_jose2.createLocalJWKSet)(jwks);
5728
- const result = await (0, import_jose2.compactVerify)(jws, keySet, { algorithms: ["ES256"] });
5789
+ const keySet = (0, import_jose5.createLocalJWKSet)(jwks);
5790
+ const result = await (0, import_jose5.compactVerify)(jws, keySet, { algorithms: ["ES256"] });
5729
5791
  payloadBytes = result.payload;
5730
5792
  header = result.protectedHeader;
5731
5793
  } catch (err) {
@@ -5771,9 +5833,9 @@ async function resolveFleetJwks(pinned, chain, ownerId) {
5771
5833
  let lastSeq = 0;
5772
5834
  for (const link of chain) {
5773
5835
  try {
5774
- const { payload, protectedHeader } = await (0, import_jose2.compactVerify)(
5836
+ const { payload, protectedHeader } = await (0, import_jose5.compactVerify)(
5775
5837
  link,
5776
- (0, import_jose2.createLocalJWKSet)(trusted),
5838
+ (0, import_jose5.createLocalJWKSet)(trusted),
5777
5839
  { algorithms: ["ES256"] }
5778
5840
  );
5779
5841
  if (protectedHeader.typ !== FLEET_KEYS_TYP) continue;
@@ -3751,7 +3751,7 @@ function getTrustLevel(score) {
3751
3751
  }
3752
3752
 
3753
3753
  // src/version.ts
3754
- var SDK_VERSION = "5.13.0";
3754
+ var SDK_VERSION = "5.15.0";
3755
3755
 
3756
3756
  // src/http.ts
3757
3757
  var SDK_USER_AGENT = `astrasync-sdk/${SDK_VERSION}`;
@@ -4070,6 +4070,7 @@ async function callVerifyAccessAPI(config, request) {
4070
4070
  if (requestData.invocationProtocol) body.invocationProtocol = requestData.invocationProtocol;
4071
4071
  if (requestData.commercePhase) body.commercePhase = requestData.commercePhase;
4072
4072
  if (requestData.checkoutSessionId) body.checkoutSessionId = requestData.checkoutSessionId;
4073
+ if (requestData.checkoutJwt) body.checkoutJwt = requestData.checkoutJwt;
4073
4074
  if (requestData.checkoutItems) body.checkoutItems = requestData.checkoutItems;
4074
4075
  if (requestData.buyerEmail) body.buyerEmail = requestData.buyerEmail;
4075
4076
  if (requestData.commerceArtifacts) body.commerceArtifacts = requestData.commerceArtifacts;
@@ -4220,7 +4221,8 @@ async function verify(config, request, options) {
4220
4221
  "[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."
4221
4222
  );
4222
4223
  }
4223
- if (mergedConfig.cacheTtl !== 0 && !options?.bypassCache) {
4224
+ const uncacheable = Boolean(request.commerceArtifacts);
4225
+ if (mergedConfig.cacheTtl !== 0 && !options?.bypassCache && !uncacheable) {
4224
4226
  const cached = getCachedResult(request, mergedConfig.counterpartyId);
4225
4227
  if (cached) {
4226
4228
  if (mergedConfig.debug) {
@@ -4301,7 +4303,10 @@ async function verify(config, request, options) {
4301
4303
  // MERCHANT caller only (bridge callers strip it before the agent plane).
4302
4304
  settlementToken: apiResponse.settlementToken,
4303
4305
  // 5.6.0: fulfilment contact — merchant-only lane, same strip rule.
4304
- fulfilment: apiResponse.fulfilment
4306
+ fulfilment: apiResponse.fulfilment,
4307
+ mandates: apiResponse.mandates,
4308
+ kyaToken: apiResponse.kyaToken,
4309
+ aep: apiResponse.aep
4305
4310
  };
4306
4311
  return result2;
4307
4312
  }
@@ -4311,7 +4316,10 @@ async function verify(config, request, options) {
4311
4316
  trustScore: apiResponse.agent.trustScore,
4312
4317
  trustLevel: getTrustLevel(apiResponse.agent.trustScore),
4313
4318
  blockchainAnchored: apiResponse.agent.blockchainStatus === "anchored",
4314
- status: apiResponse.agent.agentStatus
4319
+ status: apiResponse.agent.agentStatus,
4320
+ ...apiResponse.agent.protocolIdentities && {
4321
+ protocolIdentities: apiResponse.agent.protocolIdentities
4322
+ }
4315
4323
  } : void 0;
4316
4324
  const developer = apiResponse.developer ? {
4317
4325
  astradId: apiResponse.developer.kyaOwnerId,
@@ -4362,7 +4370,11 @@ async function verify(config, request, options) {
4362
4370
  settlementOutcome: apiResponse.settlementOutcome,
4363
4371
  settlementToken: apiResponse.settlementToken,
4364
4372
  // 5.6.0: fulfilment contact — merchant-only lane, same strip rule.
4365
- fulfilment: apiResponse.fulfilment
4373
+ fulfilment: apiResponse.fulfilment,
4374
+ // 5.15.0: merchant-lane AP2 mandates + KYAPay identity token.
4375
+ mandates: apiResponse.mandates,
4376
+ kyaToken: apiResponse.kyaToken,
4377
+ aep: apiResponse.aep
4366
4378
  };
4367
4379
  if (result.recommendation === "deny") {
4368
4380
  result.policyAllowed = false;
@@ -4382,7 +4394,9 @@ async function verify(config, request, options) {
4382
4394
  }
4383
4395
  const escalates = result.requiresStepUp === true || result.requiresApproval === true || result.recommendation === "step_up_required";
4384
4396
  if (mergedConfig.cacheTtl !== 0 && result.recommendation !== "deny" && !escalates) {
4385
- cacheResult(request, result, mergedConfig.cacheTtl, mergedConfig.counterpartyId);
4397
+ if (!uncacheable) {
4398
+ cacheResult(request, result, mergedConfig.cacheTtl, mergedConfig.counterpartyId);
4399
+ }
4386
4400
  }
4387
4401
  return result;
4388
4402
  }
@@ -4393,6 +4407,9 @@ var FALLBACK_MAX_WAIT_MS = 5 * 60 * 1e3;
4393
4407
  // src/metadata-capture.ts
4394
4408
  var MAX_TOTAL_BYTES = 16 * 1024;
4395
4409
 
4410
+ // src/adapters/commerce-detect.ts
4411
+ var MAX_BODY_BYTES = 64 * 1024;
4412
+
4396
4413
  // src/edge-config.ts
4397
4414
  var DEFAULT_EDGE_CONFIG = Object.freeze({
4398
4415
  version: 1,
@@ -4421,6 +4438,11 @@ async function withBudget(promise, ms) {
4421
4438
  if (timer) clearTimeout(timer);
4422
4439
  }
4423
4440
  }
4441
+ var CONTAINER_ID = (() => {
4442
+ const c = globalThis.crypto;
4443
+ if (c?.randomUUID) return c.randomUUID();
4444
+ return `c-${Date.now().toString(36)}-${Math.random().toString(36).slice(2, 12)}`;
4445
+ })();
4424
4446
  var destKeyOf = (d) => `${d.apiBaseUrl}\0${d.apiKey ?? ""}\0${d.counterparty}\0${d.adapter ?? ""}`;
4425
4447
  var BeaconBuffer = class {
4426
4448
  constructor(options = {}) {
@@ -4428,6 +4450,7 @@ var BeaconBuffer = class {
4428
4450
  this.droppedSinceLast = 0;
4429
4451
  this.droppedTotal = 0;
4430
4452
  this.deliveredTotal = 0;
4453
+ this.enqueuedTotal = 0;
4431
4454
  this.backoffUntil = 0;
4432
4455
  this.collapse = /* @__PURE__ */ new Map();
4433
4456
  /** Keys the backend answered 401 for — later batches go unauthenticated. */
@@ -4440,13 +4463,16 @@ var BeaconBuffer = class {
4440
4463
  collapseMaxKeys: options.collapseMaxKeys ?? 1e3,
4441
4464
  requestTimeoutMs: options.requestTimeoutMs ?? 1e4,
4442
4465
  retryBackoffMs: options.retryBackoffMs ?? 1e3,
4466
+ holdRepeats: options.holdRepeats ?? false,
4467
+ containerId: options.containerId ?? CONTAINER_ID,
4443
4468
  now: options.now ?? Date.now
4444
4469
  };
4445
4470
  }
4446
4471
  /**
4447
4472
  * Queue one beacon. With a `collapseKey`, a repeat inside the window is
4448
- * merged into a held aggregate (sent when the window closes) instead of
4449
- * becoming its own item.
4473
+ * merged into this key's item while that item is still queued (not yet in
4474
+ * flight). Once it has left, the repeat becomes a new item, sendable on
4475
+ * this flush — nothing waits for a later invocation (round 27.6).
4450
4476
  */
4451
4477
  enqueue(dest, item, collapseKey) {
4452
4478
  const now = this.opts.now();
@@ -4459,12 +4485,15 @@ var BeaconBuffer = class {
4459
4485
  return;
4460
4486
  }
4461
4487
  }
4462
- const held = this.push(
4463
- dest,
4464
- { ...item, repeatCount: 1 },
4465
- entry.firstSeenAt + this.opts.collapseWindowMs
4466
- );
4467
- entry.held = held;
4488
+ if (this.opts.holdRepeats) {
4489
+ entry.held = this.push(
4490
+ dest,
4491
+ { ...item, repeatCount: 1 },
4492
+ entry.firstSeenAt + this.opts.collapseWindowMs
4493
+ );
4494
+ return;
4495
+ }
4496
+ entry.first = this.push(dest, { ...item, repeatCount: 1 }, now);
4468
4497
  return;
4469
4498
  }
4470
4499
  this.collapse.delete(collapseKey);
@@ -4500,6 +4529,7 @@ var BeaconBuffer = class {
4500
4529
  droppedSinceLast: this.droppedSinceLast,
4501
4530
  droppedTotal: this.droppedTotal,
4502
4531
  deliveredTotal: this.deliveredTotal,
4532
+ enqueuedTotal: this.enqueuedTotal,
4503
4533
  flushing: this.inFlight !== void 0
4504
4534
  };
4505
4535
  }
@@ -4514,6 +4544,7 @@ var BeaconBuffer = class {
4514
4544
  inFlight: false
4515
4545
  };
4516
4546
  this.queue.push(entry);
4547
+ this.enqueuedTotal += 1;
4517
4548
  return entry;
4518
4549
  }
4519
4550
  dropOldest() {
@@ -4559,7 +4590,11 @@ var BeaconBuffer = class {
4559
4590
  droppedSinceLast: reportedDropped,
4560
4591
  queueDepth: this.queue.length,
4561
4592
  adapter: dest.adapter ?? "edge-core",
4562
- version: SDK_VERSION
4593
+ version: SDK_VERSION,
4594
+ containerId: this.opts.containerId,
4595
+ enqueuedTotal: this.enqueuedTotal,
4596
+ deliveredTotal: this.deliveredTotal,
4597
+ droppedTotal: this.droppedTotal
4563
4598
  };
4564
4599
  const controller = typeof AbortController !== "undefined" ? new AbortController() : void 0;
4565
4600
  const response = await withBudget(
@@ -4684,6 +4719,33 @@ var import_node_crypto4 = require("crypto");
4684
4719
  // src/transport/registry/visa.ts
4685
4720
  var import_jose = require("jose");
4686
4721
 
4722
+ // src/ucp/profile.ts
4723
+ var UCP_VERSION = "2026-08-25";
4724
+ var SPEC = `https://ucp.dev/${UCP_VERSION}/specification`;
4725
+ var SCHEMAS = `https://ucp.dev/${UCP_VERSION}/schemas`;
4726
+
4727
+ // src/ucp/signatures.ts
4728
+ var import_http_message_signatures3 = require("http-message-signatures");
4729
+
4730
+ // src/http-signatures/sign.ts
4731
+ var import_http_message_signatures2 = require("http-message-signatures");
4732
+
4733
+ // src/ucp/checkout-kit.ts
4734
+ var import_jose3 = require("jose");
4735
+
4736
+ // src/mandates/sd-jwt.ts
4737
+ var import_jose2 = require("jose");
4738
+
4739
+ // src/idempotency/index.ts
4740
+ var DEFAULT_IDEMPOTENCY_TTL_MS = 24 * 60 * 60 * 1e3;
4741
+
4742
+ // src/payments/kyapay.ts
4743
+ var import_jose4 = require("jose");
4744
+
4745
+ // src/aep/core.ts
4746
+ var ED25519_PKCS8_PREFIX = Buffer.from("302e020100300506032b657004220420", "hex");
4747
+ var ED25519_SPKI_PREFIX = Buffer.from("302a300506032b6570032100", "hex");
4748
+
4687
4749
  // src/gateway/modes/online.ts
4688
4750
  function toGatewayConfig(config) {
4689
4751
  return {
@@ -5421,7 +5483,7 @@ async function sendHeartbeat(enrolment, request, timeoutMs = 1500) {
5421
5483
 
5422
5484
  // src/fleet/policy-verify.ts
5423
5485
  var import_crypto = require("crypto");
5424
- var import_jose2 = require("jose");
5486
+ var import_jose5 = require("jose");
5425
5487
 
5426
5488
  // src/fleet/types.ts
5427
5489
  var FLEET_POLICY_TYP = "fleet-policy+jwt";
@@ -5470,8 +5532,8 @@ async function verifyFleetPolicy(jws, jwks, options) {
5470
5532
  let payloadBytes;
5471
5533
  let header;
5472
5534
  try {
5473
- const keySet = (0, import_jose2.createLocalJWKSet)(jwks);
5474
- const result = await (0, import_jose2.compactVerify)(jws, keySet, { algorithms: ["ES256"] });
5535
+ const keySet = (0, import_jose5.createLocalJWKSet)(jwks);
5536
+ const result = await (0, import_jose5.compactVerify)(jws, keySet, { algorithms: ["ES256"] });
5475
5537
  payloadBytes = result.payload;
5476
5538
  header = result.protectedHeader;
5477
5539
  } catch (err) {
@@ -5517,9 +5579,9 @@ async function resolveFleetJwks(pinned, chain, ownerId) {
5517
5579
  let lastSeq = 0;
5518
5580
  for (const link of chain) {
5519
5581
  try {
5520
- const { payload, protectedHeader } = await (0, import_jose2.compactVerify)(
5582
+ const { payload, protectedHeader } = await (0, import_jose5.compactVerify)(
5521
5583
  link,
5522
- (0, import_jose2.createLocalJWKSet)(trusted),
5584
+ (0, import_jose5.createLocalJWKSet)(trusted),
5523
5585
  { algorithms: ["ES256"] }
5524
5586
  );
5525
5587
  if (protectedHeader.typ !== FLEET_KEYS_TYP) continue;