@astrasyncai/verification-gateway 5.22.0 → 5.22.1

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 (72) hide show
  1. package/CHANGELOG.md +11 -0
  2. package/dist/adapters/express.js +1 -1
  3. package/dist/adapters/express.js.map +1 -1
  4. package/dist/adapters/express.mjs +1 -1
  5. package/dist/adapters/express.mjs.map +1 -1
  6. package/dist/adapters/mcp.js +1 -1
  7. package/dist/adapters/mcp.js.map +1 -1
  8. package/dist/adapters/mcp.mjs +1 -1
  9. package/dist/adapters/mcp.mjs.map +1 -1
  10. package/dist/adapters/nextjs.js +1 -1
  11. package/dist/adapters/nextjs.js.map +1 -1
  12. package/dist/adapters/nextjs.mjs +1 -1
  13. package/dist/adapters/nextjs.mjs.map +1 -1
  14. package/dist/adapters/sdk.js +1 -1
  15. package/dist/adapters/sdk.js.map +1 -1
  16. package/dist/adapters/sdk.mjs +1 -1
  17. package/dist/adapters/sdk.mjs.map +1 -1
  18. package/dist/agent/index.js +1 -1
  19. package/dist/agent/index.js.map +1 -1
  20. package/dist/agent/index.mjs +1 -1
  21. package/dist/agent/index.mjs.map +1 -1
  22. package/dist/bin/astrasync-claude-hook.js +1 -1
  23. package/dist/bin/astrasync-codex-hook.js +1 -1
  24. package/dist/bin/astrasync-guard.js +1 -1
  25. package/dist/bin/astrasync.js +1 -1
  26. package/dist/browser/background.js +1 -1
  27. package/dist/browser/background.js.map +1 -1
  28. package/dist/browser/background.mjs +1 -1
  29. package/dist/browser/background.mjs.map +1 -1
  30. package/dist/cli/index.js +1 -1
  31. package/dist/cli/index.js.map +1 -1
  32. package/dist/cli/index.mjs +1 -1
  33. package/dist/cli/index.mjs.map +1 -1
  34. package/dist/codex/index.js +1 -1
  35. package/dist/codex/index.js.map +1 -1
  36. package/dist/codex/index.mjs +1 -1
  37. package/dist/codex/index.mjs.map +1 -1
  38. package/dist/cursor/extension.js +1 -1
  39. package/dist/cursor/extension.js.map +1 -1
  40. package/dist/cursor/extension.mjs +1 -1
  41. package/dist/cursor/extension.mjs.map +1 -1
  42. package/dist/edge-config.js +1 -1
  43. package/dist/edge-config.js.map +1 -1
  44. package/dist/edge-config.mjs +1 -1
  45. package/dist/edge-config.mjs.map +1 -1
  46. package/dist/edge-core/index.js +1 -1
  47. package/dist/edge-core/index.js.map +1 -1
  48. package/dist/edge-core/index.mjs +1 -1
  49. package/dist/edge-core/index.mjs.map +1 -1
  50. package/dist/gateway/gateway.js +1 -1
  51. package/dist/gateway/gateway.js.map +1 -1
  52. package/dist/gateway/gateway.mjs +1 -1
  53. package/dist/gateway/gateway.mjs.map +1 -1
  54. package/dist/index.d.mts +26 -3
  55. package/dist/index.d.ts +26 -3
  56. package/dist/index.js +12 -4
  57. package/dist/index.js.map +1 -1
  58. package/dist/index.mjs +12 -4
  59. package/dist/index.mjs.map +1 -1
  60. package/dist/registration/index.js +1 -1
  61. package/dist/registration/index.js.map +1 -1
  62. package/dist/registration/index.mjs +1 -1
  63. package/dist/registration/index.mjs.map +1 -1
  64. package/dist/transport/index.js +1 -1
  65. package/dist/transport/index.js.map +1 -1
  66. package/dist/transport/index.mjs +1 -1
  67. package/dist/transport/index.mjs.map +1 -1
  68. package/dist/verify.js +1 -1
  69. package/dist/verify.js.map +1 -1
  70. package/dist/verify.mjs +1 -1
  71. package/dist/verify.mjs.map +1 -1
  72. package/package.json +1 -1
