@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.js CHANGED
@@ -30,8 +30,6 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
30
30
  // src/index.ts
31
31
  var src_exports = {};
32
32
  __export(src_exports, {
33
- ACCESS_LEVEL_DESCRIPTIONS: () => ACCESS_LEVEL_DESCRIPTIONS,
34
- ACCESS_LEVEL_HIERARCHY: () => ACCESS_LEVEL_HIERARCHY,
35
33
  AgentClient: () => AgentClient,
36
34
  AstraSync: () => AstraSync,
37
35
  AstraSyncError: () => AstraSyncError,
@@ -39,7 +37,6 @@ __export(src_exports, {
39
37
  CAPTURE_SCHEMA_VERSION: () => CAPTURE_SCHEMA_VERSION,
40
38
  ChallengeHandler: () => ChallengeHandler,
41
39
  DEFAULT_EDGE_CONFIG: () => DEFAULT_EDGE_CONFIG,
42
- DEFAULT_TRUST_THRESHOLDS: () => DEFAULT_TRUST_THRESHOLDS,
43
40
  KYDRequiredError: () => KYDRequiredError,
44
41
  MAX_HEADERS: () => MAX_HEADERS,
45
42
  MAX_HEADER_VALUE_BYTES: () => MAX_HEADER_VALUE_BYTES,
@@ -66,7 +63,6 @@ __export(src_exports, {
66
63
  deriveConnectionFromHeaders: () => deriveConnectionFromHeaders,
67
64
  detectPlatformFingerprint: () => detectPlatformFingerprint,
68
65
  detectRuntime: () => detectRuntime,
69
- determineAccessLevel: () => determineAccessLevel,
70
66
  express: () => express_exports,
71
67
  extractApiKeyFormat: () => extractApiKeyFormat,
72
68
  extractCredentials: () => extractCredentials,
@@ -74,14 +70,11 @@ __export(src_exports, {
74
70
  extractPlatformHeaders: () => extractPlatformHeaders,
75
71
  fetchEdgeConfig: () => fetchEdgeConfig,
76
72
  fetchRoutes: () => fetchRoutes,
77
- getAccessLevelForScore: () => getAccessLevelForScore,
78
73
  getCachedWellKnownUrls: () => getCachedWellKnownUrls,
79
- getCapabilities: () => getCapabilities,
80
74
  getEdgeConfig: () => getEdgeConfig,
81
75
  getTrustLevel: () => getTrustLevel,
82
76
  getWellKnownUrls: () => getWellKnownUrls,
83
77
  hasCredentials: () => hasCredentials,
84
- hasMinimumAccess: () => hasMinimumAccess,
85
78
  isEdgeConfig: () => isEdgeConfig,
86
79
  isVerifiedHopValidFor: () => isVerifiedHopValidFor,
87
80
  matchEdgePathRule: () => matchEdgePathRule,
@@ -104,32 +97,7 @@ __export(src_exports, {
104
97
  });
105
98
  module.exports = __toCommonJS(src_exports);
106
99
 
107
- // src/access-levels.ts
108
- var ACCESS_LEVEL_HIERARCHY = {
109
- none: 0,
110
- restricted: 1,
111
- "read-only": 2,
112
- standard: 3,
113
- full: 4,
114
- internal: 5
115
- };
116
- var ACCESS_LEVEL_DESCRIPTIONS = {
117
- none: "No access - credentials required",
118
- restricted: "Restricted access - registration prompt only",
119
- "read-only": "Read-only access - can browse but not modify",
120
- standard: "Standard access - normal operations per PDLSS policy",
121
- full: "Full access - all operations for high-trust agents",
122
- internal: "Internal access - organization member privileges"
123
- };
124
- var DEFAULT_TRUST_THRESHOLDS = {
125
- none: 0,
126
- restricted: 0,
127
- "read-only": 20,
128
- standard: 40,
129
- full: 70,
130
- internal: 0
131
- // Internal is based on org membership, not score
132
- };
100
+ // src/trust-levels.ts
133
101
  var TRUST_LEVEL_RANGES = {
134
102
  BRONZE: { min: 0, max: 39 },
135
103
  SILVER: { min: 40, max: 59 },
@@ -142,91 +110,9 @@ function getTrustLevel(score) {
142
110
  if (score >= 40) return "SILVER";
143
111
  return "BRONZE";
144
112
  }
145
- function hasMinimumAccess(actual, required) {
146
- return ACCESS_LEVEL_HIERARCHY[actual] >= ACCESS_LEVEL_HIERARCHY[required];
147
- }
148
- function getAccessLevelForScore(trustScore, thresholds = DEFAULT_TRUST_THRESHOLDS) {
149
- if (trustScore >= thresholds.full) return "full";
150
- if (trustScore >= thresholds.standard) return "standard";
151
- if (trustScore >= thresholds["read-only"]) return "read-only";
152
- return "restricted";
153
- }
154
- function determineAccessLevel(verified, trustScore, isOrgMember, customThresholds) {
155
- if (!verified) {
156
- return "none";
157
- }
158
- if (isOrgMember) {
159
- return "internal";
160
- }
161
- const thresholds = {
162
- ...DEFAULT_TRUST_THRESHOLDS,
163
- ...customThresholds
164
- };
165
- return getAccessLevelForScore(trustScore, thresholds);
166
- }
167
- function getCapabilities(accessLevel) {
168
- switch (accessLevel) {
169
- case "none":
170
- return {
171
- canRead: false,
172
- canWrite: false,
173
- canDelete: false,
174
- canAdmin: false,
175
- canAccessInternal: false
176
- };
177
- case "restricted":
178
- return {
179
- canRead: false,
180
- canWrite: false,
181
- canDelete: false,
182
- canAdmin: false,
183
- canAccessInternal: false
184
- };
185
- case "read-only":
186
- return {
187
- canRead: true,
188
- canWrite: false,
189
- canDelete: false,
190
- canAdmin: false,
191
- canAccessInternal: false
192
- };
193
- case "standard":
194
- return {
195
- canRead: true,
196
- canWrite: true,
197
- canDelete: false,
198
- canAdmin: false,
199
- canAccessInternal: false
200
- };
201
- case "full":
202
- return {
203
- canRead: true,
204
- canWrite: true,
205
- canDelete: true,
206
- canAdmin: false,
207
- canAccessInternal: false
208
- };
209
- case "internal":
210
- return {
211
- canRead: true,
212
- canWrite: true,
213
- canDelete: true,
214
- canAdmin: true,
215
- canAccessInternal: true
216
- };
217
- default:
218
- return {
219
- canRead: false,
220
- canWrite: false,
221
- canDelete: false,
222
- canAdmin: false,
223
- canAccessInternal: false
224
- };
225
- }
226
- }
227
113
 
228
114
  // src/version.ts
229
- var SDK_VERSION = "4.6.0";
115
+ var SDK_VERSION = "5.0.0";
230
116
 
231
117
  // src/http.ts
232
118
  var SDK_USER_AGENT = `astrasync-sdk/${SDK_VERSION}`;
@@ -308,11 +194,6 @@ function getCachedWellKnownUrls(apiBaseUrl) {
308
194
  // src/verify.ts
309
195
  var DEFAULT_CONFIG = {
310
196
  apiBaseUrl: "https://astrasync.ai/api",
311
- // v2.3.9 (defect #30): default for unconfigured callers is `'none'` (no
312
- // access). Pre-rename this defaulted to `'guidance'`, which combined with
313
- // a route gated at `'guidance'` to silently let unverified traffic
314
- // through (`hasMinimumAccess('guidance', 'guidance') === true`).
315
- defaultAccessLevel: "none",
316
197
  // minTrustScore + minTrustScoreForFull deprecated in v2.3.0 — server decides.
317
198
  // cacheTtl deliberately unset. When undefined, cacheResult applies the 60s
318
199
  // default; the caller's explicit value is honoured for cacheable results.
@@ -475,6 +356,14 @@ function extractCredentials(headers, query) {
475
356
  function hasCredentials(credentials) {
476
357
  return !!(credentials.astraId || credentials.apiKey || credentials.jwt);
477
358
  }
359
+ function mcpGuidance(urls) {
360
+ if (!urls?.mcpEndpoint) return void 0;
361
+ return {
362
+ endpoint: urls.mcpEndpoint,
363
+ discoveryUrl: urls.mcpDiscoveryUrl,
364
+ 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."
365
+ };
366
+ }
478
367
  function createGuidanceResponse(_config, reason, options = {}) {
479
368
  const source = options.source ?? "no_credentials";
480
369
  const isApiError = source === "api_error";
@@ -501,11 +390,17 @@ function createGuidanceResponse(_config, reason, options = {}) {
501
390
  registrationUrl: urls?.registrationUrl ?? "",
502
391
  documentationUrl: urls?.documentationUrl ?? "",
503
392
  steps: [
393
+ // MCP steering leads when the hosted bridge is advertised — the
394
+ // connector is the agent-actionable path (keyless, human-approved).
395
+ ...urls?.mcpEndpoint ? [
396
+ `Fastest path (inside an MCP host): add the AstraSync MCP connector at ${urls.mcpEndpoint} \u2014 keyless, human-approved registration`
397
+ ] : [],
504
398
  "Register for an AstraSync account",
505
399
  "Create and register your agent",
506
400
  "Add your ASTRA-ID to request headers",
507
401
  "Retry your request"
508
- ]
402
+ ],
403
+ ...mcpGuidance(urls) && { mcp: mcpGuidance(urls) }
509
404
  };
510
405
  return {
511
406
  // Round-18 G4: createGuidanceResponse fires for unverified-agent path or
@@ -513,13 +408,6 @@ function createGuidanceResponse(_config, reason, options = {}) {
513
408
  // policy is not evaluated (we never reached the gate).
514
409
  identityVerified: false,
515
410
  policyAllowed: false,
516
- // v2.3.9 (defect #30): denials grant `'none'`, NEVER a positive band.
517
- // Adapters additionally short-circuit on `!identityVerified ||
518
- // !policyAllowed` before the gate check, but the access level still has
519
- // to be honest at the data layer so downstream consumers (SDK adapters
520
- // in other languages, custom integrations) inherit the correct
521
- // semantics.
522
- accessLevel: "none",
523
411
  guidance,
524
412
  denialReasons: reason ? [reason] : ["No valid agent credentials provided"],
525
413
  // Round-10 (#47, O5): on API-error fallback, surface a typed failure so
@@ -613,7 +501,6 @@ async function callVerifyAccessAPI(config, request) {
613
501
  attemptId: typeof data?.attemptId === "string" ? data.attemptId : void 0,
614
502
  access: {
615
503
  allowed: false,
616
- accessLevel: "none",
617
504
  reason: "endpoint_deactivated",
618
505
  failures: [
619
506
  {
@@ -676,7 +563,7 @@ async function verify(config, request, options) {
676
563
  if (!deprecationWarningShown && (config.minTrustScore !== void 0 || config.minTrustScoreForFull !== void 0)) {
677
564
  deprecationWarningShown = true;
678
565
  console.warn(
679
- "[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."
566
+ "[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."
680
567
  );
681
568
  }
682
569
  if (mergedConfig.cacheTtl !== 0 && !options?.bypassCache) {
@@ -722,14 +609,6 @@ async function verify(config, request, options) {
722
609
  const result2 = {
723
610
  identityVerified: idVerifiedFromBackend,
724
611
  policyAllowed: false,
725
- // v2.3.9 (defect #30): denials grant `'none'`, NEVER a positive band.
726
- // Pre-rename this hardcoded `'guidance'`, which conflated with the
727
- // colocated `guidance: {...}` help-payload object below and let
728
- // denied requests pass any route gated at `'guidance'` because
729
- // `hasMinimumAccess('guidance', 'guidance') === true`. Adapters now
730
- // ALSO short-circuit on `!identityVerified || !policyAllowed` before
731
- // the gate check — belt-and-braces.
732
- accessLevel: "none",
733
612
  // 3.6.0: the server now emits top-level denialReasons on every deny
734
613
  // path — prefer it verbatim; the failure-message reconstruction remains
735
614
  // as the fallback for older backends.
@@ -740,7 +619,10 @@ async function verify(config, request, options) {
740
619
  guidance: {
741
620
  message: apiResponse.access?.reason || "Access denied by PDLSS policy",
742
621
  registrationUrl: urls?.registrationUrl ?? "",
743
- documentationUrl: urls?.documentationUrl ?? ""
622
+ documentationUrl: urls?.documentationUrl ?? "",
623
+ // 5.1.0: anonymous callers land on this branch — steer MCP-hosted
624
+ // agents to the connector (this is what the edge deny body surfaces).
625
+ ...mcpGuidance(urls) && { mcp: mcpGuidance(urls) }
744
626
  },
745
627
  verifiedAt: /* @__PURE__ */ new Date(),
746
628
  // Extract sessionId so decisions can be recorded for denials too
@@ -778,7 +660,6 @@ async function verify(config, request, options) {
778
660
  trustScore: apiResponse.organization.trustScore
779
661
  } : void 0;
780
662
  const verificationContext = apiResponse.verificationContext;
781
- const accessLevel = apiResponse.access?.accessLevel ?? "standard";
782
663
  const result = {
783
664
  // 4.5.0 (probe F1): read idVerified from verificationContext with the
784
665
  // SAME absent⇒false default as the deny branch. The previous `!== false`
@@ -790,7 +671,6 @@ async function verify(config, request, options) {
790
671
  // this load-bearing must never be defaulted on.
791
672
  identityVerified: apiResponse.verificationContext?.idVerified === true,
792
673
  policyAllowed: true,
793
- accessLevel,
794
674
  agent,
795
675
  developer,
796
676
  organization,
@@ -817,7 +697,6 @@ async function verify(config, request, options) {
817
697
  };
818
698
  if (result.recommendation === "deny") {
819
699
  result.policyAllowed = false;
820
- result.accessLevel = "none";
821
700
  result.denialReasons = serverDenialReasons ?? result.recommendationReasons ?? ["Access denied by AstraSync recommendation"];
822
701
  result.guidance = result.runtimeChallenge ? {
823
702
  message: `Verification failed: ${result.runtimeChallenge.reason || "runtime challenge failed"}`,
@@ -920,7 +799,6 @@ async function quickVerify(config, credentials) {
920
799
  return {
921
800
  identityVerified: result.identityVerified,
922
801
  policyAllowed: result.policyAllowed,
923
- accessLevel: result.accessLevel,
924
802
  reason: result.denialReasons?.[0]
925
803
  };
926
804
  }
@@ -1950,7 +1828,6 @@ function defaultOnDenied(result, _req, res) {
1950
1828
  error: {
1951
1829
  code: !result.identityVerified ? "UNAUTHORIZED" : "INSUFFICIENT_ACCESS",
1952
1830
  message: result.denialReasons?.[0] || "Access denied",
1953
- accessLevel: result.accessLevel,
1954
1831
  guidance: result.guidance,
1955
1832
  // Round-10: aggregated per-dimension detail + correlation handle.
1956
1833
  failures: result.failures,
@@ -2066,11 +1943,11 @@ function createMiddleware(options) {
2066
1943
  }
2067
1944
  const wellKnownUrls = config.apiBaseUrl ? await getWellKnownUrls(config.apiBaseUrl).catch(() => void 0) : void 0;
2068
1945
  const credentials = customExtractCredentials ? customExtractCredentials(req) : defaultExtractCredentials(req);
2069
- const shouldEnforce = routeConfig.minAccessLevel !== "none";
2070
- if (routeConfig.minAccessLevel === "none" && (!config.evaluateAlwaysIfCredentialed || !credentials.astraId)) {
1946
+ const shouldEnforce = !routeConfig.observe;
1947
+ if (routeConfig.observe && (!config.evaluateAlwaysIfCredentialed || !credentials.astraId)) {
2071
1948
  if (config.setPassThroughHeader) {
2072
1949
  res.setHeader("X-Astra-Gateway-Mode", "unenforced");
2073
- res.setHeader("X-Astra-Gateway-Reason", "route-none");
1950
+ res.setHeader("X-Astra-Gateway-Reason", "route-observe");
2074
1951
  }
2075
1952
  beaconPassThrough?.(req);
2076
1953
  return next();
@@ -2107,7 +1984,6 @@ function createMiddleware(options) {
2107
1984
  const result2 = {
2108
1985
  identityVerified: false,
2109
1986
  policyAllowed: false,
2110
- accessLevel: "none",
2111
1987
  denialReasons: preCheckFailures.map((f) => f.message),
2112
1988
  guidance: {
2113
1989
  message: "Request exceeds counterparty-defined PDLSS limits.",
@@ -2270,7 +2146,6 @@ function createMiddleware(options) {
2270
2146
  const result = {
2271
2147
  identityVerified: false,
2272
2148
  policyAllowed: false,
2273
- accessLevel: "none",
2274
2149
  denialReasons: [`Verification middleware internal error: ${errorClass}`],
2275
2150
  failures: [
2276
2151
  {
@@ -2599,7 +2474,7 @@ function createMiddleware2(options) {
2599
2474
  beaconPassThrough?.(request, pathname);
2600
2475
  return NextResponse.next();
2601
2476
  }
2602
- if (routeConfig.minAccessLevel === "none") {
2477
+ if (routeConfig.observe) {
2603
2478
  beaconPassThrough?.(request, pathname);
2604
2479
  return NextResponse.next();
2605
2480
  }
@@ -2629,7 +2504,6 @@ function createMiddleware2(options) {
2629
2504
  const preCheckResult = {
2630
2505
  identityVerified: false,
2631
2506
  policyAllowed: false,
2632
- accessLevel: "none",
2633
2507
  denialReasons: preCheckFailures.map((f) => f.message),
2634
2508
  guidance: {
2635
2509
  message: "Request exceeds counterparty-defined PDLSS limits.",
@@ -2767,7 +2641,6 @@ function createMiddleware2(options) {
2767
2641
  }
2768
2642
  response.headers.set("X-AstraSync-Identity-Verified", result.identityVerified.toString());
2769
2643
  response.headers.set("X-AstraSync-Policy-Allowed", result.policyAllowed.toString());
2770
- response.headers.set("X-AstraSync-Access-Level", result.accessLevel);
2771
2644
  if (result.agent) {
2772
2645
  response.headers.set("X-AstraSync-Agent-Id", result.agent.astraId);
2773
2646
  }
@@ -2783,9 +2656,7 @@ var sdk_exports = {};
2783
2656
  __export(sdk_exports, {
2784
2657
  VerificationGatewayClient: () => VerificationGatewayClient,
2785
2658
  createClient: () => createClient,
2786
- getCapabilities: () => getCapabilities,
2787
2659
  getTrustLevel: () => getTrustLevel,
2788
- hasMinimumAccess: () => hasMinimumAccess,
2789
2660
  verifyOnce: () => verifyOnce
2790
2661
  });
2791
2662
  var VerificationGatewayClient = class {
@@ -2793,7 +2664,6 @@ var VerificationGatewayClient = class {
2793
2664
  this.config = {
2794
2665
  apiBaseUrl: options.apiBaseUrl,
2795
2666
  apiKey: options.apiKey,
2796
- defaultAccessLevel: options.defaultAccessLevel,
2797
2667
  minTrustScore: options.minTrustScore,
2798
2668
  minTrustScoreForFull: options.minTrustScoreForFull,
2799
2669
  cacheTtl: options.cacheTtl,
@@ -2842,26 +2712,6 @@ var VerificationGatewayClient = class {
2842
2712
  async quickVerify(credentials) {
2843
2713
  return this.executeWithRetry(() => quickVerify(this.config, credentials));
2844
2714
  }
2845
- /**
2846
- * Check if an agent has a specific access level.
2847
- *
2848
- * @deprecated 3.2.0 — the access-level band is informational only; it no
2849
- * longer gates in the middleware adapters (post-3.1.0 feedback #1). This
2850
- * explicit opt-in query still works, but prefer gating on the server-side
2851
- * policy decision (identity + policy + trust) or per-route `minTrustScore`.
2852
- * Explicit per-route condition→constraint rules are the Phase-2 successor.
2853
- */
2854
- async hasAccess(credentials, requiredLevel) {
2855
- const result = await this.quickVerify(credentials);
2856
- return hasMinimumAccess(result.accessLevel, requiredLevel);
2857
- }
2858
- /**
2859
- * Get capabilities for a verified agent
2860
- */
2861
- async getCapabilities(credentials) {
2862
- const result = await this.quickVerify(credentials);
2863
- return getCapabilities(result.accessLevel);
2864
- }
2865
2715
  /**
2866
2716
  * Verify a specific ASTRA-ID
2867
2717
  */
@@ -5589,18 +5439,13 @@ function mcpToPdlss(parsed, requestPath, headerPurpose, headerAction, toolGate)
5589
5439
  }
5590
5440
  return { purpose, action, resource, purposeSource, actionSource };
5591
5441
  }
5592
- function mcpRiskTier(parsed) {
5593
- if (parsed.isInitialize || parsed.method === "notifications/initialized") return "none";
5594
- if (parsed.isIntrospection) return "none";
5595
- if (parsed.method === "resources/read") return "read-only";
5596
- if (parsed.isToolCall) return "standard";
5597
- return "standard";
5442
+ function mcpDefaultEnforced(parsed) {
5443
+ if (parsed.isInitialize || parsed.method === "notifications/initialized") return false;
5444
+ if (parsed.isIntrospection) return false;
5445
+ return true;
5598
5446
  }
5599
5447
 
5600
5448
  // src/adapters/mcp.ts
5601
- function normalizeToolGate(gate) {
5602
- return typeof gate === "string" ? { minAccessLevel: gate } : gate;
5603
- }
5604
5449
  function readSingleHeader(value) {
5605
5450
  if (typeof value === "string") return value;
5606
5451
  if (Array.isArray(value)) return value[0];
@@ -5653,7 +5498,6 @@ function defaultMcpDenied(result, req, res) {
5653
5498
  code: !result.identityVerified ? -32e3 : -32001,
5654
5499
  message: result.denialReasons?.[0] ?? "Access denied",
5655
5500
  data: {
5656
- accessLevel: result.accessLevel,
5657
5501
  guidance: result.guidance,
5658
5502
  // Round-10: aggregated per-dimension detail + correlation handle.
5659
5503
  failures: result.failures,
@@ -5666,20 +5510,19 @@ function defaultMcpDenied(result, req, res) {
5666
5510
  }
5667
5511
  });
5668
5512
  }
5669
- function resolveMinAccessLevel(parsed, opts) {
5513
+ function resolveGate(parsed, opts) {
5670
5514
  if (!parsed.toolName) {
5671
- if (opts.methodGates && opts.methodGates[parsed.method] !== void 0) {
5672
- return { level: opts.methodGates[parsed.method], source: "methodGate" };
5515
+ const methodGate = opts.methodGates?.[parsed.method];
5516
+ if (methodGate !== void 0) {
5517
+ return methodGate === "observe" ? { enforce: false, source: "methodGate" } : { enforce: true, config: methodGate, source: "methodGate" };
5673
5518
  }
5674
- return { level: "none", source: "discovery_default" };
5519
+ return { enforce: false, source: "discovery_default" };
5675
5520
  }
5676
- if (opts.toolGates && opts.toolGates[parsed.toolName] !== void 0) {
5677
- return {
5678
- level: normalizeToolGate(opts.toolGates[parsed.toolName]).minAccessLevel,
5679
- source: "toolGate"
5680
- };
5521
+ const toolGate = opts.toolGates?.[parsed.toolName];
5522
+ if (toolGate !== void 0) {
5523
+ return toolGate === "observe" ? { enforce: false, source: "toolGate" } : { enforce: true, config: toolGate, source: "toolGate" };
5681
5524
  }
5682
- return { level: mcpRiskTier(parsed), source: "tier" };
5525
+ return { enforce: mcpDefaultEnforced(parsed), source: "tier" };
5683
5526
  }
5684
5527
  function createMcpMiddleware(options) {
5685
5528
  const {
@@ -5699,15 +5542,6 @@ function createMcpMiddleware(options) {
5699
5542
  prefetchWellKnown(config.apiBaseUrl).catch(() => {
5700
5543
  });
5701
5544
  }
5702
- if (toolGates) {
5703
- for (const [toolName, gate] of Object.entries(toolGates)) {
5704
- if (typeof gate === "string") {
5705
- console.warn(
5706
- `[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: '...' }.`
5707
- );
5708
- }
5709
- }
5710
- }
5711
5545
  return async (req, res, next) => {
5712
5546
  try {
5713
5547
  if (skip) return next();
@@ -5756,7 +5590,7 @@ function createMcpMiddleware(options) {
5756
5590
  return next();
5757
5591
  }
5758
5592
  }
5759
- const { level: minAccessLevel } = resolveMinAccessLevel(parsed, {
5593
+ const gateDecision = resolveGate(parsed, {
5760
5594
  toolGates,
5761
5595
  methodGates
5762
5596
  });
@@ -5765,16 +5599,15 @@ function createMcpMiddleware(options) {
5765
5599
  req.query
5766
5600
  );
5767
5601
  if (effectiveAstraId) credentials.astraId = effectiveAstraId;
5768
- const shouldEnforce = minAccessLevel !== "none";
5769
- if (minAccessLevel === "none" && (!config.evaluateAlwaysIfCredentialed || !credentials.astraId)) {
5602
+ const shouldEnforce = gateDecision.enforce;
5603
+ if (!shouldEnforce && (!config.evaluateAlwaysIfCredentialed || !credentials.astraId)) {
5770
5604
  if (config.setPassThroughHeader) {
5771
5605
  res.setHeader("X-Astra-Gateway-Mode", "unenforced");
5772
- res.setHeader("X-Astra-Gateway-Reason", "mcp-tier-none");
5606
+ res.setHeader("X-Astra-Gateway-Reason", "mcp-observe");
5773
5607
  }
5774
5608
  return next();
5775
5609
  }
5776
- const rawGate = parsed.toolName && toolGates?.[parsed.toolName];
5777
- const gate = rawGate ? normalizeToolGate(rawGate) : void 0;
5610
+ const gate = gateDecision.config;
5778
5611
  const headerPurpose = readSingleHeader(req.headers["x-astra-purpose"]);
5779
5612
  const headerAction = readSingleHeader(req.headers["x-astra-action"]);
5780
5613
  const pdlss = mcpToPdlss(
@@ -5910,7 +5743,6 @@ function createMcpMiddleware(options) {
5910
5743
  const result = {
5911
5744
  identityVerified: false,
5912
5745
  policyAllowed: false,
5913
- accessLevel: "none",
5914
5746
  denialReasons: [`MCP middleware internal error: ${errorClass}`],
5915
5747
  failures: [
5916
5748
  {
@@ -6666,8 +6498,6 @@ function detectRuntime(userAgent) {
6666
6498
  }
6667
6499
  // Annotate the CommonJS export names for ESM import in node:
6668
6500
  0 && (module.exports = {
6669
- ACCESS_LEVEL_DESCRIPTIONS,
6670
- ACCESS_LEVEL_HIERARCHY,
6671
6501
  AgentClient,
6672
6502
  AstraSync,
6673
6503
  AstraSyncError,
@@ -6675,7 +6505,6 @@ function detectRuntime(userAgent) {
6675
6505
  CAPTURE_SCHEMA_VERSION,
6676
6506
  ChallengeHandler,
6677
6507
  DEFAULT_EDGE_CONFIG,
6678
- DEFAULT_TRUST_THRESHOLDS,
6679
6508
  KYDRequiredError,
6680
6509
  MAX_HEADERS,
6681
6510
  MAX_HEADER_VALUE_BYTES,
@@ -6702,7 +6531,6 @@ function detectRuntime(userAgent) {
6702
6531
  deriveConnectionFromHeaders,
6703
6532
  detectPlatformFingerprint,
6704
6533
  detectRuntime,
6705
- determineAccessLevel,
6706
6534
  express,
6707
6535
  extractApiKeyFormat,
6708
6536
  extractCredentials,
@@ -6710,14 +6538,11 @@ function detectRuntime(userAgent) {
6710
6538
  extractPlatformHeaders,
6711
6539
  fetchEdgeConfig,
6712
6540
  fetchRoutes,
6713
- getAccessLevelForScore,
6714
6541
  getCachedWellKnownUrls,
6715
- getCapabilities,
6716
6542
  getEdgeConfig,
6717
6543
  getTrustLevel,
6718
6544
  getWellKnownUrls,
6719
6545
  hasCredentials,
6720
- hasMinimumAccess,
6721
6546
  isEdgeConfig,
6722
6547
  isVerifiedHopValidFor,
6723
6548
  matchEdgePathRule,