@astrasyncai/verification-gateway 4.6.0 → 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 (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 +6 -33
  6. package/dist/adapters/express.js.map +1 -1
  7. package/dist/adapters/express.mjs +6 -33
  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 +23 -65
  12. package/dist/adapters/mcp.js.map +1 -1
  13. package/dist/adapters/mcp.mjs +22 -64
  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 +4 -30
  18. package/dist/adapters/nextjs.js.map +1 -1
  19. package/dist/adapters/nextjs.mjs +4 -30
  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 +3 -124
  24. package/dist/adapters/sdk.js.map +1 -1
  25. package/dist/adapters/sdk.mjs +3 -122
  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 +4 -29
  34. package/dist/bin/astrasync-codex-hook.js +4 -29
  35. package/dist/bin/astrasync-guard.js +4 -29
  36. package/dist/bin/astrasync.js +9 -34
  37. package/dist/browser/background.js +4 -29
  38. package/dist/browser/background.js.map +1 -1
  39. package/dist/browser/background.mjs +4 -29
  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 +4 -29
  54. package/dist/codex/index.js.map +1 -1
  55. package/dist/codex/index.mjs +4 -29
  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 +4 -29
  62. package/dist/cursor/extension.js.map +1 -1
  63. package/dist/cursor/extension.mjs +4 -29
  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 +1 -3
  72. package/dist/edge-core/index.d.ts +1 -3
  73. package/dist/edge-core/index.js +6 -33
  74. package/dist/edge-core/index.js.map +1 -1
  75. package/dist/edge-core/index.mjs +6 -33
  76. package/dist/edge-core/index.mjs.map +1 -1
  77. package/dist/{express-D-8Ks2Uo.d.ts → express-B5lWuemA.d.ts} +1 -1
  78. package/dist/{express-DBtPKXOL.d.mts → express-Dm-snUuY.d.mts} +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 +4 -29
  82. package/dist/gateway/gateway.js.map +1 -1
  83. package/dist/gateway/gateway.mjs +4 -29
  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-B5k_vUmK.d.mts} +1 -1
  88. package/dist/{index-CUfmJ1Dq.d.mts → index-BOzM6xUq.d.mts} +1 -1
  89. package/dist/{index-BND3kQev.d.ts → index-dRfxUdFA.d.ts} +1 -1
  90. package/dist/{index-DlZORQsb.d.ts → index-y8xToocF.d.ts} +1 -1
  91. package/dist/index.d.mts +10 -10
  92. package/dist/index.d.ts +10 -10
  93. package/dist/index.js +25 -217
  94. package/dist/index.js.map +1 -1
  95. package/dist/index.mjs +25 -210
  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-ZRN4kY3b.d.mts → mcp-DgsyQiQq.d.mts} +53 -52
  102. package/dist/{mcp-DToTlwIn.d.ts → mcp-OosmAcKf.d.ts} +53 -52
  103. package/dist/{nextjs-C0KASOy_.d.mts → nextjs-B1sBdEav.d.mts} +1 -1
  104. package/dist/{nextjs-lwNvWYWT.d.ts → nextjs-DoRmhV_Z.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-B83N3xKc.d.mts +142 -0
  110. package/dist/sdk-H_9BTNBS.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-CGPU7HLi.d.ts → types-BK2POWNc.d.ts} +15 -50
  118. package/dist/{types-Cx9hTpKI.d.mts → types-CJjZvPr9.d.mts} +15 -50
  119. package/dist/{types-DhhJxKIC.d.ts → types-CXf3q4kZ.d.ts} +1 -3
  120. package/dist/{types-CfSJLS4i.d.mts → types-DQmop7ZW.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 +3 -28
  130. package/dist/verify.js.map +1 -1
  131. package/dist/verify.mjs +3 -28
  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
@@ -3734,7 +3734,7 @@ function verifyLocal(evaluator, context) {
3734
3734
  return evaluator.evaluate(context);
3735
3735
  }
3736
3736
 
3737
- // src/access-levels.ts
3737
+ // src/trust-levels.ts
3738
3738
  function getTrustLevel(score) {
3739
3739
  if (score >= 80) return "PLATINUM";
3740
3740
  if (score >= 60) return "GOLD";
@@ -3743,7 +3743,7 @@ function getTrustLevel(score) {
3743
3743
  }
3744
3744
 
3745
3745
  // src/version.ts
3746
- var SDK_VERSION = "4.6.0";
3746
+ var SDK_VERSION = "5.0.0";
3747
3747
 
3748
3748
  // src/http.ts
3749
3749
  var SDK_USER_AGENT = `astrasync-sdk/${SDK_VERSION}`;
@@ -3773,11 +3773,6 @@ function getCachedWellKnownUrls(apiBaseUrl) {
3773
3773
  // src/verify.ts
3774
3774
  var DEFAULT_CONFIG = {
3775
3775
  apiBaseUrl: "https://astrasync.ai/api",
3776
- // v2.3.9 (defect #30): default for unconfigured callers is `'none'` (no
3777
- // access). Pre-rename this defaulted to `'guidance'`, which combined with
3778
- // a route gated at `'guidance'` to silently let unverified traffic
3779
- // through (`hasMinimumAccess('guidance', 'guidance') === true`).
3780
- defaultAccessLevel: "none",
3781
3776
  // minTrustScore + minTrustScoreForFull deprecated in v2.3.0 — server decides.
3782
3777
  // cacheTtl deliberately unset. When undefined, cacheResult applies the 60s
3783
3778
  // default; the caller's explicit value is honoured for cacheable results.
@@ -3938,13 +3933,6 @@ function createGuidanceResponse(_config, reason, options = {}) {
3938
3933
  // policy is not evaluated (we never reached the gate).
3939
3934
  identityVerified: false,
3940
3935
  policyAllowed: false,
3941
- // v2.3.9 (defect #30): denials grant `'none'`, NEVER a positive band.
3942
- // Adapters additionally short-circuit on `!identityVerified ||
3943
- // !policyAllowed` before the gate check, but the access level still has
3944
- // to be honest at the data layer so downstream consumers (SDK adapters
3945
- // in other languages, custom integrations) inherit the correct
3946
- // semantics.
3947
- accessLevel: "none",
3948
3936
  guidance,
3949
3937
  denialReasons: reason ? [reason] : ["No valid agent credentials provided"],
3950
3938
  // Round-10 (#47, O5): on API-error fallback, surface a typed failure so
@@ -4038,7 +4026,6 @@ async function callVerifyAccessAPI(config, request) {
4038
4026
  attemptId: typeof data?.attemptId === "string" ? data.attemptId : void 0,
4039
4027
  access: {
4040
4028
  allowed: false,
4041
- accessLevel: "none",
4042
4029
  reason: "endpoint_deactivated",
4043
4030
  failures: [
4044
4031
  {
@@ -4101,7 +4088,7 @@ async function verify(config, request, options) {
4101
4088
  if (!deprecationWarningShown && (config.minTrustScore !== void 0 || config.minTrustScoreForFull !== void 0)) {
4102
4089
  deprecationWarningShown = true;
4103
4090
  console.warn(
4104
- "[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."
4091
+ "[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."
4105
4092
  );
4106
4093
  }
4107
4094
  if (mergedConfig.cacheTtl !== 0 && !options?.bypassCache) {
@@ -4147,14 +4134,6 @@ async function verify(config, request, options) {
4147
4134
  const result2 = {
4148
4135
  identityVerified: idVerifiedFromBackend,
4149
4136
  policyAllowed: false,
4150
- // v2.3.9 (defect #30): denials grant `'none'`, NEVER a positive band.
4151
- // Pre-rename this hardcoded `'guidance'`, which conflated with the
4152
- // colocated `guidance: {...}` help-payload object below and let
4153
- // denied requests pass any route gated at `'guidance'` because
4154
- // `hasMinimumAccess('guidance', 'guidance') === true`. Adapters now
4155
- // ALSO short-circuit on `!identityVerified || !policyAllowed` before
4156
- // the gate check — belt-and-braces.
4157
- accessLevel: "none",
4158
4137
  // 3.6.0: the server now emits top-level denialReasons on every deny
4159
4138
  // path — prefer it verbatim; the failure-message reconstruction remains
4160
4139
  // as the fallback for older backends.
@@ -4203,7 +4182,6 @@ async function verify(config, request, options) {
4203
4182
  trustScore: apiResponse.organization.trustScore
4204
4183
  } : void 0;
4205
4184
  const verificationContext = apiResponse.verificationContext;
4206
- const accessLevel = apiResponse.access?.accessLevel ?? "standard";
4207
4185
  const result = {
4208
4186
  // 4.5.0 (probe F1): read idVerified from verificationContext with the
4209
4187
  // SAME absent⇒false default as the deny branch. The previous `!== false`
@@ -4215,7 +4193,6 @@ async function verify(config, request, options) {
4215
4193
  // this load-bearing must never be defaulted on.
4216
4194
  identityVerified: apiResponse.verificationContext?.idVerified === true,
4217
4195
  policyAllowed: true,
4218
- accessLevel,
4219
4196
  agent,
4220
4197
  developer,
4221
4198
  organization,
@@ -4242,7 +4219,6 @@ async function verify(config, request, options) {
4242
4219
  };
4243
4220
  if (result.recommendation === "deny") {
4244
4221
  result.policyAllowed = false;
4245
- result.accessLevel = "none";
4246
4222
  result.denialReasons = serverDenialReasons ?? result.recommendationReasons ?? ["Access denied by AstraSync recommendation"];
4247
4223
  result.guidance = result.runtimeChallenge ? {
4248
4224
  message: `Verification failed: ${result.runtimeChallenge.reason || "runtime challenge failed"}`,
@@ -4355,7 +4331,6 @@ function toGatewayConfig(config) {
4355
4331
  return {
4356
4332
  apiBaseUrl: config.apiBaseUrl || "https://api.astrasync.ai",
4357
4333
  apiKey: config.apiKey,
4358
- defaultAccessLevel: config.defaultAccessLevel,
4359
4334
  minTrustScore: config.minTrustScore,
4360
4335
  minTrustScoreForFull: config.minTrustScoreForFull,
4361
4336
  cacheTtl: config.cacheTtl,
@@ -4383,7 +4358,7 @@ function toDecision(result) {
4383
4358
  if (result.identityVerified && result.policyAllowed) {
4384
4359
  return {
4385
4360
  recommendation: "ALLOW",
4386
- reason: `Verified with access level: ${result.accessLevel}`,
4361
+ reason: result.agent?.trustScore ? `Verified (trust score ${result.agent.trustScore})` : "Verified",
4387
4362
  trustScore: result.agent?.trustScore,
4388
4363
  sessionId: "sessionId" in result ? result.sessionId : void 0
4389
4364
  };
@@ -3733,7 +3733,7 @@ function verifyLocal(evaluator, context) {
3733
3733
  return evaluator.evaluate(context);
3734
3734
  }
3735
3735
 
3736
- // src/access-levels.ts
3736
+ // src/trust-levels.ts
3737
3737
  function getTrustLevel(score) {
3738
3738
  if (score >= 80) return "PLATINUM";
3739
3739
  if (score >= 60) return "GOLD";
@@ -3742,7 +3742,7 @@ function getTrustLevel(score) {
3742
3742
  }
3743
3743
 
3744
3744
  // src/version.ts
3745
- var SDK_VERSION = "4.6.0";
3745
+ var SDK_VERSION = "5.0.0";
3746
3746
 
3747
3747
  // src/http.ts
3748
3748
  var SDK_USER_AGENT = `astrasync-sdk/${SDK_VERSION}`;
@@ -3772,11 +3772,6 @@ function getCachedWellKnownUrls(apiBaseUrl) {
3772
3772
  // src/verify.ts
3773
3773
  var DEFAULT_CONFIG = {
3774
3774
  apiBaseUrl: "https://astrasync.ai/api",
3775
- // v2.3.9 (defect #30): default for unconfigured callers is `'none'` (no
3776
- // access). Pre-rename this defaulted to `'guidance'`, which combined with
3777
- // a route gated at `'guidance'` to silently let unverified traffic
3778
- // through (`hasMinimumAccess('guidance', 'guidance') === true`).
3779
- defaultAccessLevel: "none",
3780
3775
  // minTrustScore + minTrustScoreForFull deprecated in v2.3.0 — server decides.
3781
3776
  // cacheTtl deliberately unset. When undefined, cacheResult applies the 60s
3782
3777
  // default; the caller's explicit value is honoured for cacheable results.
@@ -3937,13 +3932,6 @@ function createGuidanceResponse(_config, reason, options = {}) {
3937
3932
  // policy is not evaluated (we never reached the gate).
3938
3933
  identityVerified: false,
3939
3934
  policyAllowed: false,
3940
- // v2.3.9 (defect #30): denials grant `'none'`, NEVER a positive band.
3941
- // Adapters additionally short-circuit on `!identityVerified ||
3942
- // !policyAllowed` before the gate check, but the access level still has
3943
- // to be honest at the data layer so downstream consumers (SDK adapters
3944
- // in other languages, custom integrations) inherit the correct
3945
- // semantics.
3946
- accessLevel: "none",
3947
3935
  guidance,
3948
3936
  denialReasons: reason ? [reason] : ["No valid agent credentials provided"],
3949
3937
  // Round-10 (#47, O5): on API-error fallback, surface a typed failure so
@@ -4037,7 +4025,6 @@ async function callVerifyAccessAPI(config, request) {
4037
4025
  attemptId: typeof data?.attemptId === "string" ? data.attemptId : void 0,
4038
4026
  access: {
4039
4027
  allowed: false,
4040
- accessLevel: "none",
4041
4028
  reason: "endpoint_deactivated",
4042
4029
  failures: [
4043
4030
  {
@@ -4100,7 +4087,7 @@ async function verify(config, request, options) {
4100
4087
  if (!deprecationWarningShown && (config.minTrustScore !== void 0 || config.minTrustScoreForFull !== void 0)) {
4101
4088
  deprecationWarningShown = true;
4102
4089
  console.warn(
4103
- "[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."
4090
+ "[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."
4104
4091
  );
4105
4092
  }
4106
4093
  if (mergedConfig.cacheTtl !== 0 && !options?.bypassCache) {
@@ -4146,14 +4133,6 @@ async function verify(config, request, options) {
4146
4133
  const result2 = {
4147
4134
  identityVerified: idVerifiedFromBackend,
4148
4135
  policyAllowed: false,
4149
- // v2.3.9 (defect #30): denials grant `'none'`, NEVER a positive band.
4150
- // Pre-rename this hardcoded `'guidance'`, which conflated with the
4151
- // colocated `guidance: {...}` help-payload object below and let
4152
- // denied requests pass any route gated at `'guidance'` because
4153
- // `hasMinimumAccess('guidance', 'guidance') === true`. Adapters now
4154
- // ALSO short-circuit on `!identityVerified || !policyAllowed` before
4155
- // the gate check — belt-and-braces.
4156
- accessLevel: "none",
4157
4136
  // 3.6.0: the server now emits top-level denialReasons on every deny
4158
4137
  // path — prefer it verbatim; the failure-message reconstruction remains
4159
4138
  // as the fallback for older backends.
@@ -4202,7 +4181,6 @@ async function verify(config, request, options) {
4202
4181
  trustScore: apiResponse.organization.trustScore
4203
4182
  } : void 0;
4204
4183
  const verificationContext = apiResponse.verificationContext;
4205
- const accessLevel = apiResponse.access?.accessLevel ?? "standard";
4206
4184
  const result = {
4207
4185
  // 4.5.0 (probe F1): read idVerified from verificationContext with the
4208
4186
  // SAME absent⇒false default as the deny branch. The previous `!== false`
@@ -4214,7 +4192,6 @@ async function verify(config, request, options) {
4214
4192
  // this load-bearing must never be defaulted on.
4215
4193
  identityVerified: apiResponse.verificationContext?.idVerified === true,
4216
4194
  policyAllowed: true,
4217
- accessLevel,
4218
4195
  agent,
4219
4196
  developer,
4220
4197
  organization,
@@ -4241,7 +4218,6 @@ async function verify(config, request, options) {
4241
4218
  };
4242
4219
  if (result.recommendation === "deny") {
4243
4220
  result.policyAllowed = false;
4244
- result.accessLevel = "none";
4245
4221
  result.denialReasons = serverDenialReasons ?? result.recommendationReasons ?? ["Access denied by AstraSync recommendation"];
4246
4222
  result.guidance = result.runtimeChallenge ? {
4247
4223
  message: `Verification failed: ${result.runtimeChallenge.reason || "runtime challenge failed"}`,
@@ -4354,7 +4330,6 @@ function toGatewayConfig(config) {
4354
4330
  return {
4355
4331
  apiBaseUrl: config.apiBaseUrl || "https://api.astrasync.ai",
4356
4332
  apiKey: config.apiKey,
4357
- defaultAccessLevel: config.defaultAccessLevel,
4358
4333
  minTrustScore: config.minTrustScore,
4359
4334
  minTrustScoreForFull: config.minTrustScoreForFull,
4360
4335
  cacheTtl: config.cacheTtl,
@@ -4382,7 +4357,7 @@ function toDecision(result) {
4382
4357
  if (result.identityVerified && result.policyAllowed) {
4383
4358
  return {
4384
4359
  recommendation: "ALLOW",
4385
- reason: `Verified with access level: ${result.accessLevel}`,
4360
+ reason: result.agent?.trustScore ? `Verified (trust score ${result.agent.trustScore})` : "Verified",
4386
4361
  trustScore: result.agent?.trustScore,
4387
4362
  sessionId: "sessionId" in result ? result.sessionId : void 0
4388
4363
  };
@@ -3705,7 +3705,7 @@ Policy saved to ${outputPath}`);
3705
3705
  };
3706
3706
 
3707
3707
  // src/version.ts
3708
- var SDK_VERSION = "4.6.0";
3708
+ var SDK_VERSION = "5.0.0";
3709
3709
 
3710
3710
  // src/http.ts
3711
3711
  var SDK_USER_AGENT = `astrasync-sdk/${SDK_VERSION}`;
@@ -4663,7 +4663,7 @@ function verifyLocal(evaluator, context) {
4663
4663
  return evaluator.evaluate(context);
4664
4664
  }
4665
4665
 
4666
- // src/access-levels.ts
4666
+ // src/trust-levels.ts
4667
4667
  function getTrustLevel(score) {
4668
4668
  if (score >= 80) return "PLATINUM";
4669
4669
  if (score >= 60) return "GOLD";
@@ -4681,11 +4681,6 @@ function getCachedWellKnownUrls(apiBaseUrl) {
4681
4681
  // src/verify.ts
4682
4682
  var DEFAULT_CONFIG = {
4683
4683
  apiBaseUrl: "https://astrasync.ai/api",
4684
- // v2.3.9 (defect #30): default for unconfigured callers is `'none'` (no
4685
- // access). Pre-rename this defaulted to `'guidance'`, which combined with
4686
- // a route gated at `'guidance'` to silently let unverified traffic
4687
- // through (`hasMinimumAccess('guidance', 'guidance') === true`).
4688
- defaultAccessLevel: "none",
4689
4684
  // minTrustScore + minTrustScoreForFull deprecated in v2.3.0 — server decides.
4690
4685
  // cacheTtl deliberately unset. When undefined, cacheResult applies the 60s
4691
4686
  // default; the caller's explicit value is honoured for cacheable results.
@@ -4846,13 +4841,6 @@ function createGuidanceResponse(_config, reason, options = {}) {
4846
4841
  // policy is not evaluated (we never reached the gate).
4847
4842
  identityVerified: false,
4848
4843
  policyAllowed: false,
4849
- // v2.3.9 (defect #30): denials grant `'none'`, NEVER a positive band.
4850
- // Adapters additionally short-circuit on `!identityVerified ||
4851
- // !policyAllowed` before the gate check, but the access level still has
4852
- // to be honest at the data layer so downstream consumers (SDK adapters
4853
- // in other languages, custom integrations) inherit the correct
4854
- // semantics.
4855
- accessLevel: "none",
4856
4844
  guidance,
4857
4845
  denialReasons: reason ? [reason] : ["No valid agent credentials provided"],
4858
4846
  // Round-10 (#47, O5): on API-error fallback, surface a typed failure so
@@ -4946,7 +4934,6 @@ async function callVerifyAccessAPI(config, request2) {
4946
4934
  attemptId: typeof data?.attemptId === "string" ? data.attemptId : void 0,
4947
4935
  access: {
4948
4936
  allowed: false,
4949
- accessLevel: "none",
4950
4937
  reason: "endpoint_deactivated",
4951
4938
  failures: [
4952
4939
  {
@@ -5009,7 +4996,7 @@ async function verify(config, request2, options) {
5009
4996
  if (!deprecationWarningShown && (config.minTrustScore !== void 0 || config.minTrustScoreForFull !== void 0)) {
5010
4997
  deprecationWarningShown = true;
5011
4998
  console.warn(
5012
- "[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."
4999
+ "[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."
5013
5000
  );
5014
5001
  }
5015
5002
  if (mergedConfig.cacheTtl !== 0 && !options?.bypassCache) {
@@ -5055,14 +5042,6 @@ async function verify(config, request2, options) {
5055
5042
  const result2 = {
5056
5043
  identityVerified: idVerifiedFromBackend,
5057
5044
  policyAllowed: false,
5058
- // v2.3.9 (defect #30): denials grant `'none'`, NEVER a positive band.
5059
- // Pre-rename this hardcoded `'guidance'`, which conflated with the
5060
- // colocated `guidance: {...}` help-payload object below and let
5061
- // denied requests pass any route gated at `'guidance'` because
5062
- // `hasMinimumAccess('guidance', 'guidance') === true`. Adapters now
5063
- // ALSO short-circuit on `!identityVerified || !policyAllowed` before
5064
- // the gate check — belt-and-braces.
5065
- accessLevel: "none",
5066
5045
  // 3.6.0: the server now emits top-level denialReasons on every deny
5067
5046
  // path — prefer it verbatim; the failure-message reconstruction remains
5068
5047
  // as the fallback for older backends.
@@ -5111,7 +5090,6 @@ async function verify(config, request2, options) {
5111
5090
  trustScore: apiResponse.organization.trustScore
5112
5091
  } : void 0;
5113
5092
  const verificationContext = apiResponse.verificationContext;
5114
- const accessLevel = apiResponse.access?.accessLevel ?? "standard";
5115
5093
  const result = {
5116
5094
  // 4.5.0 (probe F1): read idVerified from verificationContext with the
5117
5095
  // SAME absent⇒false default as the deny branch. The previous `!== false`
@@ -5123,7 +5101,6 @@ async function verify(config, request2, options) {
5123
5101
  // this load-bearing must never be defaulted on.
5124
5102
  identityVerified: apiResponse.verificationContext?.idVerified === true,
5125
5103
  policyAllowed: true,
5126
- accessLevel,
5127
5104
  agent,
5128
5105
  developer,
5129
5106
  organization,
@@ -5150,7 +5127,6 @@ async function verify(config, request2, options) {
5150
5127
  };
5151
5128
  if (result.recommendation === "deny") {
5152
5129
  result.policyAllowed = false;
5153
- result.accessLevel = "none";
5154
5130
  result.denialReasons = serverDenialReasons ?? result.recommendationReasons ?? ["Access denied by AstraSync recommendation"];
5155
5131
  result.guidance = result.runtimeChallenge ? {
5156
5132
  message: `Verification failed: ${result.runtimeChallenge.reason || "runtime challenge failed"}`,
@@ -5263,7 +5239,6 @@ function toGatewayConfig(config) {
5263
5239
  return {
5264
5240
  apiBaseUrl: config.apiBaseUrl || "https://api.astrasync.ai",
5265
5241
  apiKey: config.apiKey,
5266
- defaultAccessLevel: config.defaultAccessLevel,
5267
5242
  minTrustScore: config.minTrustScore,
5268
5243
  minTrustScoreForFull: config.minTrustScoreForFull,
5269
5244
  cacheTtl: config.cacheTtl,
@@ -5291,7 +5266,7 @@ function toDecision(result) {
5291
5266
  if (result.identityVerified && result.policyAllowed) {
5292
5267
  return {
5293
5268
  recommendation: "ALLOW",
5294
- reason: `Verified with access level: ${result.accessLevel}`,
5269
+ reason: result.agent?.trustScore ? `Verified (trust score ${result.agent.trustScore})` : "Verified",
5295
5270
  trustScore: result.agent?.trustScore,
5296
5271
  sessionId: "sessionId" in result ? result.sessionId : void 0
5297
5272
  };
@@ -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
  });
@@ -5242,13 +5242,6 @@ function createGuidanceResponse(_config, reason, options = {}) {
5242
5242
  // policy is not evaluated (we never reached the gate).
5243
5243
  identityVerified: false,
5244
5244
  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
5245
  guidance,
5253
5246
  denialReasons: reason ? [reason] : ["No valid agent credentials provided"],
5254
5247
  // Round-10 (#47, O5): on API-error fallback, surface a typed failure so
@@ -5342,7 +5335,6 @@ async function callVerifyAccessAPI(config, request2) {
5342
5335
  attemptId: typeof data?.attemptId === "string" ? data.attemptId : void 0,
5343
5336
  access: {
5344
5337
  allowed: false,
5345
- accessLevel: "none",
5346
5338
  reason: "endpoint_deactivated",
5347
5339
  failures: [
5348
5340
  {
@@ -5405,7 +5397,7 @@ async function verify(config, request2, options) {
5405
5397
  if (!deprecationWarningShown && (config.minTrustScore !== void 0 || config.minTrustScoreForFull !== void 0)) {
5406
5398
  deprecationWarningShown = true;
5407
5399
  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."
5400
+ "[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
5401
  );
5410
5402
  }
5411
5403
  if (mergedConfig.cacheTtl !== 0 && !options?.bypassCache) {
@@ -5451,14 +5443,6 @@ async function verify(config, request2, options) {
5451
5443
  const result2 = {
5452
5444
  identityVerified: idVerifiedFromBackend,
5453
5445
  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
5446
  // 3.6.0: the server now emits top-level denialReasons on every deny
5463
5447
  // path — prefer it verbatim; the failure-message reconstruction remains
5464
5448
  // as the fallback for older backends.
@@ -5507,7 +5491,6 @@ async function verify(config, request2, options) {
5507
5491
  trustScore: apiResponse.organization.trustScore
5508
5492
  } : void 0;
5509
5493
  const verificationContext = apiResponse.verificationContext;
5510
- const accessLevel = apiResponse.access?.accessLevel ?? "standard";
5511
5494
  const result = {
5512
5495
  // 4.5.0 (probe F1): read idVerified from verificationContext with the
5513
5496
  // SAME absent⇒false default as the deny branch. The previous `!== false`
@@ -5519,7 +5502,6 @@ async function verify(config, request2, options) {
5519
5502
  // this load-bearing must never be defaulted on.
5520
5503
  identityVerified: apiResponse.verificationContext?.idVerified === true,
5521
5504
  policyAllowed: true,
5522
- accessLevel,
5523
5505
  agent,
5524
5506
  developer,
5525
5507
  organization,
@@ -5546,7 +5528,6 @@ async function verify(config, request2, options) {
5546
5528
  };
5547
5529
  if (result.recommendation === "deny") {
5548
5530
  result.policyAllowed = false;
5549
- result.accessLevel = "none";
5550
5531
  result.denialReasons = serverDenialReasons ?? result.recommendationReasons ?? ["Access denied by AstraSync recommendation"];
5551
5532
  result.guidance = result.runtimeChallenge ? {
5552
5533
  message: `Verification failed: ${result.runtimeChallenge.reason || "runtime challenge failed"}`,
@@ -5572,16 +5553,11 @@ var init_verify = __esm({
5572
5553
  "src/verify.ts"() {
5573
5554
  "use strict";
5574
5555
  init_http();
5575
- init_access_levels();
5556
+ init_trust_levels();
5576
5557
  init_version();
5577
5558
  init_well_known();
5578
5559
  DEFAULT_CONFIG = {
5579
5560
  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
5561
  // minTrustScore + minTrustScoreForFull deprecated in v2.3.0 — server decides.
5586
5562
  // cacheTtl deliberately unset. When undefined, cacheResult applies the 60s
5587
5563
  // default; the caller's explicit value is honoured for cacheable results.
@@ -5778,7 +5754,7 @@ var init_sdk = __esm({
5778
5754
  "src/adapters/sdk.ts"() {
5779
5755
  "use strict";
5780
5756
  init_verify();
5781
- init_access_levels();
5757
+ init_trust_levels();
5782
5758
  }
5783
5759
  });
5784
5760
 
@@ -6172,7 +6148,7 @@ var init_runtime_signatures = __esm({
6172
6148
  var init_src = __esm({
6173
6149
  "src/index.ts"() {
6174
6150
  "use strict";
6175
- init_access_levels();
6151
+ init_trust_levels();
6176
6152
  init_verify();
6177
6153
  init_stepup_poll();
6178
6154
  init_settlement();
@@ -6205,7 +6181,6 @@ function toGatewayConfig(config) {
6205
6181
  return {
6206
6182
  apiBaseUrl: config.apiBaseUrl || "https://api.astrasync.ai",
6207
6183
  apiKey: config.apiKey,
6208
- defaultAccessLevel: config.defaultAccessLevel,
6209
6184
  minTrustScore: config.minTrustScore,
6210
6185
  minTrustScoreForFull: config.minTrustScoreForFull,
6211
6186
  cacheTtl: config.cacheTtl,
@@ -6233,7 +6208,7 @@ function toDecision(result) {
6233
6208
  if (result.identityVerified && result.policyAllowed) {
6234
6209
  return {
6235
6210
  recommendation: "ALLOW",
6236
- reason: `Verified with access level: ${result.accessLevel}`,
6211
+ reason: result.agent?.trustScore ? `Verified (trust score ${result.agent.trustScore})` : "Verified",
6237
6212
  trustScore: result.agent?.trustScore,
6238
6213
  sessionId: "sessionId" in result ? result.sessionId : void 0
6239
6214
  };
@@ -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.
@@ -4175,13 +4170,6 @@ function createGuidanceResponse(_config, reason, options = {}) {
4175
4170
  // policy is not evaluated (we never reached the gate).
4176
4171
  identityVerified: false,
4177
4172
  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
4173
  guidance,
4186
4174
  denialReasons: reason ? [reason] : ["No valid agent credentials provided"],
4187
4175
  // Round-10 (#47, O5): on API-error fallback, surface a typed failure so
@@ -4275,7 +4263,6 @@ async function callVerifyAccessAPI(config, request) {
4275
4263
  attemptId: typeof data?.attemptId === "string" ? data.attemptId : void 0,
4276
4264
  access: {
4277
4265
  allowed: false,
4278
- accessLevel: "none",
4279
4266
  reason: "endpoint_deactivated",
4280
4267
  failures: [
4281
4268
  {
@@ -4338,7 +4325,7 @@ async function verify(config, request, options) {
4338
4325
  if (!deprecationWarningShown && (config.minTrustScore !== void 0 || config.minTrustScoreForFull !== void 0)) {
4339
4326
  deprecationWarningShown = true;
4340
4327
  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."
4328
+ "[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
4329
  );
4343
4330
  }
4344
4331
  if (mergedConfig.cacheTtl !== 0 && !options?.bypassCache) {
@@ -4384,14 +4371,6 @@ async function verify(config, request, options) {
4384
4371
  const result2 = {
4385
4372
  identityVerified: idVerifiedFromBackend,
4386
4373
  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
4374
  // 3.6.0: the server now emits top-level denialReasons on every deny
4396
4375
  // path — prefer it verbatim; the failure-message reconstruction remains
4397
4376
  // as the fallback for older backends.
@@ -4440,7 +4419,6 @@ async function verify(config, request, options) {
4440
4419
  trustScore: apiResponse.organization.trustScore
4441
4420
  } : void 0;
4442
4421
  const verificationContext = apiResponse.verificationContext;
4443
- const accessLevel = apiResponse.access?.accessLevel ?? "standard";
4444
4422
  const result = {
4445
4423
  // 4.5.0 (probe F1): read idVerified from verificationContext with the
4446
4424
  // SAME absent⇒false default as the deny branch. The previous `!== false`
@@ -4452,7 +4430,6 @@ async function verify(config, request, options) {
4452
4430
  // this load-bearing must never be defaulted on.
4453
4431
  identityVerified: apiResponse.verificationContext?.idVerified === true,
4454
4432
  policyAllowed: true,
4455
- accessLevel,
4456
4433
  agent,
4457
4434
  developer,
4458
4435
  organization,
@@ -4479,7 +4456,6 @@ async function verify(config, request, options) {
4479
4456
  };
4480
4457
  if (result.recommendation === "deny") {
4481
4458
  result.policyAllowed = false;
4482
- result.accessLevel = "none";
4483
4459
  result.denialReasons = serverDenialReasons ?? result.recommendationReasons ?? ["Access denied by AstraSync recommendation"];
4484
4460
  result.guidance = result.runtimeChallenge ? {
4485
4461
  message: `Verification failed: ${result.runtimeChallenge.reason || "runtime challenge failed"}`,
@@ -4592,7 +4568,6 @@ function toGatewayConfig(config) {
4592
4568
  return {
4593
4569
  apiBaseUrl: config.apiBaseUrl || "https://api.astrasync.ai",
4594
4570
  apiKey: config.apiKey,
4595
- defaultAccessLevel: config.defaultAccessLevel,
4596
4571
  minTrustScore: config.minTrustScore,
4597
4572
  minTrustScoreForFull: config.minTrustScoreForFull,
4598
4573
  cacheTtl: config.cacheTtl,
@@ -4620,7 +4595,7 @@ function toDecision(result) {
4620
4595
  if (result.identityVerified && result.policyAllowed) {
4621
4596
  return {
4622
4597
  recommendation: "ALLOW",
4623
- reason: `Verified with access level: ${result.accessLevel}`,
4598
+ reason: result.agent?.trustScore ? `Verified (trust score ${result.agent.trustScore})` : "Verified",
4624
4599
  trustScore: result.agent?.trustScore,
4625
4600
  sessionId: "sessionId" in result ? result.sessionId : void 0
4626
4601
  };