@astrasyncai/verification-gateway 2.4.8 → 2.4.10

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 (89) 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 +81 -31
  6. package/dist/adapters/express.js.map +1 -1
  7. package/dist/adapters/express.mjs +81 -31
  8. package/dist/adapters/express.mjs.map +1 -1
  9. package/dist/adapters/mcp.d.mts +1 -1
  10. package/dist/adapters/mcp.d.ts +1 -1
  11. package/dist/adapters/mcp.js +64 -26
  12. package/dist/adapters/mcp.js.map +1 -1
  13. package/dist/adapters/mcp.mjs +64 -26
  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 +89 -32
  18. package/dist/adapters/nextjs.js.map +1 -1
  19. package/dist/adapters/nextjs.mjs +89 -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 +65 -25
  24. package/dist/adapters/sdk.js.map +1 -1
  25. package/dist/adapters/sdk.mjs +65 -25
  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/browser/background.js +60 -25
  30. package/dist/browser/background.js.map +1 -1
  31. package/dist/browser/background.mjs +60 -25
  32. package/dist/browser/background.mjs.map +1 -1
  33. package/dist/browser/browser-adapter.d.mts +2 -2
  34. package/dist/browser/browser-adapter.d.ts +2 -2
  35. package/dist/cli/index.d.mts +2 -2
  36. package/dist/cli/index.d.ts +2 -2
  37. package/dist/cursor/cursor-adapter.d.mts +2 -2
  38. package/dist/cursor/cursor-adapter.d.ts +2 -2
  39. package/dist/cursor/extension.d.mts +2 -2
  40. package/dist/cursor/extension.d.ts +2 -2
  41. package/dist/cursor/extension.js +60 -25
  42. package/dist/cursor/extension.js.map +1 -1
  43. package/dist/cursor/extension.mjs +60 -25
  44. package/dist/cursor/extension.mjs.map +1 -1
  45. package/dist/{express-DvVjR2H4.d.mts → express-4WStX3PV.d.mts} +1 -1
  46. package/dist/{express-714gJbaW.d.ts → express-C1ePFB7n.d.ts} +1 -1
  47. package/dist/gateway/gateway.d.mts +2 -2
  48. package/dist/gateway/gateway.d.ts +2 -2
  49. package/dist/gateway/gateway.js +60 -25
  50. package/dist/gateway/gateway.js.map +1 -1
  51. package/dist/gateway/gateway.mjs +60 -25
  52. package/dist/gateway/gateway.mjs.map +1 -1
  53. package/dist/git-trigger/git-hooks.d.mts +2 -2
  54. package/dist/git-trigger/git-hooks.d.ts +2 -2
  55. package/dist/{index-DYFS9QVb.d.mts → index-ChPX4WHl.d.mts} +1 -1
  56. package/dist/{index-DO0oG8ED.d.ts → index-Cjm-zBeZ.d.ts} +1 -1
  57. package/dist/{index-2WAlxs2G.d.ts → index-CzJMCgEy.d.ts} +1 -1
  58. package/dist/{index-P9t7M_dJ.d.mts → index-D8IEntil.d.mts} +1 -1
  59. package/dist/index.d.mts +22 -11
  60. package/dist/index.d.ts +22 -11
  61. package/dist/index.js +133 -42
  62. package/dist/index.js.map +1 -1
  63. package/dist/index.mjs +132 -42
  64. package/dist/index.mjs.map +1 -1
  65. package/dist/local-evaluator/evaluator.d.mts +2 -2
  66. package/dist/local-evaluator/evaluator.d.ts +2 -2
  67. package/dist/{nextjs-CZ-MwSOT.d.ts → nextjs-BIORS__0.d.ts} +1 -1
  68. package/dist/{nextjs-BCoH7EqF.d.mts → nextjs-CjzHdaXA.d.mts} +1 -1
  69. package/dist/registration/index.d.mts +76 -1
  70. package/dist/registration/index.d.ts +76 -1
  71. package/dist/registration/index.js +27 -2
  72. package/dist/registration/index.js.map +1 -1
  73. package/dist/registration/index.mjs +25 -1
  74. package/dist/registration/index.mjs.map +1 -1
  75. package/dist/{sdk-wwhFDXWX.d.mts → sdk-Chhz-FcT.d.mts} +9 -4
  76. package/dist/{sdk-kiA49vqJ.d.ts → sdk-CqTEQAc6.d.ts} +9 -4
  77. package/dist/transport/index.d.mts +2 -2
  78. package/dist/transport/index.d.ts +2 -2
  79. package/dist/{types-DOAb89cm.d.mts → types-DNK2BgIf.d.mts} +1 -1
  80. package/dist/{types-aucqzfUa.d.ts → types-DoWIuzfj.d.ts} +1 -1
  81. package/dist/{types-BwDmjIdr.d.mts → types-L15pYd2c.d.mts} +21 -4
  82. package/dist/{types-BwDmjIdr.d.ts → types-L15pYd2c.d.ts} +21 -4
  83. package/dist/ui/index.d.mts +1 -1
  84. package/dist/ui/index.d.ts +1 -1
  85. package/dist/ui/index.js +1 -1
  86. package/dist/ui/index.js.map +1 -1
  87. package/dist/ui/index.mjs +1 -1
  88. package/dist/ui/index.mjs.map +1 -1
  89. package/package.json +1 -1
