@astrasyncai/verification-gateway 4.5.1 → 5.0.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 (140) hide show
  1. package/README.md +1 -1
  2. package/dist/adapter-interface/interface.d.mts +2 -2
  3. package/dist/adapter-interface/interface.d.ts +2 -2
  4. package/dist/adapters/express.d.mts +2 -2
  5. package/dist/adapters/express.d.ts +2 -2
  6. package/dist/adapters/express.js +11 -33
  7. package/dist/adapters/express.js.map +1 -1
  8. package/dist/adapters/express.mjs +11 -33
  9. package/dist/adapters/express.mjs.map +1 -1
  10. package/dist/adapters/mcp.d.mts +2 -2
  11. package/dist/adapters/mcp.d.ts +2 -2
  12. package/dist/adapters/mcp.js +28 -65
  13. package/dist/adapters/mcp.js.map +1 -1
  14. package/dist/adapters/mcp.mjs +27 -64
  15. package/dist/adapters/mcp.mjs.map +1 -1
  16. package/dist/adapters/nextjs.d.mts +2 -2
  17. package/dist/adapters/nextjs.d.ts +2 -2
  18. package/dist/adapters/nextjs.js +9 -30
  19. package/dist/adapters/nextjs.js.map +1 -1
  20. package/dist/adapters/nextjs.mjs +9 -30
  21. package/dist/adapters/nextjs.mjs.map +1 -1
  22. package/dist/adapters/sdk.d.mts +2 -2
  23. package/dist/adapters/sdk.d.ts +2 -2
  24. package/dist/adapters/sdk.js +8 -124
  25. package/dist/adapters/sdk.js.map +1 -1
  26. package/dist/adapters/sdk.mjs +8 -122
  27. package/dist/adapters/sdk.mjs.map +1 -1
  28. package/dist/agent/index.d.mts +2 -2
  29. package/dist/agent/index.d.ts +2 -2
  30. package/dist/agent/index.js +1 -1
  31. package/dist/agent/index.js.map +1 -1
  32. package/dist/agent/index.mjs +1 -1
  33. package/dist/agent/index.mjs.map +1 -1
  34. package/dist/bin/astrasync-claude-hook.js +63 -41
  35. package/dist/bin/astrasync-codex-hook.js +63 -41
  36. package/dist/bin/astrasync-guard.js +63 -41
  37. package/dist/bin/astrasync.js +75 -48
  38. package/dist/browser/background.js +63 -41
  39. package/dist/browser/background.js.map +1 -1
  40. package/dist/browser/background.mjs +63 -41
  41. package/dist/browser/background.mjs.map +1 -1
  42. package/dist/browser/browser-adapter.d.mts +2 -2
  43. package/dist/browser/browser-adapter.d.ts +2 -2
  44. package/dist/claude-code/claude-code-adapter.d.mts +2 -2
  45. package/dist/claude-code/claude-code-adapter.d.ts +2 -2
  46. package/dist/cli/index.d.mts +2 -2
  47. package/dist/cli/index.d.ts +2 -2
  48. package/dist/cli/index.js +33 -6
  49. package/dist/cli/index.js.map +1 -1
  50. package/dist/cli/index.mjs +33 -6
  51. package/dist/cli/index.mjs.map +1 -1
  52. package/dist/codex/index.d.mts +2 -2
  53. package/dist/codex/index.d.ts +2 -2
  54. package/dist/codex/index.js +63 -41
  55. package/dist/codex/index.js.map +1 -1
  56. package/dist/codex/index.mjs +63 -41
  57. package/dist/codex/index.mjs.map +1 -1
  58. package/dist/cursor/cursor-adapter.d.mts +2 -2
  59. package/dist/cursor/cursor-adapter.d.ts +2 -2
  60. package/dist/cursor/extension.d.mts +2 -2
  61. package/dist/cursor/extension.d.ts +2 -2
  62. package/dist/cursor/extension.js +63 -41
  63. package/dist/cursor/extension.js.map +1 -1
  64. package/dist/cursor/extension.mjs +63 -41
  65. package/dist/cursor/extension.mjs.map +1 -1
  66. package/dist/edge-config.d.mts +1 -1
  67. package/dist/edge-config.d.ts +1 -1
  68. package/dist/edge-config.js +1 -1
  69. package/dist/edge-config.js.map +1 -1
  70. package/dist/edge-config.mjs +1 -1
  71. package/dist/edge-config.mjs.map +1 -1
  72. package/dist/edge-core/index.d.mts +1 -3
  73. package/dist/edge-core/index.d.ts +1 -3
  74. package/dist/edge-core/index.js +11 -33
  75. package/dist/edge-core/index.js.map +1 -1
  76. package/dist/edge-core/index.mjs +11 -33
  77. package/dist/edge-core/index.mjs.map +1 -1
  78. package/dist/{express-DaqL11tx.d.ts → express-B5lWuemA.d.ts} +1 -1
  79. package/dist/{express-CR6F3njD.d.mts → express-Dm-snUuY.d.mts} +1 -1
  80. package/dist/gateway/gateway.d.mts +2 -2
  81. package/dist/gateway/gateway.d.ts +2 -2
  82. package/dist/gateway/gateway.js +63 -41
  83. package/dist/gateway/gateway.js.map +1 -1
  84. package/dist/gateway/gateway.mjs +63 -41
  85. package/dist/gateway/gateway.mjs.map +1 -1
  86. package/dist/git-trigger/git-hooks.d.mts +2 -2
  87. package/dist/git-trigger/git-hooks.d.ts +2 -2
  88. package/dist/{index-Cub7lK-T.d.mts → index-B5k_vUmK.d.mts} +1 -1
  89. package/dist/{index-BfIxCYIZ.d.ts → index-BOzM6xUq.d.mts} +1 -2
  90. package/dist/{index-CwAh7Tln.d.mts → index-dRfxUdFA.d.ts} +1 -2
  91. package/dist/{index-B5Ts1WtM.d.ts → index-y8xToocF.d.ts} +1 -1
  92. package/dist/index.d.mts +10 -10
  93. package/dist/index.d.ts +10 -10
  94. package/dist/index.js +30 -217
  95. package/dist/index.js.map +1 -1
  96. package/dist/index.mjs +30 -210
  97. package/dist/index.mjs.map +1 -1
  98. package/dist/local-evaluator/evaluator.d.mts +2 -2
  99. package/dist/local-evaluator/evaluator.d.ts +2 -2
  100. package/dist/local-evaluator/evaluator.js +22 -7
  101. package/dist/local-evaluator/evaluator.js.map +1 -1
  102. package/dist/local-evaluator/evaluator.mjs +22 -7
  103. package/dist/local-evaluator/evaluator.mjs.map +1 -1
  104. package/dist/{mcp-BgBJu4Jl.d.mts → mcp-DgsyQiQq.d.mts} +53 -52
  105. package/dist/{mcp--DgKOwfu.d.ts → mcp-OosmAcKf.d.ts} +53 -52
  106. package/dist/{nextjs-DlX6xwbU.d.mts → nextjs-B1sBdEav.d.mts} +1 -1
  107. package/dist/{nextjs-DL6uE1ye.d.ts → nextjs-DoRmhV_Z.d.ts} +1 -1
  108. package/dist/registration/index.d.mts +5 -1
  109. package/dist/registration/index.d.ts +5 -1
  110. package/dist/registration/index.js +1 -1
  111. package/dist/registration/index.js.map +1 -1
  112. package/dist/registration/index.mjs +1 -1
  113. package/dist/registration/index.mjs.map +1 -1
  114. package/dist/sdk-B83N3xKc.d.mts +142 -0
  115. package/dist/sdk-H_9BTNBS.d.ts +142 -0
  116. package/dist/transport/index.d.mts +2 -2
  117. package/dist/transport/index.d.ts +2 -2
  118. package/dist/transport/index.js +1 -1
  119. package/dist/transport/index.js.map +1 -1
  120. package/dist/transport/index.mjs +1 -1
  121. package/dist/transport/index.mjs.map +1 -1
  122. package/dist/{types-DwSfO7Sb.d.ts → types-BK2POWNc.d.ts} +23 -50
  123. package/dist/{types-C0zfSXMB.d.mts → types-CJjZvPr9.d.mts} +23 -50
  124. package/dist/{types-C7Rb-w0d.d.mts → types-CXf3q4kZ.d.ts} +14 -3
  125. package/dist/{types-nIh3HtuA.d.ts → types-DQmop7ZW.d.mts} +14 -3
  126. package/dist/ui/index.d.mts +2 -17
  127. package/dist/ui/index.d.ts +2 -17
  128. package/dist/ui/index.js +1 -43
  129. package/dist/ui/index.js.map +1 -1
  130. package/dist/ui/index.mjs +1 -42
  131. package/dist/ui/index.mjs.map +1 -1
  132. package/dist/verify.d.mts +3 -4
  133. package/dist/verify.d.ts +3 -4
  134. package/dist/verify.js +8 -28
  135. package/dist/verify.js.map +1 -1
  136. package/dist/verify.mjs +8 -28
  137. package/dist/verify.mjs.map +1 -1
  138. package/package.json +1 -1
  139. package/dist/sdk-Bbh9B_dw.d.mts +0 -215
  140. package/dist/sdk-C6SASmsh.d.ts +0 -215
