@astrasyncai/verification-gateway 2.3.8 → 2.3.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 (84) hide show
  1. package/README.md +93 -10
  2. package/dist/adapter-interface/interface.d.mts +2 -2
  3. package/dist/adapter-interface/interface.d.ts +2 -2
  4. package/dist/adapters/express.d.mts +2 -2
  5. package/dist/adapters/express.d.ts +2 -2
  6. package/dist/adapters/express.js +45 -6
  7. package/dist/adapters/express.js.map +1 -1
  8. package/dist/adapters/express.mjs +45 -6
  9. package/dist/adapters/express.mjs.map +1 -1
  10. package/dist/adapters/mcp.d.mts +1 -1
  11. package/dist/adapters/mcp.d.ts +1 -1
  12. package/dist/adapters/mcp.js +93 -11
  13. package/dist/adapters/mcp.js.map +1 -1
  14. package/dist/adapters/mcp.mjs +93 -11
  15. package/dist/adapters/mcp.mjs.map +1 -1
  16. package/dist/adapters/nextjs.d.mts +2 -2
  17. package/dist/adapters/nextjs.d.ts +2 -2
  18. package/dist/adapters/nextjs.js +27 -5
  19. package/dist/adapters/nextjs.js.map +1 -1
  20. package/dist/adapters/nextjs.mjs +27 -5
  21. package/dist/adapters/nextjs.mjs.map +1 -1
  22. package/dist/adapters/sdk.d.mts +2 -2
  23. package/dist/adapters/sdk.d.ts +2 -2
  24. package/dist/adapters/sdk.js +27 -5
  25. package/dist/adapters/sdk.js.map +1 -1
  26. package/dist/adapters/sdk.mjs +27 -5
  27. package/dist/adapters/sdk.mjs.map +1 -1
  28. package/dist/agent/index.d.mts +2 -2
  29. package/dist/agent/index.d.ts +2 -2
  30. package/dist/browser/background.js +26 -4
  31. package/dist/browser/background.js.map +1 -1
  32. package/dist/browser/background.mjs +26 -4
  33. package/dist/browser/background.mjs.map +1 -1
  34. package/dist/browser/browser-adapter.d.mts +2 -2
  35. package/dist/browser/browser-adapter.d.ts +2 -2
  36. package/dist/cli/index.d.mts +2 -2
  37. package/dist/cli/index.d.ts +2 -2
  38. package/dist/cursor/cursor-adapter.d.mts +2 -2
  39. package/dist/cursor/cursor-adapter.d.ts +2 -2
  40. package/dist/cursor/extension.d.mts +2 -2
  41. package/dist/cursor/extension.d.ts +2 -2
  42. package/dist/cursor/extension.js +26 -4
  43. package/dist/cursor/extension.js.map +1 -1
  44. package/dist/cursor/extension.mjs +26 -4
  45. package/dist/cursor/extension.mjs.map +1 -1
  46. package/dist/{express-BNWqDVIz.d.mts → express-4Vau6x6X.d.mts} +1 -1
  47. package/dist/{express-BYup_4Jg.d.ts → express-Nq-wWICa.d.ts} +1 -1
  48. package/dist/gateway/gateway.d.mts +2 -2
  49. package/dist/gateway/gateway.d.ts +2 -2
  50. package/dist/gateway/gateway.js +26 -4
  51. package/dist/gateway/gateway.js.map +1 -1
  52. package/dist/gateway/gateway.mjs +26 -4
  53. package/dist/gateway/gateway.mjs.map +1 -1
  54. package/dist/git-trigger/git-hooks.d.mts +2 -2
  55. package/dist/git-trigger/git-hooks.d.ts +2 -2
  56. package/dist/{index-DN3ztP2d.d.ts → index-B-EovXnY.d.ts} +1 -1
  57. package/dist/{index-CSMpOcxV.d.ts → index-CxwCN7AC.d.ts} +1 -1
  58. package/dist/{index-CK4lNLVn.d.mts → index-DiToN8gh.d.mts} +1 -1
  59. package/dist/{index-BHXa2WTO.d.mts → index-DkyPV14Y.d.mts} +1 -1
  60. package/dist/index.d.mts +7 -7
  61. package/dist/index.d.ts +7 -7
  62. package/dist/index.js +51 -12
  63. package/dist/index.js.map +1 -1
  64. package/dist/index.mjs +51 -12
  65. package/dist/index.mjs.map +1 -1
  66. package/dist/local-evaluator/evaluator.d.mts +2 -2
  67. package/dist/local-evaluator/evaluator.d.ts +2 -2
  68. package/dist/{nextjs-Bzdfu8Eg.d.mts → nextjs-BTR7Oix-.d.mts} +1 -1
  69. package/dist/{nextjs-C4h_MpgK.d.ts → nextjs-DO_4crcp.d.ts} +1 -1
  70. package/dist/{sdk-Tzsn6s-O.d.ts → sdk-DSLCyXIX.d.mts} +9 -2
  71. package/dist/{sdk-CDdD7EcJ.d.mts → sdk-TnHXD-Oh.d.ts} +9 -2
  72. package/dist/transport/index.d.mts +2 -2
  73. package/dist/transport/index.d.ts +2 -2
  74. package/dist/{types-D_tmbDA_.d.mts → types-BVp22KkN.d.mts} +27 -3
  75. package/dist/{types-D_tmbDA_.d.ts → types-BVp22KkN.d.ts} +27 -3
  76. package/dist/{types-Bzp1SMaD.d.ts → types-DVCWReEN.d.ts} +1 -1
  77. package/dist/{types-z-QVnG4b.d.mts → types-pU2O0BFq.d.mts} +1 -1
  78. package/dist/ui/index.d.mts +1 -1
  79. package/dist/ui/index.d.ts +1 -1
  80. package/dist/ui/index.js +3 -3
  81. package/dist/ui/index.js.map +1 -1
  82. package/dist/ui/index.mjs +3 -3
  83. package/dist/ui/index.mjs.map +1 -1
  84. package/package.json +1 -1