@@ -1,7 +1,7 @@
1
1
  import { PlatformAdapter, AdapterConfig } from '../adapter-interface/interface.mjs';
2
- import { P as PDLSSContext, V as VerificationDecision, A as AgentAction, I as InterceptResult } from '../types-DOAb89cm.mjs';
2
+ import { P as PDLSSContext, V as VerificationDecision, A as AgentAction, I as InterceptResult } from '../types-DNK2BgIf.mjs';
3
3
  import '../gateway/gateway.mjs';
4
- import '../types-BwDmjIdr.mjs';
4
+ import '../types-L15pYd2c.mjs';
5
5
 
6
6
  /**
7
7
  * @astrasyncai/adapter-openclaw-browser
@@ -1,7 +1,7 @@
1
1
  import { PlatformAdapter, AdapterConfig } from '../adapter-interface/interface.js';
2
- import { P as PDLSSContext, V as VerificationDecision, A as AgentAction, I as InterceptResult } from '../types-aucqzfUa.js';
2
+ import { P as PDLSSContext, V as VerificationDecision, A as AgentAction, I as InterceptResult } from '../types-DoWIuzfj.js';
3
3
  import '../gateway/gateway.js';
4
- import '../types-BwDmjIdr.js';
4
+ import '../types-L15pYd2c.js';
5
5
 
6
6
  /**
7
7
  * @astrasyncai/adapter-openclaw-browser
@@ -1,6 +1,6 @@
1
- import { b as LocalPurposeRule, d as LocalScope, c as LocalRiskThresholds, L as LocalPolicy, P as PDLSSContext, V as VerificationDecision, A as AgentAction, I as InterceptResult } from '../types-DOAb89cm.mjs';
1
+ import { b as LocalPurposeRule, d as LocalScope, c as LocalRiskThresholds, L as LocalPolicy, P as PDLSSContext, V as VerificationDecision, A as AgentAction, I as InterceptResult } from '../types-DNK2BgIf.mjs';
2
2
  import { PlatformAdapter, AdapterConfig } from '../adapter-interface/interface.mjs';
3
- import '../types-BwDmjIdr.mjs';
3
+ import '../types-L15pYd2c.mjs';
4
4
  import '../gateway/gateway.mjs';
5
5
 
6
6
  /**
@@ -1,6 +1,6 @@
1
- import { b as LocalPurposeRule, d as LocalScope, c as LocalRiskThresholds, L as LocalPolicy, P as PDLSSContext, V as VerificationDecision, A as AgentAction, I as InterceptResult } from '../types-aucqzfUa.js';
1
+ import { b as LocalPurposeRule, d as LocalScope, c as LocalRiskThresholds, L as LocalPolicy, P as PDLSSContext, V as VerificationDecision, A as AgentAction, I as InterceptResult } from '../types-DoWIuzfj.js';
2
2
  import { PlatformAdapter, AdapterConfig } from '../adapter-interface/interface.js';
3
- import '../types-BwDmjIdr.js';
3
+ import '../types-L15pYd2c.js';
4
4
  import '../gateway/gateway.js';
5
5
 
6
6
  /**
@@ -1,7 +1,7 @@
1
1
  import { PlatformAdapter, AdapterConfig } from '../adapter-interface/interface.mjs';
2
- import { P as PDLSSContext, V as VerificationDecision, A as AgentAction, I as InterceptResult } from '../types-DOAb89cm.mjs';
2
+ import { P as PDLSSContext, V as VerificationDecision, A as AgentAction, I as InterceptResult } from '../types-DNK2BgIf.mjs';
3
3
  import '../gateway/gateway.mjs';
4
- import '../types-BwDmjIdr.mjs';
4
+ import '../types-L15pYd2c.mjs';
5
5
 
6
6
  /**
7
7
  * @astrasyncai/adapter-cursor
@@ -1,7 +1,7 @@
1
1
  import { PlatformAdapter, AdapterConfig } from '../adapter-interface/interface.js';
2
- import { P as PDLSSContext, V as VerificationDecision, A as AgentAction, I as InterceptResult } from '../types-aucqzfUa.js';
2
+ import { P as PDLSSContext, V as VerificationDecision, A as AgentAction, I as InterceptResult } from '../types-DoWIuzfj.js';
3
3
  import '../gateway/gateway.js';
4
- import '../types-BwDmjIdr.js';
4
+ import '../types-L15pYd2c.js';
5
5
 
6
6
  /**
7
7
  * @astrasyncai/adapter-cursor
@@ -1,8 +1,8 @@
1
1
  import { VSCodeAPI } from './cursor-adapter.mjs';
2
2
  import '../adapter-interface/interface.mjs';
3
3
  import '../gateway/gateway.mjs';
4
- import '../types-DOAb89cm.mjs';
5
- import '../types-BwDmjIdr.mjs';
4
+ import '../types-DNK2BgIf.mjs';
5
+ import '../types-L15pYd2c.mjs';
6
6
 
7
7
  /**
8
8
  * VS Code Extension entry point for AstraSync Local Guard (Cursor/VS Code).
@@ -1,8 +1,8 @@
1
1
  import { VSCodeAPI } from './cursor-adapter.js';
2
2
  import '../adapter-interface/interface.js';
3
3
  import '../gateway/gateway.js';
4
- import '../types-aucqzfUa.js';
5
- import '../types-BwDmjIdr.js';
4
+ import '../types-DoWIuzfj.js';
5
+ import '../types-L15pYd2c.js';
6
6
 
7
7
  /**
8
8
  * VS Code Extension entry point for AstraSync Local Guard (Cursor/VS Code).
@@ -3299,7 +3299,7 @@ function getTrustLevel(score) {
3299
3299
  }
3300
3300
 
3301
3301
  // src/version.ts
3302
- var SDK_VERSION = "2.4.7";
3302
+ var SDK_VERSION = "2.4.10";
3303
3303
 
3304
3304
  // src/verify.ts
3305
3305
  var DEFAULT_CONFIG = {
@@ -3310,8 +3310,10 @@ var DEFAULT_CONFIG = {
3310
3310
  // through (`hasMinimumAccess('guidance', 'guidance') === true`).
3311
3311
  defaultAccessLevel: "none",
3312
3312
  // minTrustScore + minTrustScoreForFull deprecated in v2.3.0 — server decides.
3313
- cacheTtl: 300,
3314
- // 5 minutes
3313
+ // Round-18.5 F4: cacheTtl deliberately unset. When undefined, cacheResult
3314
+ // applies the split default (60s autonomous / 300s step-up). When the
3315
+ // caller sets cacheTtl explicitly, that value is honoured uniformly.
3316
+ // Set cacheTtl: 0 to disable caching entirely.
3315
3317
  debug: false
3316
3318
  };
3317
3319
  var initCheckPerformed = false;
@@ -3338,11 +3340,28 @@ async function performInitCheck(apiBaseUrl, debug) {
3338
3340
  }
3339
3341
  }
3340
3342
  var verificationCache = /* @__PURE__ */ new Map();