package/dist/index.mjs CHANGED
@@ -4,32 +4,7 @@ var __export = (target, all) => {
4
4
  __defProp(target, name, { get: all[name], enumerable: true });
5
5
  };
6
6
 
7
- // src/access-levels.ts
8
- var ACCESS_LEVEL_HIERARCHY = {
9
- none: 0,
10
- restricted: 1,
11
- "read-only": 2,
12
- standard: 3,
13
- full: 4,
14
- internal: 5
15
- };
16
- var ACCESS_LEVEL_DESCRIPTIONS = {
17
- none: "No access - credentials required",
18
- restricted: "Restricted access - registration prompt only",
19
- "read-only": "Read-only access - can browse but not modify",
20
- standard: "Standard access - normal operations per PDLSS policy",
21
- full: "Full access - all operations for high-trust agents",
22
- internal: "Internal access - organization member privileges"
23
- };
24
- var DEFAULT_TRUST_THRESHOLDS = {
25
- none: 0,
26
- restricted: 0,
27
- "read-only": 20,
28
- standard: 40,
29
- full: 70,
30
- internal: 0
31
- // Internal is based on org membership, not score
32
- };
7
+ // src/trust-levels.ts
33
8
  var TRUST_LEVEL_RANGES = {
34
9
  BRONZE: { min: 0, max: 39 },
35
10
  SILVER: { min: 40, max: 59 },
@@ -42,91 +17,9 @@ function getTrustLevel(score) {
42
17
  if (score >= 40) return "SILVER";
43
18
  return "BRONZE";
44
19
  }
45
- function hasMinimumAccess(actual, required) {
46
- return ACCESS_LEVEL_HIERARCHY[actual] >= ACCESS_LEVEL_HIERARCHY[required];
47
- }
48
- function getAccessLevelForScore(trustScore, thresholds = DEFAULT_TRUST_THRESHOLDS) {
49
- if (trustScore >= thresholds.full) return "full";
50
- if (trustScore >= thresholds.standard) return "standard";
51
- if (trustScore >= thresholds["read-only"]) return "read-only";
52
- return "restricted";
53
- }
54
- function determineAccessLevel(verified, trustScore, isOrgMember, customThresholds) {
55
- if (!verified) {
56
- return "none";
57
- }
58
- if (isOrgMember) {
59
- return "internal";
60
- }
61
- const thresholds = {
62
- ...DEFAULT_TRUST_THRESHOLDS,
63
- ...customThresholds
64
- };
65
- return getAccessLevelForScore(trustScore, thresholds);
66
- }
67
- function getCapabilities(accessLevel) {
68
- switch (accessLevel) {
69
- case "none":
70
- return {
71
- canRead: false,
72
- canWrite: false,
73
- canDelete: false,
74
- canAdmin: false,
75
- canAccessInternal: false
76
- };
77
- case "restricted":
78
- return {
79
- canRead: false,
80
- canWrite: false,
81
- canDelete: false,
82
- canAdmin: false,
83
- canAccessInternal: false
84
- };
85
- case "read-only":
86
- return {
87
- canRead: true,
88
- canWrite: false,
89
- canDelete: false,
90
- canAdmin: false,
91
- canAccessInternal: false
92
- };
93
- case "standard":
94
- return {
95
- canRead: true,
96
- canWrite: true,
97
- canDelete: false,
98
- canAdmin: false,
99
- canAccessInternal: false
100
- };
101
- case "full":
102
- return {
103
- canRead: true,
104
- canWrite: true,
105
- canDelete: true,
106
- canAdmin: false,
107
- canAccessInternal: false
108
- };
109
- case "internal":
110
- return {
111
- canRead: true,
112
- canWrite: true,
113
- canDelete: true,
114
- canAdmin: true,
115
- canAccessInternal: true
116
- };
117
- default:
118
- return {
119
- canRead: false,
120
- canWrite: false,
121
- canDelete: false,
122
- canAdmin: false,
123
- canAccessInternal: false
124
- };
125
- }
126
- }
127
20
 
128
21
  // src/version.ts
129
- var SDK_VERSION = "4.5.1";
22
+ var SDK_VERSION = "5.0.0";
130
23
 
131
24
  // src/http.ts
132
25
  var SDK_USER_AGENT = `astrasync-sdk/${SDK_VERSION}`;
@@ -208,11 +101,6 @@ function getCachedWellKnownUrls(apiBaseUrl) {
208
101
  // src/verify.ts
209
102
  var DEFAULT_CONFIG = {
210
103
  apiBaseUrl: "https://astrasync.ai/api",
211
- // v2.3.9 (defect #30): default for unconfigured callers is `'none'` (no
212
- // access). Pre-rename this defaulted to `'guidance'`, which combined with
213
- // a route gated at `'guidance'` to silently let unverified traffic
214
- // through (`hasMinimumAccess('guidance', 'guidance') === true`).
215
- defaultAccessLevel: "none",
216
104
  // minTrustScore + minTrustScoreForFull deprecated in v2.3.0 — server decides.
217
105
  // cacheTtl deliberately unset. When undefined, cacheResult applies the 60s
218
106
  // default; the caller's explicit value is honoured for cacheable results.
@@ -413,13 +301,6 @@ function createGuidanceResponse(_config, reason, options = {}) {
413
301
  // policy is not evaluated (we never reached the gate).
414
302
  identityVerified: false,
415
303
  policyAllowed: false,
416
- // v2.3.9 (defect #30): denials grant `'none'`, NEVER a positive band.
417
- // Adapters additionally short-circuit on `!identityVerified ||
418
- // !policyAllowed` before the gate check, but the access level still has
419
- // to be honest at the data layer so downstream consumers (SDK adapters
420
- // in other languages, custom integrations) inherit the correct
421
- // semantics.
422
- accessLevel: "none",
423
304
  guidance,
424
305
  denialReasons: reason ? [reason] : ["No valid agent credentials provided"],
425
306
  // Round-10 (#47, O5): on API-error fallback, surface a typed failure so
@@ -442,6 +323,11 @@ function createGuidanceResponse(_config, reason, options = {}) {
442
323
  // 4.0.0: typed marker so adapters render the misconfig envelope (503 +
443
324
  // MERCHANT_VERIFICATION_MISCONFIGURED) without string-matching.
444
325
  ...isMisconfig && { misconfigured: true },
326
+ // 4.6.0: a transient api_error is retryable — mark it so consumers surface
327
+ // "temporarily unavailable, retry" (recommendation 'error') instead of
328
+ // coercing the absent recommendation to a policy 'deny'. Misconfig is
329
+ // deterministic and intentionally NOT marked retryable.
330
+ ...isApiError && { retryable: true },
445
331
  correlationId: options.correlationId,
446
332
  attemptId: options.attemptId,
447
333
  verifiedAt: /* @__PURE__ */ new Date()
@@ -508,7 +394,6 @@ async function callVerifyAccessAPI(config, request) {
508
394
  attemptId: typeof data?.attemptId === "string" ? data.attemptId : void 0,
509
395
  access: {
510
396
  allowed: false,
511
- accessLevel: "none",
512
397
  reason: "endpoint_deactivated",
513
398
  failures: [
514
399
  {
@@ -571,7 +456,7 @@ async function verify(config, request, options) {
571
456
  if (!deprecationWarningShown && (config.minTrustScore !== void 0 || config.minTrustScoreForFull !== void 0)) {
572
457
  deprecationWarningShown = true;
573
458
  console.warn(
574
- "[VerificationGateway] minTrustScore / minTrustScoreForFull are deprecated in v2.3.0 and have no effect. Server is now the single source of truth for access-level decisions (the SDK reads access.accessLevel from the verify-access response). To gate access to an endpoint, configure the endpoint's trust_score_requirement server-side."
459
+ "[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."
575
460
  );
576
461
  }
577
462
  if (mergedConfig.cacheTtl !== 0 && !options?.bypassCache) {
@@ -617,14 +502,6 @@ async function verify(config, request, options) {
617
502
  const result2 = {
618
503
  identityVerified: idVerifiedFromBackend,
619
504
  policyAllowed: false,
620
- // v2.3.9 (defect #30): denials grant `'none'`, NEVER a positive band.
621
- // Pre-rename this hardcoded `'guidance'`, which conflated with the
622
- // colocated `guidance: {...}` help-payload object below and let
623
- // denied requests pass any route gated at `'guidance'` because
624
- // `hasMinimumAccess('guidance', 'guidance') === true`. Adapters now
625
- // ALSO short-circuit on `!identityVerified || !policyAllowed` before
626
- // the gate check — belt-and-braces.
627
- accessLevel: "none",
628
505
  // 3.6.0: the server now emits top-level denialReasons on every deny
629
506
  // path — prefer it verbatim; the failure-message reconstruction remains
630
507
  // as the fallback for older backends.
@@ -673,7 +550,6 @@ async function verify(config, request, options) {
673
550
  trustScore: apiResponse.organization.trustScore
674
551
  } : void 0;
675
552
  const verificationContext = apiResponse.verificationContext;
676
- const accessLevel = apiResponse.access?.accessLevel ?? "standard";
677
553
  const result = {
678
554
  // 4.5.0 (probe F1): read idVerified from verificationContext with the
679
555
  // SAME absent⇒false default as the deny branch. The previous `!== false`
@@ -685,7 +561,6 @@ async function verify(config, request, options) {
685
561
  // this load-bearing must never be defaulted on.
686
562
  identityVerified: apiResponse.verificationContext?.idVerified === true,
687
563
  policyAllowed: true,
688
- accessLevel,
689
564
  agent,
690
565
  developer,
691
566
  organization,
@@ -712,7 +587,6 @@ async function verify(config, request, options) {
712
587
  };
713
588
  if (result.recommendation === "deny") {
714
589
  result.policyAllowed = false;
715
- result.accessLevel = "none";
716
590
  result.denialReasons = serverDenialReasons ?? result.recommendationReasons ?? ["Access denied by AstraSync recommendation"];
717
591
  result.guidance = result.runtimeChallenge ? {
718
592
  message: `Verification failed: ${result.runtimeChallenge.reason || "runtime challenge failed"}`,
@@ -815,7 +689,6 @@ async function quickVerify(config, credentials) {
815
689
  return {
816
690
  identityVerified: result.identityVerified,
817
691
  policyAllowed: result.policyAllowed,
818
- accessLevel: result.accessLevel,
819
692
  reason: result.denialReasons?.[0]
820
693
  };
821
694
  }
@@ -1845,7 +1718,6 @@ function defaultOnDenied(result, _req, res) {
1845
1718
  error: {
1846
1719
  code: !result.identityVerified ? "UNAUTHORIZED" : "INSUFFICIENT_ACCESS",
1847
1720
  message: result.denialReasons?.[0] || "Access denied",
1848
- accessLevel: result.accessLevel,
1849
1721
  guidance: result.guidance,
1850
1722
  // Round-10: aggregated per-dimension detail + correlation handle.
1851
1723
  failures: result.failures,
@@ -1961,11 +1833,11 @@ function createMiddleware(options) {
1961
1833
  }
1962
1834
  const wellKnownUrls = config.apiBaseUrl ? await getWellKnownUrls(config.apiBaseUrl).catch(() => void 0) : void 0;
1963
1835
  const credentials = customExtractCredentials ? customExtractCredentials(req) : defaultExtractCredentials(req);
1964
- const shouldEnforce = routeConfig.minAccessLevel !== "none";
1965
- if (routeConfig.minAccessLevel === "none" && (!config.evaluateAlwaysIfCredentialed || !credentials.astraId)) {
1836
+ const shouldEnforce = !routeConfig.observe;
1837
+ if (routeConfig.observe && (!config.evaluateAlwaysIfCredentialed || !credentials.astraId)) {
1966
1838
  if (config.setPassThroughHeader) {
1967
1839
  res.setHeader("X-Astra-Gateway-Mode", "unenforced");
1968
- res.setHeader("X-Astra-Gateway-Reason", "route-none");
1840
+ res.setHeader("X-Astra-Gateway-Reason", "route-observe");
1969
1841
  }
1970
1842
  beaconPassThrough?.(req);
1971
1843
  return next();
@@ -2002,7 +1874,6 @@ function createMiddleware(options) {
2002
1874
  const result2 = {
2003
1875
  identityVerified: false,
2004
1876
  policyAllowed: false,
2005
- accessLevel: "none",
2006
1877
  denialReasons: preCheckFailures.map((f) => f.message),
2007
1878
  guidance: {
2008
1879
  message: "Request exceeds counterparty-defined PDLSS limits.",
@@ -2165,7 +2036,6 @@ function createMiddleware(options) {
2165
2036
  const result = {
2166
2037
  identityVerified: false,
2167
2038
  policyAllowed: false,
2168
- accessLevel: "none",
2169
2039
  denialReasons: [`Verification middleware internal error: ${errorClass}`],
2170
2040
  failures: [
2171
2041
  {
@@ -2494,7 +2364,7 @@ function createMiddleware2(options) {
2494
2364
  beaconPassThrough?.(request, pathname);
2495
2365
  return NextResponse.next();
2496
2366
  }
2497
- if (routeConfig.minAccessLevel === "none") {
2367
+ if (routeConfig.observe) {
2498
2368
  beaconPassThrough?.(request, pathname);
2499
2369
  return NextResponse.next();
2500
2370
  }
@@ -2524,7 +2394,6 @@ function createMiddleware2(options) {
2524
2394
  const preCheckResult = {
2525
2395
  identityVerified: false,
2526
2396
  policyAllowed: false,
2527
- accessLevel: "none",
2528
2397
  denialReasons: preCheckFailures.map((f) => f.message),
2529
2398
  guidance: {
2530
2399
  message: "Request exceeds counterparty-defined PDLSS limits.",
@@ -2662,7 +2531,6 @@ function createMiddleware2(options) {
2662
2531
  }
2663
2532
  response.headers.set("X-AstraSync-Identity-Verified", result.identityVerified.toString());
2664
2533
  response.headers.set("X-AstraSync-Policy-Allowed", result.policyAllowed.toString());
2665
- response.headers.set("X-AstraSync-Access-Level", result.accessLevel);
2666
2534
  if (result.agent) {
2667
2535
  response.headers.set("X-AstraSync-Agent-Id", result.agent.astraId);
2668
2536
  }
@@ -2678,9 +2546,7 @@ var sdk_exports = {};
2678
2546
  __export(sdk_exports, {
2679
2547
  VerificationGatewayClient: () => VerificationGatewayClient,
2680
2548
  createClient: () => createClient,
2681
- getCapabilities: () => getCapabilities,
2682
2549
  getTrustLevel: () => getTrustLevel,
2683
- hasMinimumAccess: () => hasMinimumAccess,
2684
2550
  verifyOnce: () => verifyOnce
2685
2551
  });
2686
2552
  var VerificationGatewayClient = class {
@@ -2688,7 +2554,6 @@ var VerificationGatewayClient = class {
2688
2554
  this.config = {
2689
2555
  apiBaseUrl: options.apiBaseUrl,
2690
2556
  apiKey: options.apiKey,
2691
- defaultAccessLevel: options.defaultAccessLevel,
2692
2557
  minTrustScore: options.minTrustScore,
2693
2558
  minTrustScoreForFull: options.minTrustScoreForFull,
2694
2559
  cacheTtl: options.cacheTtl,
@@ -2737,26 +2602,6 @@ var VerificationGatewayClient = class {
2737
2602
  async quickVerify(credentials) {
2738
2603
  return this.executeWithRetry(() => quickVerify(this.config, credentials));
2739
2604
  }
2740
- /**
2741
- * Check if an agent has a specific access level.
2742
- *
2743
- * @deprecated 3.2.0 — the access-level band is informational only; it no
2744
- * longer gates in the middleware adapters (post-3.1.0 feedback #1). This
2745
- * explicit opt-in query still works, but prefer gating on the server-side
2746
- * policy decision (identity + policy + trust) or per-route `minTrustScore`.
2747
- * Explicit per-route condition→constraint rules are the Phase-2 successor.
2748
- */
2749
- async hasAccess(credentials, requiredLevel) {
2750
- const result = await this.quickVerify(credentials);
2751
- return hasMinimumAccess(result.accessLevel, requiredLevel);
2752
- }
2753
- /**
2754
- * Get capabilities for a verified agent
2755
- */
2756
- async getCapabilities(credentials) {
2757
- const result = await this.quickVerify(credentials);
2758
- return getCapabilities(result.accessLevel);
2759
- }
2760
2605
  /**
2761
2606
  * Verify a specific ASTRA-ID
2762
2607
  */
@@ -5487,18 +5332,13 @@ function mcpToPdlss(parsed, requestPath, headerPurpose, headerAction, toolGate)
5487
5332
  }
5488
5333
  return { purpose, action, resource, purposeSource, actionSource };
5489
5334
  }
5490
- function mcpRiskTier(parsed) {
5491
- if (parsed.isInitialize || parsed.method === "notifications/initialized") return "none";
5492
- if (parsed.isIntrospection) return "none";
5493
- if (parsed.method === "resources/read") return "read-only";
5494
- if (parsed.isToolCall) return "standard";
5495
- return "standard";
5335
+ function mcpDefaultEnforced(parsed) {
5336
+ if (parsed.isInitialize || parsed.method === "notifications/initialized") return false;
5337
+ if (parsed.isIntrospection) return false;
5338
+ return true;
5496
5339
  }
5497
5340
 
5498
5341
  // src/adapters/mcp.ts
5499
- function normalizeToolGate(gate) {
5500
- return typeof gate === "string" ? { minAccessLevel: gate } : gate;
5501
- }
5502
5342
  function readSingleHeader(value) {
5503
5343
  if (typeof value === "string") return value;
5504
5344
  if (Array.isArray(value)) return value[0];
@@ -5551,7 +5391,6 @@ function defaultMcpDenied(result, req, res) {
5551
5391
  code: !result.identityVerified ? -32e3 : -32001,
5552
5392
  message: result.denialReasons?.[0] ?? "Access denied",
5553
5393
  data: {
5554
- accessLevel: result.accessLevel,
5555
5394
  guidance: result.guidance,
5556
5395
  // Round-10: aggregated per-dimension detail + correlation handle.
5557
5396
  failures: result.failures,
@@ -5564,20 +5403,19 @@ function defaultMcpDenied(result, req, res) {
5564
5403
  }
5565
5404
  });
5566
5405
  }
5567
- function resolveMinAccessLevel(parsed, opts) {
5406
+ function resolveGate(parsed, opts) {
5568
5407
  if (!parsed.toolName) {
5569
- if (opts.methodGates && opts.methodGates[parsed.method] !== void 0) {
5570
- return { level: opts.methodGates[parsed.method], source: "methodGate" };
5408
+ const methodGate = opts.methodGates?.[parsed.method];
5409
+ if (methodGate !== void 0) {
5410
+ return methodGate === "observe" ? { enforce: false, source: "methodGate" } : { enforce: true, config: methodGate, source: "methodGate" };
5571
5411
  }
5572
- return { level: "none", source: "discovery_default" };
5412
+ return { enforce: false, source: "discovery_default" };
5573
5413
  }
5574
- if (opts.toolGates && opts.toolGates[parsed.toolName] !== void 0) {
5575
- return {
5576
- level: normalizeToolGate(opts.toolGates[parsed.toolName]).minAccessLevel,
5577
- source: "toolGate"
5578
- };
5414
+ const toolGate = opts.toolGates?.[parsed.toolName];
5415
+ if (toolGate !== void 0) {
5416
+ return toolGate === "observe" ? { enforce: false, source: "toolGate" } : { enforce: true, config: toolGate, source: "toolGate" };
5579
5417
  }
5580
- return { level: mcpRiskTier(parsed), source: "tier" };
5418
+ return { enforce: mcpDefaultEnforced(parsed), source: "tier" };
5581
5419
  }
5582
5420
  function createMcpMiddleware(options) {
5583
5421
  const {
@@ -5597,15 +5435,6 @@ function createMcpMiddleware(options) {
5597
5435
  prefetchWellKnown(config.apiBaseUrl).catch(() => {
5598
5436
  });
5599
5437
  }
5600
- if (toolGates) {
5601
- for (const [toolName, gate] of Object.entries(toolGates)) {
5602
- if (typeof gate === "string") {
5603
- console.warn(
5604
- `[VerificationGateway/MCP] toolGates['${toolName}'] uses the bare-string shorthand ('${gate}'). Gated tools need a PDLSS purpose (else PDLSS_PURPOSE_REQUIRED 400) and evaluate purpose-only without a declared action. Use the object form instead: { minAccessLevel: '${gate}', purpose: '...', action: '...' }.`
5605
- );
5606
- }
5607
- }
5608
- }
5609
5438
  return async (req, res, next) => {
5610
5439
  try {
5611
5440
  if (skip) return next();
@@ -5654,7 +5483,7 @@ function createMcpMiddleware(options) {
5654
5483
  return next();
5655
5484
  }
5656
5485
  }
5657
- const { level: minAccessLevel } = resolveMinAccessLevel(parsed, {
5486
+ const gateDecision = resolveGate(parsed, {
5658
5487
  toolGates,
5659
5488
  methodGates
5660
5489
  });
@@ -5663,16 +5492,15 @@ function createMcpMiddleware(options) {
5663
5492
  req.query
5664
5493
  );
5665
5494
  if (effectiveAstraId) credentials.astraId = effectiveAstraId;
5666
- const shouldEnforce = minAccessLevel !== "none";
5667
- if (minAccessLevel === "none" && (!config.evaluateAlwaysIfCredentialed || !credentials.astraId)) {
5495
+ const shouldEnforce = gateDecision.enforce;
5496
+ if (!shouldEnforce && (!config.evaluateAlwaysIfCredentialed || !credentials.astraId)) {
5668
5497
  if (config.setPassThroughHeader) {
5669
5498
  res.setHeader("X-Astra-Gateway-Mode", "unenforced");
5670
- res.setHeader("X-Astra-Gateway-Reason", "mcp-tier-none");
5499
+ res.setHeader("X-Astra-Gateway-Reason", "mcp-observe");
5671
5500
  }
5672
5501
  return next();
5673
5502
  }
5674
- const rawGate = parsed.toolName && toolGates?.[parsed.toolName];
5675
- const gate = rawGate ? normalizeToolGate(rawGate) : void 0;
5503
+ const gate = gateDecision.config;
5676
5504
  const headerPurpose = readSingleHeader(req.headers["x-astra-purpose"]);
5677
5505
  const headerAction = readSingleHeader(req.headers["x-astra-action"]);
5678
5506
  const pdlss = mcpToPdlss(
@@ -5808,7 +5636,6 @@ function createMcpMiddleware(options) {
5808
5636
  const result = {
5809
5637
  identityVerified: false,
5810
5638
  policyAllowed: false,
5811
- accessLevel: "none",
5812
5639
  denialReasons: [`MCP middleware internal error: ${errorClass}`],
5813
5640
  failures: [
5814
5641
  {
@@ -6563,8 +6390,6 @@ function detectRuntime(userAgent) {
6563
6390
  return void 0;
6564
6391
  }
6565
6392
  export {
6566
- ACCESS_LEVEL_DESCRIPTIONS,
6567
- ACCESS_LEVEL_HIERARCHY,
6568
6393
  AgentClient,
6569
6394
  AstraSync,
6570
6395
  AstraSyncError,
@@ -6572,7 +6397,6 @@ export {
6572
6397
  CAPTURE_SCHEMA_VERSION,
6573
6398
  ChallengeHandler,
6574
6399
  DEFAULT_EDGE_CONFIG,
6575
- DEFAULT_TRUST_THRESHOLDS,
6576
6400
  KYDRequiredError,
6577
6401
  MAX_HEADERS,
6578
6402
  MAX_HEADER_VALUE_BYTES,
@@ -6599,7 +6423,6 @@ export {
6599
6423
  deriveConnectionFromHeaders,
6600
6424
  detectPlatformFingerprint,
6601
6425
  detectRuntime,
6602
- determineAccessLevel,
6603
6426
  express_exports as express,
6604
6427
  extractApiKeyFormat,
6605
6428
  extractCredentials,
@@ -6607,14 +6430,11 @@ export {
6607
6430
  extractPlatformHeaders,
6608
6431
  fetchEdgeConfig,
6609
6432
  fetchRoutes,
6610
- getAccessLevelForScore,
6611
6433
  getCachedWellKnownUrls,
6612
- getCapabilities,
6613
6434
  getEdgeConfig,
6614
6435
  getTrustLevel,
6615
6436
  getWellKnownUrls,
6616
6437
  hasCredentials,
6617
- hasMinimumAccess,
6618
6438
  isEdgeConfig,
6619
6439
  isVerifiedHopValidFor,
6620
6440
  matchEdgePathRule,