@@ -1,6 +1,6 @@
1
1
  import { AstraSyncGateway } from '../gateway/gateway.mjs';
2
- import { V as VerificationDecision, P as PDLSSContext } from '../types-z-QVnG4b.mjs';
3
- import '../types-D_tmbDA_.mjs';
2
+ import { V as VerificationDecision, P as PDLSSContext } from '../types-pU2O0BFq.mjs';
3
+ import '../types-BVp22KkN.mjs';
4
4
 
5
5
  /**
6
6
  * Git Trigger — Enterprise git push / PR verification
@@ -1,6 +1,6 @@
1
1
  import { AstraSyncGateway } from '../gateway/gateway.js';
2
- import { V as VerificationDecision, P as PDLSSContext } from '../types-Bzp1SMaD.js';
3
- import '../types-D_tmbDA_.js';
2
+ import { V as VerificationDecision, P as PDLSSContext } from '../types-DVCWReEN.js';
3
+ import '../types-BVp22KkN.js';
4
4
 
5
5
  /**
6
6
  * Git Trigger — Enterprise git push / PR verification
@@ -1,4 +1,4 @@
1
- import { A as AstraSyncCredentials, g as ProtocolTransport, G as GatewayConfig } from './types-D_tmbDA_.js';
1
+ import { A as AstraSyncCredentials, g as ProtocolTransport, G as GatewayConfig } from './types-BVp22KkN.js';
2
2
 
3
3
  /**
4
4
  * AgentClient — Credential Presentation
@@ -1,4 +1,4 @@
1
- import { A as AstraSyncCredentials, g as ProtocolTransport } from './types-D_tmbDA_.js';
1
+ import { A as AstraSyncCredentials, g as ProtocolTransport } from './types-BVp22KkN.js';
2
2
  import { JWK } from 'jose';
3
3
 
4
4
  /**
@@ -1,4 +1,4 @@
1
- import { A as AstraSyncCredentials, g as ProtocolTransport, G as GatewayConfig } from './types-D_tmbDA_.mjs';
1
+ import { A as AstraSyncCredentials, g as ProtocolTransport, G as GatewayConfig } from './types-BVp22KkN.mjs';
2
2
 
3
3
  /**
4
4
  * AgentClient — Credential Presentation
@@ -1,4 +1,4 @@
1
- import { A as AstraSyncCredentials, g as ProtocolTransport } from './types-D_tmbDA_.mjs';
1
+ import { A as AstraSyncCredentials, g as ProtocolTransport } from './types-BVp22KkN.mjs';
2
2
  import { JWK } from 'jose';
3
3
 
4
4
  /**
package/dist/index.d.mts CHANGED
@@ -1,10 +1,10 @@
1
- import { b as AgentCredentials, G as GatewayConfig, a as AccessLevel, c as VerificationRequest, V as VerificationResult } from './types-D_tmbDA_.mjs';
2
- export { A as AstraSyncCredentials, d as CommerceShieldProps, C as CounterpartyType, e as EnhancedVerificationResult, E as ExpressMiddlewareOptions, f as GuidanceInfo, N as NextJsMiddlewareOptions, P as PDLSSInfo, g as ProtocolTransport, R as RouteAccessConfig, h as RuntimeChallengeResult, S as SDKOptions, T as TokenGuidance, i as TrustLevel, j as VerifiedAgent, k as VerifiedDeveloper, l as VerifiedOrganization } from './types-D_tmbDA_.mjs';
3
- export { A as ACCESS_LEVEL_DESCRIPTIONS, a as ACCESS_LEVEL_HIERARCHY, b as AccessCapabilities, D as DEFAULT_TRUST_THRESHOLDS, T as TRUST_LEVEL_RANGES, d as determineAccessLevel, g as getAccessLevelForScore, c as getCapabilities, e as getTrustLevel, h as hasMinimumAccess, s as sdk } from './sdk-CDdD7EcJ.mjs';
4
- export { e as express } from './express-BNWqDVIz.mjs';
5
- export { n as nextjs } from './nextjs-Bzdfu8Eg.mjs';
6
- export { i as transport } from './index-BHXa2WTO.mjs';
7
- export { A as AgentClient, C as ChallengeHandler, i as agent, r as recordDecision } from './index-CK4lNLVn.mjs';
1
+ import { b as AgentCredentials, G as GatewayConfig, a as AccessLevel, c as VerificationRequest, V as VerificationResult } from './types-BVp22KkN.mjs';
2
+ export { A as AstraSyncCredentials, d as CommerceShieldProps, C as CounterpartyType, e as EnhancedVerificationResult, E as ExpressMiddlewareOptions, f as GuidanceInfo, N as NextJsMiddlewareOptions, P as PDLSSInfo, g as ProtocolTransport, R as RouteAccessConfig, h as RuntimeChallengeResult, S as SDKOptions, T as TokenGuidance, i as TrustLevel, j as VerifiedAgent, k as VerifiedDeveloper, l as VerifiedOrganization } from './types-BVp22KkN.mjs';
3
+ export { A as ACCESS_LEVEL_DESCRIPTIONS, a as ACCESS_LEVEL_HIERARCHY, b as AccessCapabilities, D as DEFAULT_TRUST_THRESHOLDS, T as TRUST_LEVEL_RANGES, d as determineAccessLevel, g as getAccessLevelForScore, c as getCapabilities, e as getTrustLevel, h as hasMinimumAccess, s as sdk } from './sdk-DSLCyXIX.mjs';
4
+ export { e as express } from './express-4Vau6x6X.mjs';
5
+ export { n as nextjs } from './nextjs-BTR7Oix-.mjs';
6
+ export { i as transport } from './index-DkyPV14Y.mjs';
7
+ export { A as AgentClient, C as ChallengeHandler, i as agent, r as recordDecision } from './index-DiToN8gh.mjs';
8
8
  import 'express';
9
9
  import 'next/server';
10
10
  import 'jose';
package/dist/index.d.ts CHANGED
@@ -1,10 +1,10 @@
1
- import { b as AgentCredentials, G as GatewayConfig, a as AccessLevel, c as VerificationRequest, V as VerificationResult } from './types-D_tmbDA_.js';
2
- export { A as AstraSyncCredentials, d as CommerceShieldProps, C as CounterpartyType, e as EnhancedVerificationResult, E as ExpressMiddlewareOptions, f as GuidanceInfo, N as NextJsMiddlewareOptions, P as PDLSSInfo, g as ProtocolTransport, R as RouteAccessConfig, h as RuntimeChallengeResult, S as SDKOptions, T as TokenGuidance, i as TrustLevel, j as VerifiedAgent, k as VerifiedDeveloper, l as VerifiedOrganization } from './types-D_tmbDA_.js';
3
- export { A as ACCESS_LEVEL_DESCRIPTIONS, a as ACCESS_LEVEL_HIERARCHY, b as AccessCapabilities, D as DEFAULT_TRUST_THRESHOLDS, T as TRUST_LEVEL_RANGES, d as determineAccessLevel, g as getAccessLevelForScore, c as getCapabilities, e as getTrustLevel, h as hasMinimumAccess, s as sdk } from './sdk-Tzsn6s-O.js';
4
- export { e as express } from './express-BYup_4Jg.js';
5
- export { n as nextjs } from './nextjs-C4h_MpgK.js';
6
- export { i as transport } from './index-CSMpOcxV.js';
7
- export { A as AgentClient, C as ChallengeHandler, i as agent, r as recordDecision } from './index-DN3ztP2d.js';
1
+ import { b as AgentCredentials, G as GatewayConfig, a as AccessLevel, c as VerificationRequest, V as VerificationResult } from './types-BVp22KkN.js';
2
+ export { A as AstraSyncCredentials, d as CommerceShieldProps, C as CounterpartyType, e as EnhancedVerificationResult, E as ExpressMiddlewareOptions, f as GuidanceInfo, N as NextJsMiddlewareOptions, P as PDLSSInfo, g as ProtocolTransport, R as RouteAccessConfig, h as RuntimeChallengeResult, S as SDKOptions, T as TokenGuidance, i as TrustLevel, j as VerifiedAgent, k as VerifiedDeveloper, l as VerifiedOrganization } from './types-BVp22KkN.js';
3
+ export { A as ACCESS_LEVEL_DESCRIPTIONS, a as ACCESS_LEVEL_HIERARCHY, b as AccessCapabilities, D as DEFAULT_TRUST_THRESHOLDS, T as TRUST_LEVEL_RANGES, d as determineAccessLevel, g as getAccessLevelForScore, c as getCapabilities, e as getTrustLevel, h as hasMinimumAccess, s as sdk } from './sdk-TnHXD-Oh.js';
4
+ export { e as express } from './express-Nq-wWICa.js';
5
+ export { n as nextjs } from './nextjs-DO_4crcp.js';
6
+ export { i as transport } from './index-CxwCN7AC.js';
7
+ export { A as AgentClient, C as ChallengeHandler, i as agent, r as recordDecision } from './index-B-EovXnY.js';
8
8
  import 'express';
9
9
  import 'next/server';
10
10
  import 'jose';
package/dist/index.js CHANGED
@@ -59,7 +59,7 @@ module.exports = __toCommonJS(src_exports);
59
59
  // src/access-levels.ts
60
60
  var ACCESS_LEVEL_HIERARCHY = {
61
61
  none: 0,
62
- guidance: 1,
62
+ restricted: 1,
63
63
  "read-only": 2,
64
64
  standard: 3,
65
65
  full: 4,
@@ -67,7 +67,7 @@ var ACCESS_LEVEL_HIERARCHY = {
67
67
  };
68
68
  var ACCESS_LEVEL_DESCRIPTIONS = {
69
69
  none: "No access - credentials required",
70
- guidance: "Guidance mode - registration information provided",
70
+ restricted: "Restricted access - registration prompt only",
71
71
  "read-only": "Read-only access - can browse but not modify",
72
72
  standard: "Standard access - normal operations per PDLSS policy",
73
73
  full: "Full access - all operations for high-trust agents",
@@ -75,7 +75,7 @@ var ACCESS_LEVEL_DESCRIPTIONS = {
75
75
  };
76
76
  var DEFAULT_TRUST_THRESHOLDS = {
77
77
  none: 0,
78
- guidance: 0,
78
+ restricted: 0,
79
79
  "read-only": 20,
80
80
  standard: 40,
81
81
  full: 70,
@@ -101,11 +101,11 @@ function getAccessLevelForScore(trustScore, thresholds = DEFAULT_TRUST_THRESHOLD
101
101
  if (trustScore >= thresholds.full) return "full";
102
102
  if (trustScore >= thresholds.standard) return "standard";
103
103
  if (trustScore >= thresholds["read-only"]) return "read-only";
104
- return "guidance";
104
+ return "restricted";
105
105
  }
106
106
  function determineAccessLevel(verified, trustScore, isOrgMember, customThresholds) {
107
107
  if (!verified) {
108
- return "guidance";
108
+ return "none";
109
109
  }
110
110
  if (isOrgMember) {
111
111
  return "internal";
@@ -126,7 +126,7 @@ function getCapabilities(accessLevel) {
126
126
  canAdmin: false,
127
127
  canAccessInternal: false
128
128
  };
129
- case "guidance":
129
+ case "restricted":
130
130
  return {
131
131
  canRead: false,
132
132
  canWrite: false,
@@ -180,7 +180,11 @@ function getCapabilities(accessLevel) {
180
180
  // src/verify.ts
181
181
  var DEFAULT_CONFIG = {
182
182
  apiBaseUrl: "https://astrasync.ai/api",
183
- defaultAccessLevel: "guidance",
183
+ // v2.3.9 (defect #30): default for unconfigured callers is `'none'` (no
184
+ // access). Pre-rename this defaulted to `'guidance'`, which combined with
185
+ // a route gated at `'guidance'` to silently let unverified traffic
186
+ // through (`hasMinimumAccess('guidance', 'guidance') === true`).
187
+ defaultAccessLevel: "none",
184
188
  // minTrustScore + minTrustScoreForFull deprecated in v2.3.0 — server decides.
185
189
  cacheTtl: 300,
186
190
  // 5 minutes
@@ -279,7 +283,12 @@ function createGuidanceResponse(config, reason) {
279
283
  };
280
284
  return {
281
285
  verified: false,
282
- accessLevel: "guidance",
286
+ // v2.3.9 (defect #30): denials grant `'none'`, NEVER a positive band.
287
+ // Adapters additionally short-circuit on `verified === false` before
288
+ // the gate check, but the access level still has to be honest at the
289
+ // data layer so downstream consumers (SDK adapters in other languages,
290
+ // custom integrations) inherit the correct semantics.
291
+ accessLevel: "none",
283
292
  guidance,
284
293
  denialReasons: reason ? [reason] : ["No valid agent credentials provided"],
285
294
  verifiedAt: /* @__PURE__ */ new Date()