3341
- function getCacheKey(credentials) {
3342
- return `${credentials.astraId || ""}-${credentials.apiKey || ""}-${credentials.jwt || ""}`;
3343
- }
3344
- function getCachedResult(credentials) {
3345
- const key = getCacheKey(credentials);
3343
+ function getCacheKey(request) {
3344
+ const c = request.credentials;
3345
+ return [
3346
+ c.astraId || "",
3347
+ c.apiKey || "",
3348
+ c.jwt || "",
3349
+ request.purpose || "",
3350
+ request.action || "",
3351
+ request.resourceType || "",
3352
+ request.resource || "",
3353
+ request.jurisdiction || "",
3354
+ request.transactionValue ?? "",
3355
+ request.currency || "",
3356
+ request.counterpartyUrl || "",
3357
+ request.counterpartyType || "",
3358
+ request.isSubAgentRequest ? "1" : "0",
3359
+ request.parentAgentId || "",
3360
+ request.subAgentDepth ?? ""
3361
+ ].join("|");
3362
+ }
3363
+ function getCachedResult(request) {
3364
+ const key = getCacheKey(request);
3346
3365
  const cached = verificationCache.get(key);
3347
3366
  if (cached && cached.expiresAt > Date.now()) {
3348
3367
  return cached.result;
@@ -3352,8 +3371,11 @@ function getCachedResult(credentials) {
3352
3371
  }
3353
3372
  return null;
3354
3373
  }
3355
- function cacheResult(credentials, result, ttlSeconds) {
3356
- const key = getCacheKey(credentials);
3374
+ var DEFAULT_AUTONOMOUS_TTL_SECONDS = 60;
3375
+ var DEFAULT_STEP_UP_TTL_SECONDS = 300;
3376
+ function cacheResult(request, result, configuredTtl) {
3377
+ const ttlSeconds = configuredTtl && configuredTtl > 0 ? configuredTtl : result.requiresStepUp ? DEFAULT_STEP_UP_TTL_SECONDS : DEFAULT_AUTONOMOUS_TTL_SECONDS;
3378
+ const key = getCacheKey(request);
3357
3379
  verificationCache.set(key, {
3358
3380
  result,
3359
3381
  expiresAt: Date.now() + ttlSeconds * 1e3
@@ -3382,12 +3404,17 @@ function createGuidanceResponse(config, reason, options = {}) {
3382
3404
  ]
3383
3405
  };
3384
3406
  return {
3385
- verified: false,
3407
+ // Round-18 G4: createGuidanceResponse fires for unverified-agent path or
3408
+ // API-error fallback. Identity is not verified (no agent resolved);
3409
+ // policy is not evaluated (we never reached the gate).
3410
+ identityVerified: false,
3411
+ policyAllowed: false,
3386
3412
  // v2.3.9 (defect #30): denials grant `'none'`, NEVER a positive band.
3387
- // Adapters additionally short-circuit on `verified === false` before
3388
- // the gate check, but the access level still has to be honest at the
3389
- // data layer so downstream consumers (SDK adapters in other languages,
3390
- // custom integrations) inherit the correct semantics.
3413
+ // Adapters additionally short-circuit on `!identityVerified ||
3414
+ // !policyAllowed` before the gate check, but the access level still has
3415
+ // to be honest at the data layer so downstream consumers (SDK adapters
3416
+ // in other languages, custom integrations) inherit the correct
3417
+ // semantics.
3391
3418
  accessLevel: "none",
3392
3419
  guidance,
3393
3420
  denialReasons: reason ? [reason] : ["No valid agent credentials provided"],
@@ -3503,8 +3530,8 @@ async function verify(config, request) {
3503
3530
  "[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."
3504
3531
  );
3505
3532
  }
3506
- if (mergedConfig.cacheTtl && mergedConfig.cacheTtl > 0) {
3507
- const cached = getCachedResult(request.credentials);
3533
+ if (mergedConfig.cacheTtl !== 0) {
3534
+ const cached = getCachedResult(request);
3508
3535
  if (cached) {
3509
3536
  if (mergedConfig.debug) {
3510
3537
  console.log("[VerificationGateway] Returning cached result");
@@ -3531,15 +3558,17 @@ async function verify(config, request) {
3531
3558
  }
3532
3559
  if (!apiResponse.access?.allowed) {
3533
3560
  const aggregatedFailures = apiResponse.access?.failures;
3561
+ const idVerifiedFromBackend = apiResponse.verificationContext?.idVerified === true;
3534
3562
  const result2 = {
3535
- verified: false,
3563
+ identityVerified: idVerifiedFromBackend,
3564
+ policyAllowed: false,
3536
3565
  // v2.3.9 (defect #30): denials grant `'none'`, NEVER a positive band.
3537
3566
  // Pre-rename this hardcoded `'guidance'`, which conflated with the
3538
3567
  // colocated `guidance: {...}` help-payload object below and let
3539
3568
  // denied requests pass any route gated at `'guidance'` because
3540
3569
  // `hasMinimumAccess('guidance', 'guidance') === true`. Adapters now
3541
- // ALSO short-circuit on `verified === false` before the gate check —
3542
- // belt-and-braces.
3570
+ // ALSO short-circuit on `!identityVerified || !policyAllowed` before
3571
+ // the gate check — belt-and-braces.
3543
3572
  accessLevel: "none",
3544
3573
  denialReasons: aggregatedFailures && aggregatedFailures.length > 0 ? aggregatedFailures.map((f) => f.message) : apiResponse.access?.reason ? [apiResponse.access.reason] : ["Access denied"],
3545
3574
  failures: aggregatedFailures,
@@ -3583,7 +3612,13 @@ async function verify(config, request) {
3583
3612
  const verificationContext = apiResponse.verificationContext;
3584
3613
  const accessLevel = apiResponse.access?.accessLevel ?? "standard";
3585
3614
  const result = {
3586
- verified: true,
3615
+ // Round-18 G4: backend allowed access. Identity is verified (we resolved
3616
+ // the caller to an agent) and policy passed all gates. Read idVerified
3617
+ // from verificationContext for symmetry with the deny branch; default true
3618
+ // on success path since `access.allowed === true` implies identity was
3619
+ // resolvable (anonymous-allow paths flow through createGuidanceResponse).
3620
+ identityVerified: apiResponse.verificationContext?.idVerified !== false,
3621
+ policyAllowed: true,
3587
3622
  accessLevel,
3588
3623
  agent,
3589
3624
  developer,
@@ -3606,7 +3641,7 @@ async function verify(config, request) {
3606
3641
  warningHeader: apiResponse.warningHeader
3607
3642
  };
3608
3643
  if (result.recommendation === "deny") {
3609
- result.verified = false;
3644
+ result.policyAllowed = false;
3610
3645
  result.accessLevel = "none";
3611
3646
  result.denialReasons = result.recommendationReasons || [
3612
3647
  "Access denied by AstraSync recommendation"
@@ -3625,8 +3660,8 @@ async function verify(config, request) {
3625
3660
  }
3626
3661
  result.denialReasons = result.recommendationReasons || ["Step-up verification required"];
3627
3662
  }
3628
- if (mergedConfig.cacheTtl && mergedConfig.cacheTtl > 0 && result.recommendation !== "deny") {
3629
- cacheResult(request.credentials, result, mergedConfig.cacheTtl);
3663
+ if (mergedConfig.cacheTtl !== 0 && result.recommendation !== "deny") {
3664
+ cacheResult(request, result, mergedConfig.cacheTtl);
3630
3665
  }
3631
3666
  return result;
3632
3667
  }
@@ -3698,7 +3733,7 @@ function toVerificationRequest(context, astraId) {
3698
3733
  };
3699
3734
  }
3700
3735
  function toDecision(result) {
3701
- if (result.verified) {
3736
+ if (result.identityVerified && result.policyAllowed) {
3702
3737
  return {
3703
3738
  recommendation: "ALLOW",
3704
3739
  reason: `Verified with access level: ${result.accessLevel}`,