@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
@@ -36,7 +36,7 @@ var SDK_VERSION;
36
36
  var init_version = __esm({
37
37
  "src/version.ts"() {
38
38
  "use strict";
39
- SDK_VERSION = "4.6.0";
39
+ SDK_VERSION = "5.0.0";
40
40
  }
41
41
  });
42
42
 
@@ -5065,15 +5065,15 @@ var init_local = __esm({
5065
5065
  }
5066
5066
  });
5067
5067
 
5068
- // src/access-levels.ts
5068
+ // src/trust-levels.ts
5069
5069
  function getTrustLevel(score) {
5070
5070
  if (score >= 80) return "PLATINUM";
5071
5071
  if (score >= 60) return "GOLD";
5072
5072
  if (score >= 40) return "SILVER";
5073
5073
  return "BRONZE";
5074
5074
  }
5075
- var init_access_levels = __esm({
5076
- "src/access-levels.ts"() {
5075
+ var init_trust_levels = __esm({
5076
+ "src/trust-levels.ts"() {
5077
5077
  "use strict";
5078
5078
  }
5079
5079
  });
@@ -5204,6 +5204,14 @@ function cacheResult(request2, result, configuredTtl, counterpartyId) {
5204
5204
  expiresAt: Date.now() + ttlSeconds * 1e3
5205
5205
  });
5206
5206
  }
5207
+ function mcpGuidance(urls) {
5208
+ if (!urls?.mcpEndpoint) return void 0;
5209
+ return {
5210
+ endpoint: urls.mcpEndpoint,
5211
+ discoveryUrl: urls.mcpDiscoveryUrl,
5212
+ 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."
5213
+ };
5214
+ }
5207
5215
  function createGuidanceResponse(_config, reason, options = {}) {
5208
5216
  const source = options.source ?? "no_credentials";
5209
5217
  const isApiError = source === "api_error";
@@ -5230,11 +5238,17 @@ function createGuidanceResponse(_config, reason, options = {}) {
5230
5238
  registrationUrl: urls?.registrationUrl ?? "",
5231
5239
  documentationUrl: urls?.documentationUrl ?? "",
5232
5240
  steps: [
5241
+ // MCP steering leads when the hosted bridge is advertised — the
5242
+ // connector is the agent-actionable path (keyless, human-approved).
5243
+ ...urls?.mcpEndpoint ? [
5244
+ `Fastest path (inside an MCP host): add the AstraSync MCP connector at ${urls.mcpEndpoint} \u2014 keyless, human-approved registration`
5245
+ ] : [],
5233
5246
  "Register for an AstraSync account",
5234
5247
  "Create and register your agent",
5235
5248
  "Add your ASTRA-ID to request headers",
5236
5249
  "Retry your request"
5237
- ]
5250
+ ],
5251
+ ...mcpGuidance(urls) && { mcp: mcpGuidance(urls) }
5238
5252
  };
5239
5253
  return {
5240
5254
  // Round-18 G4: createGuidanceResponse fires for unverified-agent path or
@@ -5242,13 +5256,6 @@ function createGuidanceResponse(_config, reason, options = {}) {
5242
5256
  // policy is not evaluated (we never reached the gate).
5243
5257
  identityVerified: false,
5244
5258
  policyAllowed: false,
5245
- // v2.3.9 (defect #30): denials grant `'none'`, NEVER a positive band.
5246
- // Adapters additionally short-circuit on `!identityVerified ||
5247
- // !policyAllowed` before the gate check, but the access level still has
5248
- // to be honest at the data layer so downstream consumers (SDK adapters
5249
- // in other languages, custom integrations) inherit the correct
5250
- // semantics.
5251
- accessLevel: "none",
5252
5259
  guidance,
5253
5260
  denialReasons: reason ? [reason] : ["No valid agent credentials provided"],
5254
5261
  // Round-10 (#47, O5): on API-error fallback, surface a typed failure so
@@ -5342,7 +5349,6 @@ async function callVerifyAccessAPI(config, request2) {
5342
5349
  attemptId: typeof data?.attemptId === "string" ? data.attemptId : void 0,
5343
5350
  access: {
5344
5351
  allowed: false,
5345
- accessLevel: "none",
5346
5352
  reason: "endpoint_deactivated",
5347
5353
  failures: [
5348
5354
  {
@@ -5405,7 +5411,7 @@ async function verify(config, request2, options) {
5405
5411
  if (!deprecationWarningShown && (config.minTrustScore !== void 0 || config.minTrustScoreForFull !== void 0)) {
5406
5412
  deprecationWarningShown = true;
5407
5413
  console.warn(
5408
- "[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."
5414
+ "[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."
5409
5415
  );
5410
5416
  }
5411
5417
  if (mergedConfig.cacheTtl !== 0 && !options?.bypassCache) {
@@ -5451,14 +5457,6 @@ async function verify(config, request2, options) {
5451
5457
  const result2 = {
5452
5458
  identityVerified: idVerifiedFromBackend,
5453
5459
  policyAllowed: false,
5454
- // v2.3.9 (defect #30): denials grant `'none'`, NEVER a positive band.
5455
- // Pre-rename this hardcoded `'guidance'`, which conflated with the
5456
- // colocated `guidance: {...}` help-payload object below and let
5457
- // denied requests pass any route gated at `'guidance'` because
5458
- // `hasMinimumAccess('guidance', 'guidance') === true`. Adapters now
5459
- // ALSO short-circuit on `!identityVerified || !policyAllowed` before
5460
- // the gate check — belt-and-braces.
5461
- accessLevel: "none",
5462
5460
  // 3.6.0: the server now emits top-level denialReasons on every deny
5463
5461
  // path — prefer it verbatim; the failure-message reconstruction remains
5464
5462
  // as the fallback for older backends.
@@ -5469,7 +5467,10 @@ async function verify(config, request2, options) {
5469
5467
  guidance: {
5470
5468
  message: apiResponse.access?.reason || "Access denied by PDLSS policy",
5471
5469
  registrationUrl: urls?.registrationUrl ?? "",
5472
- documentationUrl: urls?.documentationUrl ?? ""
5470
+ documentationUrl: urls?.documentationUrl ?? "",
5471
+ // 5.1.0: anonymous callers land on this branch — steer MCP-hosted
5472
+ // agents to the connector (this is what the edge deny body surfaces).
5473
+ ...mcpGuidance(urls) && { mcp: mcpGuidance(urls) }
5473
5474
  },
5474
5475
  verifiedAt: /* @__PURE__ */ new Date(),
5475
5476
  // Extract sessionId so decisions can be recorded for denials too
@@ -5507,7 +5508,6 @@ async function verify(config, request2, options) {
5507
5508
  trustScore: apiResponse.organization.trustScore
5508
5509
  } : void 0;
5509
5510
  const verificationContext = apiResponse.verificationContext;
5510
- const accessLevel = apiResponse.access?.accessLevel ?? "standard";
5511
5511
  const result = {
5512
5512
  // 4.5.0 (probe F1): read idVerified from verificationContext with the
5513
5513
  // SAME absent⇒false default as the deny branch. The previous `!== false`
@@ -5519,7 +5519,6 @@ async function verify(config, request2, options) {
5519
5519
  // this load-bearing must never be defaulted on.
5520
5520
  identityVerified: apiResponse.verificationContext?.idVerified === true,
5521
5521
  policyAllowed: true,
5522
- accessLevel,
5523
5522
  agent,
5524
5523
  developer,
5525
5524
  organization,
@@ -5546,7 +5545,6 @@ async function verify(config, request2, options) {
5546
5545
  };
5547
5546
  if (result.recommendation === "deny") {
5548
5547
  result.policyAllowed = false;
5549
- result.accessLevel = "none";
5550
5548
  result.denialReasons = serverDenialReasons ?? result.recommendationReasons ?? ["Access denied by AstraSync recommendation"];
5551
5549
  result.guidance = result.runtimeChallenge ? {
5552
5550
  message: `Verification failed: ${result.runtimeChallenge.reason || "runtime challenge failed"}`,
@@ -5572,16 +5570,11 @@ var init_verify = __esm({
5572
5570
  "src/verify.ts"() {
5573
5571
  "use strict";
5574
5572
  init_http();
5575
- init_access_levels();
5573
+ init_trust_levels();
5576
5574
  init_version();
5577
5575
  init_well_known();
5578
5576
  DEFAULT_CONFIG = {
5579
5577
  apiBaseUrl: "https://astrasync.ai/api",
5580
- // v2.3.9 (defect #30): default for unconfigured callers is `'none'` (no
5581
- // access). Pre-rename this defaulted to `'guidance'`, which combined with
5582
- // a route gated at `'guidance'` to silently let unverified traffic
5583
- // through (`hasMinimumAccess('guidance', 'guidance') === true`).
5584
- defaultAccessLevel: "none",
5585
5578
  // minTrustScore + minTrustScoreForFull deprecated in v2.3.0 — server decides.
5586
5579
  // cacheTtl deliberately unset. When undefined, cacheResult applies the 60s
5587
5580
  // default; the caller's explicit value is honoured for cacheable results.
@@ -5778,7 +5771,7 @@ var init_sdk = __esm({
5778
5771
  "src/adapters/sdk.ts"() {
5779
5772
  "use strict";
5780
5773
  init_verify();
5781
- init_access_levels();
5774
+ init_trust_levels();
5782
5775
  }
5783
5776
  });
5784
5777
 
@@ -6172,7 +6165,7 @@ var init_runtime_signatures = __esm({
6172
6165
  var init_src = __esm({
6173
6166
  "src/index.ts"() {
6174
6167
  "use strict";
6175
- init_access_levels();
6168
+ init_trust_levels();
6176
6169
  init_verify();
6177
6170
  init_stepup_poll();
6178
6171
  init_settlement();
@@ -6205,7 +6198,6 @@ function toGatewayConfig(config) {
6205
6198
  return {
6206
6199
  apiBaseUrl: config.apiBaseUrl || "https://api.astrasync.ai",
6207
6200
  apiKey: config.apiKey,
6208
- defaultAccessLevel: config.defaultAccessLevel,
6209
6201
  minTrustScore: config.minTrustScore,
6210
6202
  minTrustScoreForFull: config.minTrustScoreForFull,
6211
6203
  cacheTtl: config.cacheTtl,
@@ -6233,7 +6225,7 @@ function toDecision(result) {
6233
6225
  if (result.identityVerified && result.policyAllowed) {
6234
6226
  return {
6235
6227
  recommendation: "ALLOW",
6236
- reason: `Verified with access level: ${result.accessLevel}`,
6228
+ reason: result.agent?.trustScore ? `Verified (trust score ${result.agent.trustScore})` : "Verified",
6237
6229
  trustScore: result.agent?.trustScore,
6238
6230
  sessionId: "sessionId" in result ? result.sessionId : void 0
6239
6231
  };
@@ -3971,7 +3971,7 @@ function verifyLocal(evaluator, context) {
3971
3971
  return evaluator.evaluate(context);
3972
3972
  }
3973
3973
 
3974
- // src/access-levels.ts
3974
+ // src/trust-levels.ts
3975
3975
  function getTrustLevel(score) {
3976
3976
  if (score >= 80) return "PLATINUM";
3977
3977
  if (score >= 60) return "GOLD";
@@ -3980,7 +3980,7 @@ function getTrustLevel(score) {
3980
3980
  }
3981
3981
 
3982
3982
  // src/version.ts
3983
- var SDK_VERSION = "4.6.0";
3983
+ var SDK_VERSION = "5.0.0";
3984
3984
 
3985
3985
  // src/http.ts
3986
3986
  var SDK_USER_AGENT = `astrasync-sdk/${SDK_VERSION}`;
@@ -4010,11 +4010,6 @@ function getCachedWellKnownUrls(apiBaseUrl) {
4010
4010
  // src/verify.ts
4011
4011
  var DEFAULT_CONFIG = {
4012
4012
  apiBaseUrl: "https://astrasync.ai/api",
4013
- // v2.3.9 (defect #30): default for unconfigured callers is `'none'` (no
4014
- // access). Pre-rename this defaulted to `'guidance'`, which combined with
4015
- // a route gated at `'guidance'` to silently let unverified traffic
4016
- // through (`hasMinimumAccess('guidance', 'guidance') === true`).
4017
- defaultAccessLevel: "none",
4018
4013
  // minTrustScore + minTrustScoreForFull deprecated in v2.3.0 — server decides.
4019
4014
  // cacheTtl deliberately unset. When undefined, cacheResult applies the 60s
4020
4015
  // default; the caller's explicit value is honoured for cacheable results.
@@ -4137,6 +4132,14 @@ function cacheResult(request, result, configuredTtl, counterpartyId) {
4137
4132
  expiresAt: Date.now() + ttlSeconds * 1e3
4138
4133
  });
4139
4134
  }
4135
+ function mcpGuidance(urls) {
4136
+ if (!urls?.mcpEndpoint) return void 0;
4137
+ return {
4138
+ endpoint: urls.mcpEndpoint,
4139
+ discoveryUrl: urls.mcpDiscoveryUrl,
4140
+ 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."
4141
+ };
4142
+ }
4140
4143
  function createGuidanceResponse(_config, reason, options = {}) {
4141
4144
  const source = options.source ?? "no_credentials";
4142
4145
  const isApiError = source === "api_error";
@@ -4163,11 +4166,17 @@ function createGuidanceResponse(_config, reason, options = {}) {
4163
4166
  registrationUrl: urls?.registrationUrl ?? "",
4164
4167
  documentationUrl: urls?.documentationUrl ?? "",
4165
4168
  steps: [
4169
+ // MCP steering leads when the hosted bridge is advertised — the
4170
+ // connector is the agent-actionable path (keyless, human-approved).
4171
+ ...urls?.mcpEndpoint ? [
4172
+ `Fastest path (inside an MCP host): add the AstraSync MCP connector at ${urls.mcpEndpoint} \u2014 keyless, human-approved registration`
4173
+ ] : [],
4166
4174
  "Register for an AstraSync account",
4167
4175
  "Create and register your agent",
4168
4176
  "Add your ASTRA-ID to request headers",
4169
4177
  "Retry your request"
4170
- ]
4178
+ ],
4179
+ ...mcpGuidance(urls) && { mcp: mcpGuidance(urls) }
4171
4180
  };
4172
4181
  return {
4173
4182
  // Round-18 G4: createGuidanceResponse fires for unverified-agent path or
@@ -4175,13 +4184,6 @@ function createGuidanceResponse(_config, reason, options = {}) {
4175
4184
  // policy is not evaluated (we never reached the gate).
4176
4185
  identityVerified: false,
4177
4186
  policyAllowed: false,
4178
- // v2.3.9 (defect #30): denials grant `'none'`, NEVER a positive band.
4179
- // Adapters additionally short-circuit on `!identityVerified ||
4180
- // !policyAllowed` before the gate check, but the access level still has
4181
- // to be honest at the data layer so downstream consumers (SDK adapters
4182
- // in other languages, custom integrations) inherit the correct
4183
- // semantics.
4184
- accessLevel: "none",
4185
4187
  guidance,
4186
4188
  denialReasons: reason ? [reason] : ["No valid agent credentials provided"],
4187
4189
  // Round-10 (#47, O5): on API-error fallback, surface a typed failure so
@@ -4275,7 +4277,6 @@ async function callVerifyAccessAPI(config, request) {
4275
4277
  attemptId: typeof data?.attemptId === "string" ? data.attemptId : void 0,
4276
4278
  access: {
4277
4279
  allowed: false,
4278
- accessLevel: "none",
4279
4280
  reason: "endpoint_deactivated",
4280
4281
  failures: [
4281
4282
  {
@@ -4338,7 +4339,7 @@ async function verify(config, request, options) {
4338
4339
  if (!deprecationWarningShown && (config.minTrustScore !== void 0 || config.minTrustScoreForFull !== void 0)) {
4339
4340
  deprecationWarningShown = true;
4340
4341
  console.warn(
4341
- "[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."
4342
+ "[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."
4342
4343
  );
4343
4344
  }
4344
4345
  if (mergedConfig.cacheTtl !== 0 && !options?.bypassCache) {
@@ -4384,14 +4385,6 @@ async function verify(config, request, options) {
4384
4385
  const result2 = {
4385
4386
  identityVerified: idVerifiedFromBackend,
4386
4387
  policyAllowed: false,
4387
- // v2.3.9 (defect #30): denials grant `'none'`, NEVER a positive band.
4388
- // Pre-rename this hardcoded `'guidance'`, which conflated with the
4389
- // colocated `guidance: {...}` help-payload object below and let
4390
- // denied requests pass any route gated at `'guidance'` because
4391
- // `hasMinimumAccess('guidance', 'guidance') === true`. Adapters now
4392
- // ALSO short-circuit on `!identityVerified || !policyAllowed` before
4393
- // the gate check — belt-and-braces.
4394
- accessLevel: "none",
4395
4388
  // 3.6.0: the server now emits top-level denialReasons on every deny
4396
4389
  // path — prefer it verbatim; the failure-message reconstruction remains
4397
4390
  // as the fallback for older backends.
@@ -4402,7 +4395,10 @@ async function verify(config, request, options) {
4402
4395
  guidance: {
4403
4396
  message: apiResponse.access?.reason || "Access denied by PDLSS policy",
4404
4397
  registrationUrl: urls?.registrationUrl ?? "",
4405
- documentationUrl: urls?.documentationUrl ?? ""
4398
+ documentationUrl: urls?.documentationUrl ?? "",
4399
+ // 5.1.0: anonymous callers land on this branch — steer MCP-hosted
4400
+ // agents to the connector (this is what the edge deny body surfaces).
4401
+ ...mcpGuidance(urls) && { mcp: mcpGuidance(urls) }
4406
4402
  },
4407
4403
  verifiedAt: /* @__PURE__ */ new Date(),
4408
4404
  // Extract sessionId so decisions can be recorded for denials too
@@ -4440,7 +4436,6 @@ async function verify(config, request, options) {
4440
4436
  trustScore: apiResponse.organization.trustScore
4441
4437
  } : void 0;
4442
4438
  const verificationContext = apiResponse.verificationContext;
4443
- const accessLevel = apiResponse.access?.accessLevel ?? "standard";
4444
4439
  const result = {
4445
4440
  // 4.5.0 (probe F1): read idVerified from verificationContext with the
4446
4441
  // SAME absent⇒false default as the deny branch. The previous `!== false`
@@ -4452,7 +4447,6 @@ async function verify(config, request, options) {
4452
4447
  // this load-bearing must never be defaulted on.
4453
4448
  identityVerified: apiResponse.verificationContext?.idVerified === true,
4454
4449
  policyAllowed: true,
4455
- accessLevel,
4456
4450
  agent,
4457
4451
  developer,
4458
4452
  organization,
@@ -4479,7 +4473,6 @@ async function verify(config, request, options) {
4479
4473
  };
4480
4474
  if (result.recommendation === "deny") {
4481
4475
  result.policyAllowed = false;
4482
- result.accessLevel = "none";
4483
4476
  result.denialReasons = serverDenialReasons ?? result.recommendationReasons ?? ["Access denied by AstraSync recommendation"];
4484
4477
  result.guidance = result.runtimeChallenge ? {
4485
4478
  message: `Verification failed: ${result.runtimeChallenge.reason || "runtime challenge failed"}`,
@@ -4592,7 +4585,6 @@ function toGatewayConfig(config) {
4592
4585
  return {
4593
4586
  apiBaseUrl: config.apiBaseUrl || "https://api.astrasync.ai",
4594
4587
  apiKey: config.apiKey,
4595
- defaultAccessLevel: config.defaultAccessLevel,
4596
4588
  minTrustScore: config.minTrustScore,
4597
4589
  minTrustScoreForFull: config.minTrustScoreForFull,
4598
4590
  cacheTtl: config.cacheTtl,
@@ -4620,7 +4612,7 @@ function toDecision(result) {
4620
4612
  if (result.identityVerified && result.policyAllowed) {
4621
4613
  return {
4622
4614
  recommendation: "ALLOW",
4623
- reason: `Verified with access level: ${result.accessLevel}`,
4615
+ reason: result.agent?.trustScore ? `Verified (trust score ${result.agent.trustScore})` : "Verified",
4624
4616
  trustScore: result.agent?.trustScore,
4625
4617
  sessionId: "sessionId" in result ? result.sessionId : void 0
4626
4618
  };