package/dist/index.d.mts CHANGED
@@ -5487,7 +5487,7 @@ declare function detectRuntime(userAgent: string | undefined | null): string | u
5487
5487
  * silently (never throwing), so this is a no-op there — which is correct:
5488
5488
  * in a browser the page's real UA is the honest identity.
5489
5489
  */
5490
- declare const SDK_USER_AGENT = "astrasync-sdk/5.22.0";
5490
+ declare const SDK_USER_AGENT = "astrasync-sdk/5.22.1";
5491
5491
  declare const sdkFetch: typeof fetch;
5492
5492
 
5493
5493
  interface LocalPolicy {
@@ -5605,7 +5605,7 @@ declare function parseYaml(yamlContent: string): ParseResult;
5605
5605
  * is fine — bumping both in the release-ceremony commit keeps them
5606
5606
  * lockstep.
5607
5607
  */
5608
- declare const SDK_VERSION = "5.22.0";
5608
+ declare const SDK_VERSION = "5.22.1";
5609
5609
 
5610
5610
  /**
5611
5611
  * 5.15.0 — the `UCP-Agent` request header (UCP 2026-08-25): an RFC 8941
@@ -5947,9 +5947,32 @@ interface CreateAgentCommerceOptions {
5947
5947
  fetch?: typeof fetch;
5948
5948
  }
5949
5949
  declare function createAgentCommerce(opts: CreateAgentCommerceOptions): AgentCommerce;
5950
- /** The pricing context of an inbound agent request (headers from the AstraSync bridge). */
5950
+ /**
5951
+ * The pricing context of an inbound agent request (headers from the AstraSync
5952
+ * bridge).
5953
+ *
5954
+ * `verified` is PROVISIONAL: it decides what an agent is shown (member and
5955
+ * cardholder prices), not what it may buy. A bare `x-astra-id` counts so a
5956
+ * merchant's catalogue and its checkout kit price alike; the purchase itself
5957
+ * is verified at confirm (verify-access), and AstraSync refuses a
5958
+ * cardholder-priced checkout for anyone who isn't that programme's verified
5959
+ * cardholder (`issuer_offer_not_eligible`). A bridge request's
5960
+ * `X-Astra-Verified-Hop` marker must match the id and be fresh.
5961
+ *
5962
+ * Opt-in strict (5.22.1): pass the result of your own verification (e.g.
5963
+ * `req.agentVerification` from the Express/Next adapters). A result that
5964
+ * isn't identity-verified, or names a different agent, forces
5965
+ * `verified: false`.
5966
+ */
5951
5967
  declare function pricingContextFrom(headers: {
5952
5968
  get(name: string): string | null;
5969
+ }, opts?: {
5970
+ verification?: {
5971
+ identityVerified: boolean;
5972
+ agent?: {
5973
+ astraId?: string | null;
5974
+ } | null;
5975
+ } | null;
5953
5976
  }): PricingContext;
5954
5977
  interface AgentProduct {
5955
5978
  sku: string;
package/dist/index.d.ts CHANGED
@@ -5487,7 +5487,7 @@ declare function detectRuntime(userAgent: string | undefined | null): string | u
5487
5487
  * silently (never throwing), so this is a no-op there — which is correct:
5488
5488
  * in a browser the page's real UA is the honest identity.
5489
5489
  */
5490
- declare const SDK_USER_AGENT = "astrasync-sdk/5.22.0";
5490
+ declare const SDK_USER_AGENT = "astrasync-sdk/5.22.1";
5491
5491
  declare const sdkFetch: typeof fetch;
5492
5492
 
5493
5493
  interface LocalPolicy {
@@ -5605,7 +5605,7 @@ declare function parseYaml(yamlContent: string): ParseResult;
5605
5605
  * is fine — bumping both in the release-ceremony commit keeps them
5606
5606
  * lockstep.
5607
5607
  */
5608
- declare const SDK_VERSION = "5.22.0";
5608
+ declare const SDK_VERSION = "5.22.1";
5609
5609
 
5610
5610
  /**
5611
5611
  * 5.15.0 — the `UCP-Agent` request header (UCP 2026-08-25): an RFC 8941
@@ -5947,9 +5947,32 @@ interface CreateAgentCommerceOptions {
5947
5947
  fetch?: typeof fetch;
5948
5948
  }
5949
5949
  declare function createAgentCommerce(opts: CreateAgentCommerceOptions): AgentCommerce;
5950
- /** The pricing context of an inbound agent request (headers from the AstraSync bridge). */
5950
+ /**
5951
+ * The pricing context of an inbound agent request (headers from the AstraSync
5952
+ * bridge).
5953
+ *
5954
+ * `verified` is PROVISIONAL: it decides what an agent is shown (member and
5955
+ * cardholder prices), not what it may buy. A bare `x-astra-id` counts so a
5956
+ * merchant's catalogue and its checkout kit price alike; the purchase itself
5957
+ * is verified at confirm (verify-access), and AstraSync refuses a
5958
+ * cardholder-priced checkout for anyone who isn't that programme's verified
5959
+ * cardholder (`issuer_offer_not_eligible`). A bridge request's
5960
+ * `X-Astra-Verified-Hop` marker must match the id and be fresh.
5961
+ *
5962
+ * Opt-in strict (5.22.1): pass the result of your own verification (e.g.
5963
+ * `req.agentVerification` from the Express/Next adapters). A result that
5964
+ * isn't identity-verified, or names a different agent, forces
5965
+ * `verified: false`.
5966
+ */
5951
5967
  declare function pricingContextFrom(headers: {
5952
5968
  get(name: string): string | null;
5969
+ }, opts?: {
5970
+ verification?: {
5971
+ identityVerified: boolean;
5972
+ agent?: {
5973
+ astraId?: string | null;
5974
+ } | null;
5975
+ } | null;
5953
5976
  }): PricingContext;
5954
5977
  interface AgentProduct {
5955
5978
  sku: string;
package/dist/index.js CHANGED
@@ -229,7 +229,7 @@ function getTrustLevel(score) {
229
229
  }
230
230
 
231
231
  // src/version.ts
232
- var SDK_VERSION = "5.22.0";
232
+ var SDK_VERSION = "5.22.1";
233
233
 
234
234
  // src/http.ts
235
235
  var SDK_USER_AGENT = `astrasync-sdk/${SDK_VERSION}`;
@@ -11812,7 +11812,11 @@ function createAgentCommerce(opts) {
11812
11812
  const headers = {
11813
11813
  Accept: "application/json",
11814
11814
  Authorization: `Bearer ${opts.apiKey}`,
11815
- "X-AstraSync-SDK-Version": SDK_VERSION
11815
+ "X-AstraSync-SDK-Version": SDK_VERSION,
11816
+ // 5.22.1: identifies the agent-commerce kit, so only a kit fetching
11817
+ // its rules marks the merchant as applying them (cardholder prices
11818
+ // are then shown to agents). A curl or another client never does.
11819
+ "X-AstraSync-Kit": "agent-commerce"
11816
11820
  };
11817
11821
  if (kitReport) {
11818
11822
  headers["X-AstraSync-Kit-Report"] = Buffer.from(JSON.stringify(kitReport)).toString(
@@ -11849,10 +11853,14 @@ function createAgentCommerce(opts) {
11849
11853
  }
11850
11854
  };
11851
11855
  }
11852
- function pricingContextFrom(headers) {
11856
+ function pricingContextFrom(headers, opts = {}) {
11853
11857
  const astraId = headers.get("x-astra-id");
11854
11858
  const hop = parseVerifiedHop(headers.get(MCP_VERIFIED_HOP_HEADER.toLowerCase()));
11855
- const verified = !!astraId && (!hop || hop.astraId === astraId && Date.now() - hop.checkedAt <= MCP_VERIFIED_HOP_MAX_AGE_MS);
11859
+ let verified = !!astraId && (!hop || hop.astraId === astraId && Date.now() - hop.checkedAt <= MCP_VERIFIED_HOP_MAX_AGE_MS);
11860
+ const v = opts.verification;
11861
+ if (verified && v) {
11862
+ verified = v.identityVerified === true && (!v.agent?.astraId || v.agent.astraId === astraId);
11863
+ }
11856
11864
  const program = headers.get(ISSUER_PROGRAM_HEADER.toLowerCase());
11857
11865
  return {
11858
11866
  verified,