@astrasyncai/verification-gateway 4.6.0 → 5.1.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 (135) hide show
  1. package/dist/adapter-interface/interface.d.mts +2 -2
  2. package/dist/adapter-interface/interface.d.ts +2 -2
  3. package/dist/adapters/express.d.mts +2 -2
  4. package/dist/adapters/express.d.ts +2 -2
  5. package/dist/adapters/express.js +25 -35
  6. package/dist/adapters/express.js.map +1 -1
  7. package/dist/adapters/express.mjs +25 -35
  8. package/dist/adapters/express.mjs.map +1 -1
  9. package/dist/adapters/mcp.d.mts +2 -2
  10. package/dist/adapters/mcp.d.ts +2 -2
  11. package/dist/adapters/mcp.js +42 -67
  12. package/dist/adapters/mcp.js.map +1 -1
  13. package/dist/adapters/mcp.mjs +41 -66
  14. package/dist/adapters/mcp.mjs.map +1 -1
  15. package/dist/adapters/nextjs.d.mts +2 -2
  16. package/dist/adapters/nextjs.d.ts +2 -2
  17. package/dist/adapters/nextjs.js +23 -32
  18. package/dist/adapters/nextjs.js.map +1 -1
  19. package/dist/adapters/nextjs.mjs +23 -32
  20. package/dist/adapters/nextjs.mjs.map +1 -1
  21. package/dist/adapters/sdk.d.mts +2 -2
  22. package/dist/adapters/sdk.d.ts +2 -2
  23. package/dist/adapters/sdk.js +22 -126
  24. package/dist/adapters/sdk.js.map +1 -1
  25. package/dist/adapters/sdk.mjs +22 -124
  26. package/dist/adapters/sdk.mjs.map +1 -1
  27. package/dist/agent/index.d.mts +2 -2
  28. package/dist/agent/index.d.ts +2 -2
  29. package/dist/agent/index.js +1 -1
  30. package/dist/agent/index.js.map +1 -1
  31. package/dist/agent/index.mjs +1 -1
  32. package/dist/agent/index.mjs.map +1 -1
  33. package/dist/bin/astrasync-claude-hook.js +23 -31
  34. package/dist/bin/astrasync-codex-hook.js +23 -31
  35. package/dist/bin/astrasync-guard.js +23 -31
  36. package/dist/bin/astrasync.js +28 -36
  37. package/dist/browser/background.js +23 -31
  38. package/dist/browser/background.js.map +1 -1
  39. package/dist/browser/background.mjs +23 -31
  40. package/dist/browser/background.mjs.map +1 -1
  41. package/dist/browser/browser-adapter.d.mts +2 -2
  42. package/dist/browser/browser-adapter.d.ts +2 -2
  43. package/dist/claude-code/claude-code-adapter.d.mts +2 -2
  44. package/dist/claude-code/claude-code-adapter.d.ts +2 -2
  45. package/dist/cli/index.d.mts +2 -2
  46. package/dist/cli/index.d.ts +2 -2
  47. package/dist/cli/index.js +1 -1
  48. package/dist/cli/index.js.map +1 -1
  49. package/dist/cli/index.mjs +1 -1
  50. package/dist/cli/index.mjs.map +1 -1
  51. package/dist/codex/index.d.mts +2 -2
  52. package/dist/codex/index.d.ts +2 -2
  53. package/dist/codex/index.js +23 -31
  54. package/dist/codex/index.js.map +1 -1
  55. package/dist/codex/index.mjs +23 -31
  56. package/dist/codex/index.mjs.map +1 -1
  57. package/dist/cursor/cursor-adapter.d.mts +2 -2
  58. package/dist/cursor/cursor-adapter.d.ts +2 -2
  59. package/dist/cursor/extension.d.mts +2 -2
  60. package/dist/cursor/extension.d.ts +2 -2
  61. package/dist/cursor/extension.js +23 -31
  62. package/dist/cursor/extension.js.map +1 -1
  63. package/dist/cursor/extension.mjs +23 -31
  64. package/dist/cursor/extension.mjs.map +1 -1
  65. package/dist/edge-config.d.mts +1 -1
  66. package/dist/edge-config.d.ts +1 -1
  67. package/dist/edge-config.js +1 -1
  68. package/dist/edge-config.js.map +1 -1
  69. package/dist/edge-config.mjs +1 -1
  70. package/dist/edge-config.mjs.map +1 -1
  71. package/dist/edge-core/index.d.mts +12 -3
  72. package/dist/edge-core/index.d.ts +12 -3
  73. package/dist/edge-core/index.js +42 -36
  74. package/dist/edge-core/index.js.map +1 -1
  75. package/dist/edge-core/index.mjs +42 -36
  76. package/dist/edge-core/index.mjs.map +1 -1
  77. package/dist/{express-DBtPKXOL.d.mts → express-KkBZBMqi.d.mts} +1 -1
  78. package/dist/{express-D-8Ks2Uo.d.ts → express-xK8pRrmj.d.ts} +1 -1
  79. package/dist/gateway/gateway.d.mts +2 -2
  80. package/dist/gateway/gateway.d.ts +2 -2
  81. package/dist/gateway/gateway.js +23 -31
  82. package/dist/gateway/gateway.js.map +1 -1
  83. package/dist/gateway/gateway.mjs +23 -31
  84. package/dist/gateway/gateway.mjs.map +1 -1
  85. package/dist/git-trigger/git-hooks.d.mts +2 -2
  86. package/dist/git-trigger/git-hooks.d.ts +2 -2
  87. package/dist/{index-kGCGWd5x.d.mts → index-DIRzR5IS.d.mts} +1 -1
  88. package/dist/{index-DlZORQsb.d.ts → index-DLQ4Rcuc.d.ts} +1 -1
  89. package/dist/{index-CUfmJ1Dq.d.mts → index-GPDn_EGI.d.mts} +1 -1
  90. package/dist/{index-BND3kQev.d.ts → index-Hnz5VyMR.d.ts} +1 -1
  91. package/dist/index.d.mts +14 -10
  92. package/dist/index.d.ts +14 -10
  93. package/dist/index.js +44 -219
  94. package/dist/index.js.map +1 -1
  95. package/dist/index.mjs +44 -212
  96. package/dist/index.mjs.map +1 -1
  97. package/dist/local-evaluator/evaluator.d.mts +2 -2
  98. package/dist/local-evaluator/evaluator.d.ts +2 -2
  99. package/dist/local-evaluator/evaluator.js.map +1 -1
  100. package/dist/local-evaluator/evaluator.mjs.map +1 -1
  101. package/dist/{mcp-DToTlwIn.d.ts → mcp-DPpu4xQz.d.ts} +53 -52
  102. package/dist/{mcp-ZRN4kY3b.d.mts → mcp-Dju_Sr1o.d.mts} +53 -52
  103. package/dist/{nextjs-C0KASOy_.d.mts → nextjs-BuoDBN4g.d.mts} +1 -1
  104. package/dist/{nextjs-lwNvWYWT.d.ts → nextjs-rZKzY_8o.d.ts} +1 -1
  105. package/dist/registration/index.js +1 -1
  106. package/dist/registration/index.js.map +1 -1
  107. package/dist/registration/index.mjs +1 -1
  108. package/dist/registration/index.mjs.map +1 -1
  109. package/dist/sdk-CdO6TIEf.d.mts +142 -0
  110. package/dist/sdk-DxHuIJBm.d.ts +142 -0
  111. package/dist/transport/index.d.mts +2 -2
  112. package/dist/transport/index.d.ts +2 -2
  113. package/dist/transport/index.js +1 -1
  114. package/dist/transport/index.js.map +1 -1
  115. package/dist/transport/index.mjs +1 -1
  116. package/dist/transport/index.mjs.map +1 -1
  117. package/dist/{types-DhhJxKIC.d.ts → types-3UV7IZx7.d.ts} +1 -3
  118. package/dist/{types-CGPU7HLi.d.ts → types-CNBaZKxY.d.ts} +24 -50
  119. package/dist/{types-Cx9hTpKI.d.mts → types-CSHcByFX.d.mts} +24 -50
  120. package/dist/{types-CfSJLS4i.d.mts → types-CoDjpbVY.d.mts} +1 -3
  121. package/dist/ui/index.d.mts +2 -17
  122. package/dist/ui/index.d.ts +2 -17
  123. package/dist/ui/index.js +1 -43
  124. package/dist/ui/index.js.map +1 -1
  125. package/dist/ui/index.mjs +1 -42
  126. package/dist/ui/index.mjs.map +1 -1
  127. package/dist/verify.d.mts +3 -4
  128. package/dist/verify.d.ts +3 -4
  129. package/dist/verify.js +22 -30
  130. package/dist/verify.js.map +1 -1
  131. package/dist/verify.mjs +22 -30
  132. package/dist/verify.mjs.map +1 -1
  133. package/package.json +1 -1
  134. package/dist/sdk-B4aodEwj.d.ts +0 -215
  135. package/dist/sdk-B9dSwum7.d.mts +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.6.0";
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.
@@ -375,6 +263,14 @@ function extractCredentials(headers, query) {
375
263
  function hasCredentials(credentials) {
376
264
  return !!(credentials.astraId || credentials.apiKey || credentials.jwt);
377
265
  }
266
+ function mcpGuidance(urls) {
267
+ if (!urls?.mcpEndpoint) return void 0;
268
+ return {
269
+ endpoint: urls.mcpEndpoint,
270
+ discoveryUrl: urls.mcpDiscoveryUrl,
271
+ message: "If you are operating inside an MCP-capable host (Claude, ChatGPT, Cursor, or any MCP client), add the AstraSync MCP connector instead of integrating these URLs by hand: registration through the connector is KEYLESS and HUMAN-APPROVED \u2014 your human approves in an in-chat card, and you never see, hold, or transmit an API key, password, or private key."
272
+ };
273
+ }
378
274
  function createGuidanceResponse(_config, reason, options = {}) {
379
275
  const source = options.source ?? "no_credentials";
380
276
  const isApiError = source === "api_error";
@@ -401,11 +297,17 @@ function createGuidanceResponse(_config, reason, options = {}) {
401
297
  registrationUrl: urls?.registrationUrl ?? "",
402
298
  documentationUrl: urls?.documentationUrl ?? "",
403
299
  steps: [
300
+ // MCP steering leads when the hosted bridge is advertised — the
301
+ // connector is the agent-actionable path (keyless, human-approved).
302
+ ...urls?.mcpEndpoint ? [
303
+ `Fastest path (inside an MCP host): add the AstraSync MCP connector at ${urls.mcpEndpoint} \u2014 keyless, human-approved registration`
304
+ ] : [],
404
305
  "Register for an AstraSync account",
405
306
  "Create and register your agent",
406
307
  "Add your ASTRA-ID to request headers",
407
308
  "Retry your request"
408
- ]
309
+ ],
310
+ ...mcpGuidance(urls) && { mcp: mcpGuidance(urls) }
409
311
  };
410
312
  return {
411
313
  // Round-18 G4: createGuidanceResponse fires for unverified-agent path or
@@ -413,13 +315,6 @@ function createGuidanceResponse(_config, reason, options = {}) {
413
315
  // policy is not evaluated (we never reached the gate).
414
316
  identityVerified: false,
415
317
  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
318
  guidance,
424
319
  denialReasons: reason ? [reason] : ["No valid agent credentials provided"],
425
320
  // Round-10 (#47, O5): on API-error fallback, surface a typed failure so
@@ -513,7 +408,6 @@ async function callVerifyAccessAPI(config, request) {
513
408
  attemptId: typeof data?.attemptId === "string" ? data.attemptId : void 0,
514
409
  access: {
515
410
  allowed: false,
516
- accessLevel: "none",
517
411
  reason: "endpoint_deactivated",
518
412
  failures: [
519
413
  {
@@ -576,7 +470,7 @@ async function verify(config, request, options) {
576
470
  if (!deprecationWarningShown && (config.minTrustScore !== void 0 || config.minTrustScoreForFull !== void 0)) {
577
471
  deprecationWarningShown = true;
578
472
  console.warn(
579
- "[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."
473
+ "[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."
580
474
  );
581
475
  }
582
476
  if (mergedConfig.cacheTtl !== 0 && !options?.bypassCache) {
@@ -622,14 +516,6 @@ async function verify(config, request, options) {
622
516
  const result2 = {
623
517
  identityVerified: idVerifiedFromBackend,
624
518
  policyAllowed: false,
625
- // v2.3.9 (defect #30): denials grant `'none'`, NEVER a positive band.
626
- // Pre-rename this hardcoded `'guidance'`, which conflated with the
627
- // colocated `guidance: {...}` help-payload object below and let
628
- // denied requests pass any route gated at `'guidance'` because
629
- // `hasMinimumAccess('guidance', 'guidance') === true`. Adapters now
630
- // ALSO short-circuit on `!identityVerified || !policyAllowed` before
631
- // the gate check — belt-and-braces.
632
- accessLevel: "none",
633
519
  // 3.6.0: the server now emits top-level denialReasons on every deny
634
520
  // path — prefer it verbatim; the failure-message reconstruction remains
635
521
  // as the fallback for older backends.
@@ -640,7 +526,10 @@ async function verify(config, request, options) {
640
526
  guidance: {
641
527
  message: apiResponse.access?.reason || "Access denied by PDLSS policy",
642
528
  registrationUrl: urls?.registrationUrl ?? "",
643
- documentationUrl: urls?.documentationUrl ?? ""
529
+ documentationUrl: urls?.documentationUrl ?? "",
530
+ // 5.1.0: anonymous callers land on this branch — steer MCP-hosted
531
+ // agents to the connector (this is what the edge deny body surfaces).
532
+ ...mcpGuidance(urls) && { mcp: mcpGuidance(urls) }
644
533
  },
645
534
  verifiedAt: /* @__PURE__ */ new Date(),
646
535
  // Extract sessionId so decisions can be recorded for denials too
@@ -678,7 +567,6 @@ async function verify(config, request, options) {
678
567
  trustScore: apiResponse.organization.trustScore
679
568
  } : void 0;
680
569
  const verificationContext = apiResponse.verificationContext;
681
- const accessLevel = apiResponse.access?.accessLevel ?? "standard";
682
570
  const result = {
683
571
  // 4.5.0 (probe F1): read idVerified from verificationContext with the
684
572
  // SAME absent⇒false default as the deny branch. The previous `!== false`
@@ -690,7 +578,6 @@ async function verify(config, request, options) {
690
578
  // this load-bearing must never be defaulted on.
691
579
  identityVerified: apiResponse.verificationContext?.idVerified === true,
692
580
  policyAllowed: true,
693
- accessLevel,
694
581
  agent,
695
582
  developer,
696
583
  organization,
@@ -717,7 +604,6 @@ async function verify(config, request, options) {
717
604
  };
718
605
  if (result.recommendation === "deny") {
719
606
  result.policyAllowed = false;
720
- result.accessLevel = "none";
721
607
  result.denialReasons = serverDenialReasons ?? result.recommendationReasons ?? ["Access denied by AstraSync recommendation"];
722
608
  result.guidance = result.runtimeChallenge ? {
723
609
  message: `Verification failed: ${result.runtimeChallenge.reason || "runtime challenge failed"}`,
@@ -820,7 +706,6 @@ async function quickVerify(config, credentials) {
820
706
  return {
821
707
  identityVerified: result.identityVerified,
822
708
  policyAllowed: result.policyAllowed,
823
- accessLevel: result.accessLevel,
824
709
  reason: result.denialReasons?.[0]
825
710
  };
826
711
  }
@@ -1850,7 +1735,6 @@ function defaultOnDenied(result, _req, res) {
1850
1735
  error: {
1851
1736
  code: !result.identityVerified ? "UNAUTHORIZED" : "INSUFFICIENT_ACCESS",
1852
1737
  message: result.denialReasons?.[0] || "Access denied",
1853
- accessLevel: result.accessLevel,
1854
1738
  guidance: result.guidance,
1855
1739
  // Round-10: aggregated per-dimension detail + correlation handle.
1856
1740
  failures: result.failures,
@@ -1966,11 +1850,11 @@ function createMiddleware(options) {
1966
1850
  }
1967
1851
  const wellKnownUrls = config.apiBaseUrl ? await getWellKnownUrls(config.apiBaseUrl).catch(() => void 0) : void 0;
1968
1852
  const credentials = customExtractCredentials ? customExtractCredentials(req) : defaultExtractCredentials(req);
1969
- const shouldEnforce = routeConfig.minAccessLevel !== "none";
1970
- if (routeConfig.minAccessLevel === "none" && (!config.evaluateAlwaysIfCredentialed || !credentials.astraId)) {
1853
+ const shouldEnforce = !routeConfig.observe;
1854
+ if (routeConfig.observe && (!config.evaluateAlwaysIfCredentialed || !credentials.astraId)) {
1971
1855
  if (config.setPassThroughHeader) {
1972
1856
  res.setHeader("X-Astra-Gateway-Mode", "unenforced");
1973
- res.setHeader("X-Astra-Gateway-Reason", "route-none");
1857
+ res.setHeader("X-Astra-Gateway-Reason", "route-observe");
1974
1858
  }
1975
1859
  beaconPassThrough?.(req);
1976
1860
  return next();
@@ -2007,7 +1891,6 @@ function createMiddleware(options) {
2007
1891
  const result2 = {
2008
1892
  identityVerified: false,
2009
1893
  policyAllowed: false,
2010
- accessLevel: "none",
2011
1894
  denialReasons: preCheckFailures.map((f) => f.message),
2012
1895
  guidance: {
2013
1896
  message: "Request exceeds counterparty-defined PDLSS limits.",
@@ -2170,7 +2053,6 @@ function createMiddleware(options) {
2170
2053
  const result = {
2171
2054
  identityVerified: false,
2172
2055
  policyAllowed: false,
2173
- accessLevel: "none",
2174
2056
  denialReasons: [`Verification middleware internal error: ${errorClass}`],
2175
2057
  failures: [
2176
2058
  {
@@ -2499,7 +2381,7 @@ function createMiddleware2(options) {
2499
2381
  beaconPassThrough?.(request, pathname);
2500
2382
  return NextResponse.next();
2501
2383
  }
2502
- if (routeConfig.minAccessLevel === "none") {
2384
+ if (routeConfig.observe) {
2503
2385
  beaconPassThrough?.(request, pathname);
2504
2386
  return NextResponse.next();
2505
2387
  }
@@ -2529,7 +2411,6 @@ function createMiddleware2(options) {
2529
2411
  const preCheckResult = {
2530
2412
  identityVerified: false,
2531
2413
  policyAllowed: false,
2532
- accessLevel: "none",
2533
2414
  denialReasons: preCheckFailures.map((f) => f.message),
2534
2415
  guidance: {
2535
2416
  message: "Request exceeds counterparty-defined PDLSS limits.",
@@ -2667,7 +2548,6 @@ function createMiddleware2(options) {
2667
2548
  }
2668
2549
  response.headers.set("X-AstraSync-Identity-Verified", result.identityVerified.toString());
2669
2550
  response.headers.set("X-AstraSync-Policy-Allowed", result.policyAllowed.toString());
2670
- response.headers.set("X-AstraSync-Access-Level", result.accessLevel);
2671
2551
  if (result.agent) {
2672
2552
  response.headers.set("X-AstraSync-Agent-Id", result.agent.astraId);
2673
2553
  }
@@ -2683,9 +2563,7 @@ var sdk_exports = {};
2683
2563
  __export(sdk_exports, {
2684
2564
  VerificationGatewayClient: () => VerificationGatewayClient,
2685
2565
  createClient: () => createClient,
2686
- getCapabilities: () => getCapabilities,
2687
2566
  getTrustLevel: () => getTrustLevel,
2688
- hasMinimumAccess: () => hasMinimumAccess,
2689
2567
  verifyOnce: () => verifyOnce
2690
2568
  });
2691
2569
  var VerificationGatewayClient = class {
@@ -2693,7 +2571,6 @@ var VerificationGatewayClient = class {
2693
2571
  this.config = {
2694
2572
  apiBaseUrl: options.apiBaseUrl,
2695
2573
  apiKey: options.apiKey,
2696
- defaultAccessLevel: options.defaultAccessLevel,
2697
2574
  minTrustScore: options.minTrustScore,
2698
2575
  minTrustScoreForFull: options.minTrustScoreForFull,
2699
2576
  cacheTtl: options.cacheTtl,
@@ -2742,26 +2619,6 @@ var VerificationGatewayClient = class {
2742
2619
  async quickVerify(credentials) {
2743
2620
  return this.executeWithRetry(() => quickVerify(this.config, credentials));
2744
2621
  }
2745
- /**
2746
- * Check if an agent has a specific access level.
2747
- *
2748
- * @deprecated 3.2.0 — the access-level band is informational only; it no
2749
- * longer gates in the middleware adapters (post-3.1.0 feedback #1). This
2750
- * explicit opt-in query still works, but prefer gating on the server-side
2751
- * policy decision (identity + policy + trust) or per-route `minTrustScore`.
2752
- * Explicit per-route condition→constraint rules are the Phase-2 successor.
2753
- */
2754
- async hasAccess(credentials, requiredLevel) {
2755
- const result = await this.quickVerify(credentials);
2756
- return hasMinimumAccess(result.accessLevel, requiredLevel);
2757
- }
2758
- /**
2759
- * Get capabilities for a verified agent
2760
- */
2761
- async getCapabilities(credentials) {
2762
- const result = await this.quickVerify(credentials);
2763
- return getCapabilities(result.accessLevel);
2764
- }
2765
2622
  /**
2766
2623
  * Verify a specific ASTRA-ID
2767
2624
  */
@@ -5492,18 +5349,13 @@ function mcpToPdlss(parsed, requestPath, headerPurpose, headerAction, toolGate)
5492
5349
  }
5493
5350
  return { purpose, action, resource, purposeSource, actionSource };
5494
5351
  }
5495
- function mcpRiskTier(parsed) {
5496
- if (parsed.isInitialize || parsed.method === "notifications/initialized") return "none";
5497
- if (parsed.isIntrospection) return "none";
5498
- if (parsed.method === "resources/read") return "read-only";
5499
- if (parsed.isToolCall) return "standard";
5500
- return "standard";
5352
+ function mcpDefaultEnforced(parsed) {
5353
+ if (parsed.isInitialize || parsed.method === "notifications/initialized") return false;
5354
+ if (parsed.isIntrospection) return false;
5355
+ return true;
5501
5356
  }
5502
5357
 
5503
5358
  // src/adapters/mcp.ts
5504
- function normalizeToolGate(gate) {
5505
- return typeof gate === "string" ? { minAccessLevel: gate } : gate;
5506
- }
5507
5359
  function readSingleHeader(value) {
5508
5360
  if (typeof value === "string") return value;
5509
5361
  if (Array.isArray(value)) return value[0];
@@ -5556,7 +5408,6 @@ function defaultMcpDenied(result, req, res) {
5556
5408
  code: !result.identityVerified ? -32e3 : -32001,
5557
5409
  message: result.denialReasons?.[0] ?? "Access denied",
5558
5410
  data: {
5559
- accessLevel: result.accessLevel,
5560
5411
  guidance: result.guidance,
5561
5412
  // Round-10: aggregated per-dimension detail + correlation handle.
5562
5413
  failures: result.failures,
@@ -5569,20 +5420,19 @@ function defaultMcpDenied(result, req, res) {
5569
5420
  }
5570
5421
  });
5571
5422
  }
5572
- function resolveMinAccessLevel(parsed, opts) {
5423
+ function resolveGate(parsed, opts) {
5573
5424
  if (!parsed.toolName) {
5574
- if (opts.methodGates && opts.methodGates[parsed.method] !== void 0) {
5575
- return { level: opts.methodGates[parsed.method], source: "methodGate" };
5425
+ const methodGate = opts.methodGates?.[parsed.method];
5426
+ if (methodGate !== void 0) {
5427
+ return methodGate === "observe" ? { enforce: false, source: "methodGate" } : { enforce: true, config: methodGate, source: "methodGate" };
5576
5428
  }
5577
- return { level: "none", source: "discovery_default" };
5429
+ return { enforce: false, source: "discovery_default" };
5578
5430
  }
5579
- if (opts.toolGates && opts.toolGates[parsed.toolName] !== void 0) {
5580
- return {
5581
- level: normalizeToolGate(opts.toolGates[parsed.toolName]).minAccessLevel,
5582
- source: "toolGate"
5583
- };
5431
+ const toolGate = opts.toolGates?.[parsed.toolName];
5432
+ if (toolGate !== void 0) {
5433
+ return toolGate === "observe" ? { enforce: false, source: "toolGate" } : { enforce: true, config: toolGate, source: "toolGate" };
5584
5434
  }
5585
- return { level: mcpRiskTier(parsed), source: "tier" };
5435
+ return { enforce: mcpDefaultEnforced(parsed), source: "tier" };
5586
5436
  }
5587
5437
  function createMcpMiddleware(options) {
5588
5438
  const {
@@ -5602,15 +5452,6 @@ function createMcpMiddleware(options) {
5602
5452
  prefetchWellKnown(config.apiBaseUrl).catch(() => {
5603
5453
  });
5604
5454
  }
5605
- if (toolGates) {
5606
- for (const [toolName, gate] of Object.entries(toolGates)) {
5607
- if (typeof gate === "string") {
5608
- console.warn(
5609
- `[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: '...' }.`
5610
- );
5611
- }
5612
- }
5613
- }
5614
5455
  return async (req, res, next) => {
5615
5456
  try {
5616
5457
  if (skip) return next();
@@ -5659,7 +5500,7 @@ function createMcpMiddleware(options) {
5659
5500
  return next();
5660
5501
  }
5661
5502
  }
5662
- const { level: minAccessLevel } = resolveMinAccessLevel(parsed, {
5503
+ const gateDecision = resolveGate(parsed, {
5663
5504
  toolGates,
5664
5505
  methodGates
5665
5506
  });
@@ -5668,16 +5509,15 @@ function createMcpMiddleware(options) {
5668
5509
  req.query
5669
5510
  );
5670
5511
  if (effectiveAstraId) credentials.astraId = effectiveAstraId;
5671
- const shouldEnforce = minAccessLevel !== "none";
5672
- if (minAccessLevel === "none" && (!config.evaluateAlwaysIfCredentialed || !credentials.astraId)) {
5512
+ const shouldEnforce = gateDecision.enforce;
5513
+ if (!shouldEnforce && (!config.evaluateAlwaysIfCredentialed || !credentials.astraId)) {
5673
5514
  if (config.setPassThroughHeader) {
5674
5515
  res.setHeader("X-Astra-Gateway-Mode", "unenforced");
5675
- res.setHeader("X-Astra-Gateway-Reason", "mcp-tier-none");
5516
+ res.setHeader("X-Astra-Gateway-Reason", "mcp-observe");
5676
5517
  }
5677
5518
  return next();
5678
5519
  }
5679
- const rawGate = parsed.toolName && toolGates?.[parsed.toolName];
5680
- const gate = rawGate ? normalizeToolGate(rawGate) : void 0;
5520
+ const gate = gateDecision.config;
5681
5521
  const headerPurpose = readSingleHeader(req.headers["x-astra-purpose"]);
5682
5522
  const headerAction = readSingleHeader(req.headers["x-astra-action"]);
5683
5523
  const pdlss = mcpToPdlss(
@@ -5813,7 +5653,6 @@ function createMcpMiddleware(options) {
5813
5653
  const result = {
5814
5654
  identityVerified: false,
5815
5655
  policyAllowed: false,
5816
- accessLevel: "none",
5817
5656
  denialReasons: [`MCP middleware internal error: ${errorClass}`],
5818
5657
  failures: [
5819
5658
  {
@@ -6568,8 +6407,6 @@ function detectRuntime(userAgent) {
6568
6407
  return void 0;
6569
6408
  }
6570
6409
  export {
6571
- ACCESS_LEVEL_DESCRIPTIONS,
6572
- ACCESS_LEVEL_HIERARCHY,
6573
6410
  AgentClient,
6574
6411
  AstraSync,
6575
6412
  AstraSyncError,
@@ -6577,7 +6414,6 @@ export {
6577
6414
  CAPTURE_SCHEMA_VERSION,
6578
6415
  ChallengeHandler,
6579
6416
  DEFAULT_EDGE_CONFIG,
6580
- DEFAULT_TRUST_THRESHOLDS,
6581
6417
  KYDRequiredError,
6582
6418
  MAX_HEADERS,
6583
6419
  MAX_HEADER_VALUE_BYTES,
@@ -6604,7 +6440,6 @@ export {
6604
6440
  deriveConnectionFromHeaders,
6605
6441
  detectPlatformFingerprint,
6606
6442
  detectRuntime,
6607
- determineAccessLevel,
6608
6443
  express_exports as express,
6609
6444
  extractApiKeyFormat,
6610
6445
  extractCredentials,
@@ -6612,14 +6447,11 @@ export {
6612
6447
  extractPlatformHeaders,
6613
6448
  fetchEdgeConfig,
6614
6449
  fetchRoutes,
6615
- getAccessLevelForScore,
6616
6450
  getCachedWellKnownUrls,
6617
- getCapabilities,
6618
6451
  getEdgeConfig,
6619
6452
  getTrustLevel,
6620
6453
  getWellKnownUrls,
6621
6454
  hasCredentials,
6622
- hasMinimumAccess,
6623
6455
  isEdgeConfig,
6624
6456
  isVerifiedHopValidFor,
6625
6457
  matchEdgePathRule,