@@ -406,7 +415,14 @@ async function verify(config, request) {
406
415
  const aggregatedFailures = apiResponse.access?.failures;
407
416
  const result2 = {
408
417
  verified: false,
409
- accessLevel: "guidance",
418
+ // v2.3.9 (defect #30): denials grant `'none'`, NEVER a positive band.
419
+ // Pre-rename this hardcoded `'guidance'`, which conflated with the
420
+ // colocated `guidance: {...}` help-payload object below and let
421
+ // denied requests pass any route gated at `'guidance'` because
422
+ // `hasMinimumAccess('guidance', 'guidance') === true`. Adapters now
423
+ // ALSO short-circuit on `verified === false` before the gate check —
424
+ // belt-and-braces.
425
+ accessLevel: "none",
410
426
  denialReasons: aggregatedFailures && aggregatedFailures.length > 0 ? aggregatedFailures.map((f) => f.message) : apiResponse.access?.reason ? [apiResponse.access.reason] : ["Access denied"],
411
427
  failures: aggregatedFailures,
412
428
  requiresStepUp: apiResponse.access?.requiresStepUp,
@@ -419,6 +435,9 @@ async function verify(config, request) {
419
435
  verifiedAt: /* @__PURE__ */ new Date(),
420
436
  // Extract sessionId so decisions can be recorded for denials too
421
437
  sessionId: apiResponse.sessionId,
438
+ // v2.3.10 (defect #34, round-4): anonymous traffic has no session →
439
+ // correlationId is the linking key for paired local_override events.
440
+ correlationId: apiResponse.correlationId,
422
441
  recommendation: apiResponse.recommendation,
423
442
  recommendationReasons: apiResponse.recommendationReasons
424
443
  };
@@ -459,6 +478,9 @@ async function verify(config, request) {
459
478
  cacheTtl: mergedConfig.cacheTtl,
460
479
  // Handshake Protocol v10 enhanced fields (present when backend returns them)
461
480
  sessionId: apiResponse.sessionId,
481
+ // v2.3.10 (defect #34, round-4): anonymous responses surface correlationId
482
+ // (no session row exists for unverified callers).
483
+ correlationId: apiResponse.correlationId,
462
484
  runtimeChallenge: apiResponse.runtimeChallenge,
463
485
  tokenGuidance: apiResponse.tokenGuidance,
464
486
  recommendation: apiResponse.recommendation,
@@ -490,7 +512,7 @@ async function verify(config, request) {
490
512
  }
491
513
  return result;
492
514
  }
493
- async function recordDecision(config, sessionId, decision, reason) {
515
+ async function recordDecision(config, sessionId, decision, reason, override) {
494
516
  const headers = { "Content-Type": "application/json" };
495
517
  if (config.apiKey) {
496
518
  headers["Authorization"] = `Bearer ${config.apiKey}`;
@@ -499,7 +521,16 @@ async function recordDecision(config, sessionId, decision, reason) {
499
521
  await fetch(`${config.apiBaseUrl}/agents/verify-access/${sessionId}/decision`, {
500
522
  method: "POST",
501
523
  headers,
502
- body: JSON.stringify({ decision, reason })
524
+ body: JSON.stringify({
525
+ decision,
526
+ reason,
527
+ ...override && {
528
+ overriddenBy: override.overriddenBy,
529
+ toolName: override.toolName,
530
+ requestedLevel: override.requestedLevel,
531
+ grantedLevel: override.grantedLevel
532
+ }
533
+ })
503
534
  }).catch(() => {
504
535
  });
505
536
  }
@@ -852,6 +883,14 @@ function createMiddleware(options) {
852
883
  });
853
884
  req.agentVerification = result;
854
885
  const sessionId = result.sessionId;
886
+ if (!result.verified) {
887
+ if (shouldRecordDecisions && sessionId) {
888
+ recordDecision(config, sessionId, "denied", result.denialReasons?.[0]).catch(() => {
889
+ });
890
+ }
891
+ onDenied(result, req, res);
892
+ return;
893
+ }
855
894
  if (!hasMinimumAccess(result.accessLevel, routeConfig.minAccessLevel)) {
856
895
  if (shouldRecordDecisions && sessionId) {
857
896
  recordDecision(config, sessionId, "denied", result.denialReasons?.[0]).catch(() => {
@@ -1236,7 +1275,7 @@ function createMiddleware2(options) {
1236
1275
  agentCardUrl: request.headers.get("x-astrasync-agent-card") || void 0
1237
1276
  }
1238
1277
  });
1239
- if (!hasMinimumAccess(result.accessLevel, routeConfig.minAccessLevel)) {
1278
+ if (!result.verified || !hasMinimumAccess(result.accessLevel, routeConfig.minAccessLevel)) {
1240
1279
  if (pathname.startsWith("/api/")) {
1241
1280
  return NextResponse.json(
1242
1281
  {