@astrasyncai/verification-gateway 5.7.0 → 5.9.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 (106) hide show
  1. package/README.md +37 -1
  2. package/dist/adapters/express.d.mts +1 -1
  3. package/dist/adapters/express.d.ts +1 -1
  4. package/dist/adapters/express.js +41 -7
  5. package/dist/adapters/express.js.map +1 -1
  6. package/dist/adapters/express.mjs +41 -7
  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 +2 -2
  11. package/dist/adapters/mcp.js.map +1 -1
  12. package/dist/adapters/mcp.mjs +2 -2
  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 +41 -7
  17. package/dist/adapters/nextjs.js.map +1 -1
  18. package/dist/adapters/nextjs.mjs +41 -7
  19. package/dist/adapters/nextjs.mjs.map +1 -1
  20. package/dist/adapters/sdk.d.mts +1 -1
  21. package/dist/adapters/sdk.d.ts +1 -1
  22. package/dist/adapters/sdk.js +2 -2
  23. package/dist/adapters/sdk.js.map +1 -1
  24. package/dist/adapters/sdk.mjs +2 -2
  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 +14 -6
  31. package/dist/bin/astrasync-codex-hook.js +14 -6
  32. package/dist/bin/astrasync-guard.js +14 -6
  33. package/dist/bin/astrasync.js +15 -6
  34. package/dist/browser/background.js +14 -6
  35. package/dist/browser/background.js.map +1 -1
  36. package/dist/browser/background.mjs +14 -6
  37. package/dist/browser/background.mjs.map +1 -1
  38. package/dist/cli/index.js +12 -4
  39. package/dist/cli/index.js.map +1 -1
  40. package/dist/cli/index.mjs +12 -4
  41. package/dist/cli/index.mjs.map +1 -1
  42. package/dist/codex/index.js +14 -6
  43. package/dist/codex/index.js.map +1 -1
  44. package/dist/codex/index.mjs +14 -6
  45. package/dist/codex/index.mjs.map +1 -1
  46. package/dist/cursor/extension.js +14 -6
  47. package/dist/cursor/extension.js.map +1 -1
  48. package/dist/cursor/extension.mjs +14 -6
  49. package/dist/cursor/extension.mjs.map +1 -1
  50. package/dist/edge-config.d.mts +24 -1
  51. package/dist/edge-config.d.ts +24 -1
  52. package/dist/edge-config.js +13 -5
  53. package/dist/edge-config.js.map +1 -1
  54. package/dist/edge-config.mjs +13 -5
  55. package/dist/edge-config.mjs.map +1 -1
  56. package/dist/edge-core/index.d.mts +14 -6
  57. package/dist/edge-core/index.d.ts +14 -6
  58. package/dist/edge-core/index.js +110 -16
  59. package/dist/edge-core/index.js.map +1 -1
  60. package/dist/edge-core/index.mjs +110 -16
  61. package/dist/edge-core/index.mjs.map +1 -1
  62. package/dist/gateway/gateway.js +14 -6
  63. package/dist/gateway/gateway.js.map +1 -1
  64. package/dist/gateway/gateway.mjs +14 -6
  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 +80 -6
  69. package/dist/index.d.ts +80 -6
  70. package/dist/index.js +54 -7
  71. package/dist/index.js.map +1 -1
  72. package/dist/index.mjs +52 -7
  73. package/dist/index.mjs.map +1 -1
  74. package/dist/metadata-capture.d.mts +18 -1
  75. package/dist/metadata-capture.d.ts +18 -1
  76. package/dist/metadata-capture.js +10 -0
  77. package/dist/metadata-capture.js.map +1 -1
  78. package/dist/metadata-capture.mjs +8 -0
  79. package/dist/metadata-capture.mjs.map +1 -1
  80. package/dist/platform-signatures.d.mts +1 -1
  81. package/dist/platform-signatures.d.ts +1 -1
  82. package/dist/platform-signatures.js +24 -1
  83. package/dist/platform-signatures.js.map +1 -1
  84. package/dist/platform-signatures.mjs +24 -1
  85. package/dist/platform-signatures.mjs.map +1 -1
  86. package/dist/registration/index.js +1 -1
  87. package/dist/registration/index.js.map +1 -1
  88. package/dist/registration/index.mjs +1 -1
  89. package/dist/registration/index.mjs.map +1 -1
  90. package/dist/transport/index.js +1 -1
  91. package/dist/transport/index.js.map +1 -1
  92. package/dist/transport/index.mjs +1 -1
  93. package/dist/transport/index.mjs.map +1 -1
  94. package/dist/{types-BK_pRNSs.d.mts → types-CTmUpNpS.d.mts} +25 -2
  95. package/dist/{types-BK_pRNSs.d.ts → types-CTmUpNpS.d.ts} +25 -2
  96. package/dist/{types-CwY5IY-0.d.ts → types-CtFXmDzm.d.ts} +17 -2
  97. package/dist/{types-BCmHFdkJ.d.mts → types-DQrn_kei.d.mts} +17 -2
  98. package/dist/ui/index.d.mts +1 -1
  99. package/dist/ui/index.d.ts +1 -1
  100. package/dist/verify.d.mts +13 -1
  101. package/dist/verify.d.ts +13 -1
  102. package/dist/verify.js +2 -2
  103. package/dist/verify.js.map +1 -1
  104. package/dist/verify.mjs +2 -2
  105. package/dist/verify.mjs.map +1 -1
  106. package/package.json +3 -3
package/README.md CHANGED
@@ -407,7 +407,7 @@ interface VerificationResult {
407
407
  name: string;
408
408
  trustScore: number;
409
409
  trustLevel: 'BRONZE' | 'SILVER' | 'GOLD' | 'PLATINUM';
410
- blockchainVerified: boolean;
410
+ blockchainAnchored: boolean;
411
411
  };
412
412
 
413
413
  developer?: {
@@ -474,6 +474,42 @@ interface StepUpApprovalInfo {
474
474
 
475
475
  Poll the `pollUrl` (unauthenticated, rate-limited 60 req/min) to check if the owner approved. The `getApprovalPollingInfo(result)` helper extracts it from a `VerificationResult`.
476
476
 
477
+ ### Attempt chain (`X-Astra-Attempt-Id`, 5.8.0)
478
+
479
+ Every interaction chain carries an attempt id of the form `att_<32 hex>`. The
480
+ AstraSync bridge stamps it on each call it delivers to your endpoint as the
481
+ `X-Astra-Attempt-Id` request header, and the express / Next.js middleware
482
+ automatically read the header and thread the id into verify-access (invalid
483
+ values are dropped). Two effects:
484
+
485
+ - **One intent = one approval.** A step-up the owner already approved for
486
+ this chain passes every later verify-access hop that carries the same
487
+ attempt id (the bridge pre-verify, your middleware's re-verify, and any
488
+ re-drive after a delivery failure) — it is never asked for twice.
489
+ - **Idempotency key.** Key your own idempotency/dedupe on the header value:
490
+ a re-drive of the same chain arrives with the SAME id, so replays of an
491
+ already-executed action can be detected venue-side.
492
+
493
+ No configuration is needed; direct (non-bridge) callers simply don't send the
494
+ header and behaviour is unchanged.
495
+
496
+ ### Bridge-fronted endpoints: hold budgets
497
+
498
+ The bridge delivers your endpoint's response within an HTTP budget of **30 s
499
+ by default (60 s maximum, configurable per route via `responseBudgetMs` in
500
+ your registration's `routes[]`)**. `stepUpMaxWaitMs: 0` (hold in-request
501
+ until the approval decides) is designed for direct integrations and will
502
+ outlive that budget — behind the bridge, either:
503
+
504
+ - leave `stepUpMaxWaitMs` unset and return the 403 with `stepUpApproval`
505
+ in-band (the bridge renders the approval card and re-drives after
506
+ approval), or
507
+ - bound the hold to well under the budget (~20 s) so the deny still reaches
508
+ the bridge in time.
509
+
510
+ Either way the attempt chain above guarantees the post-approval re-drive
511
+ passes without a second approval.
512
+
477
513
  ## Checkout & settlement (astra-pay)
478
514
 
479
515
  The first-party commerce rail: an agent shops under its ASTRA-id, holds NO
@@ -1,5 +1,5 @@
1
1
  import { RequestHandler, Request } from 'express';
2
- import { d as VerificationResult, E as ExpressMiddlewareOptions, a as AstraSyncCredentials } from '../types-BK_pRNSs.mjs';
2
+ import { d as VerificationResult, E as ExpressMiddlewareOptions, a as AstraSyncCredentials } from '../types-CTmUpNpS.mjs';
3
3
 
4
4
  /**
5
5
  * AstraSync Universal Verification Gateway - Express Middleware
@@ -1,5 +1,5 @@
1
1
  import { RequestHandler, Request } from 'express';
2
- import { d as VerificationResult, E as ExpressMiddlewareOptions, a as AstraSyncCredentials } from '../types-BK_pRNSs.js';
2
+ import { d as VerificationResult, E as ExpressMiddlewareOptions, a as AstraSyncCredentials } from '../types-CTmUpNpS.js';
3
3
 
4
4
  /**
5
5
  * AstraSync Universal Verification Gateway - Express Middleware
@@ -26,7 +26,7 @@ __export(express_exports, {
26
26
  module.exports = __toCommonJS(express_exports);
27
27
 
28
28
  // src/version.ts
29
- var SDK_VERSION = "5.7.0";
29
+ var SDK_VERSION = "5.9.0";
30
30
 
31
31
  // src/http.ts
32
32
  var SDK_USER_AGENT = `astrasync-sdk/${SDK_VERSION}`;
@@ -636,7 +636,7 @@ async function verify(config, request, options) {
636
636
  name: apiResponse.agent.name,
637
637
  trustScore: apiResponse.agent.trustScore,
638
638
  trustLevel: getTrustLevel(apiResponse.agent.trustScore),
639
- blockchainVerified: apiResponse.agent.blockchainStatus === "verified",
639
+ blockchainAnchored: apiResponse.agent.blockchainStatus === "anchored",
640
640
  status: apiResponse.agent.agentStatus
641
641
  } : void 0;
642
642
  const developer = apiResponse.developer ? {
@@ -1221,11 +1221,16 @@ var DEFAULT_EDGE_CONFIG = Object.freeze({
1221
1221
  mode: "observe",
1222
1222
  depth: "classify",
1223
1223
  pathRules: [],
1224
- sampling: Object.freeze({ anonymousBeaconRate: 0.1 }),
1224
+ sampling: Object.freeze({ anonymousBeaconRate: 1 }),
1225
1225
  failurePosture: "open"
1226
1226
  });
1227
1227
  var EDGE_MODES = ["observe", "enforce"];
1228
1228
  var EDGE_DEPTHS = ["classify", "authenticate", "authorize"];
1229
+ function isSamplingShape(value) {
1230
+ if (typeof value !== "object" || value === null) return false;
1231
+ const rate = value.anonymousBeaconRate;
1232
+ return typeof rate === "number" && rate >= 0 && rate <= 1;
1233
+ }
1229
1234
  function isEdgeConfig(value) {
1230
1235
  if (typeof value !== "object" || value === null) return false;
1231
1236
  const v = value;
@@ -1239,10 +1244,13 @@ function isEdgeConfig(value) {
1239
1244
  if (typeof r.pattern !== "string" || r.pattern.length === 0) return false;
1240
1245
  if (r.mode !== void 0 && !EDGE_MODES.includes(r.mode)) return false;
1241
1246
  if (r.depth !== void 0 && !EDGE_DEPTHS.includes(r.depth)) return false;
1247
+ if (r.sampling !== void 0 && !isSamplingShape(r.sampling)) return false;
1242
1248
  }
1243
- const sampling = v.sampling;
1244
- if (typeof sampling !== "object" || sampling === null || typeof sampling.anonymousBeaconRate !== "number" || sampling.anonymousBeaconRate < 0 || sampling.anonymousBeaconRate > 1) {
1245
- return false;
1249
+ if (!isSamplingShape(v.sampling)) return false;
1250
+ if (v.queryValueAllowlist !== void 0) {
1251
+ if (!Array.isArray(v.queryValueAllowlist) || v.queryValueAllowlist.length > 16 || !v.queryValueAllowlist.every((e) => typeof e === "string" && e.length > 0 && e.length <= 64)) {
1252
+ return false;
1253
+ }
1246
1254
  }
1247
1255
  return v.failurePosture === "open";
1248
1256
  }
@@ -1344,7 +1352,20 @@ var PLATFORM_AGENT_SIGNATURES = [
1344
1352
  {
1345
1353
  vendor: "gemini",
1346
1354
  displayName: "Google Gemini",
1347
- uaPatterns: [/gemini/i, /google-gemini/i, /bard/i],
1355
+ uaPatterns: [
1356
+ /gemini/i,
1357
+ /google-gemini/i,
1358
+ /bard/i,
1359
+ // Google's AI/agent fetcher tokens (VI uplift 1.3). These are the
1360
+ // AI-training/agent crawlers, NOT the Search crawler — googlebot IP
1361
+ // ranges attribute Search and are deliberately absent from
1362
+ // vendor-ip-ranges. Anchored tokens: none appears in stock browser
1363
+ // UAs, and `-` counts as a \b boundary so GoogleOther-Image/-Video
1364
+ // match too.
1365
+ /\bGoogle-Extended\b/i,
1366
+ /\bGoogleOther\b/i,
1367
+ /\bGoogle-CloudVertexBot\b/i
1368
+ ],
1348
1369
  agentCardPatterns: [/gemini\.google\.com/i, /ai\.google\.dev/i],
1349
1370
  apiKeyFormatPatterns: [/^aiza/i],
1350
1371
  headerPatterns: [/^x-goog-user-project/i, /^x-goog-api-client/i]
@@ -1390,6 +1411,16 @@ var PLATFORM_AGENT_SIGNATURES = [
1390
1411
  uaPatterns: [/\bcomet\/\d/i],
1391
1412
  headerPatterns: [/^sec-ch-ua: .*comet/i]
1392
1413
  },
1414
+ // The MCP bridge's own catalog fetches (VI uplift 1.5). Deliberately a
1415
+ // DISTINCT UA from `astrasync-sdk/`: bridge fetches are buyer-agent
1416
+ // traffic merchants should see (identified · unregistered), so this
1417
+ // vendor is kept OUT of the self-traffic filter and the edge's SELF
1418
+ // short-circuit.
1419
+ {
1420
+ vendor: "astrasync-bridge",
1421
+ displayName: "AstraSync MCP bridge (buyer-agent catalog fetch)",
1422
+ uaPatterns: [/^astrasync-bridge\//i]
1423
+ },
1393
1424
  // Our own SDK self-identifies (sdkFetch stamps this UA) — first-party
1394
1425
  // traffic must never pollute the unknown/anonymous pool it exists to audit.
1395
1426
  {
@@ -1834,6 +1865,8 @@ function createMiddleware(options) {
1834
1865
  }
1835
1866
  }
1836
1867
  }
1868
+ const attemptHeader = req.headers["x-astra-attempt-id"];
1869
+ const inboundAttemptId = typeof attemptHeader === "string" && /^att_[0-9a-f]{32}$/.test(attemptHeader) ? attemptHeader : void 0;
1837
1870
  const verificationRequest = {
1838
1871
  credentials,
1839
1872
  purpose,
@@ -1846,6 +1879,7 @@ function createMiddleware(options) {
1846
1879
  durationRequired: astraCreds?.pdlss?.duration?.maxSessionDuration,
1847
1880
  ...txValue !== void 0 && { transactionValue: txValue },
1848
1881
  ...txCurrency && { currency: txCurrency },
1882
+ ...inboundAttemptId && { attemptId: inboundAttemptId },
1849
1883
  callerMetadata: {
1850
1884
  sourceIp: originalClientIp,
1851
1885
  userAgent: req.headers["user-agent"],