@astrasyncai/verification-gateway 2.4.0 → 2.4.2

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 (87) hide show
  1. package/README.md +137 -22
  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 +37 -7
  7. package/dist/adapters/express.js.map +1 -1
  8. package/dist/adapters/express.mjs +37 -7
  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 +37 -7
  13. package/dist/adapters/mcp.js.map +1 -1
  14. package/dist/adapters/mcp.mjs +37 -7
  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 +30 -4
  19. package/dist/adapters/nextjs.js.map +1 -1
  20. package/dist/adapters/nextjs.mjs +30 -4
  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 +30 -4
  25. package/dist/adapters/sdk.js.map +1 -1
  26. package/dist/adapters/sdk.mjs +30 -4
  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/bin/astrasync.js +163 -4
  31. package/dist/browser/background.js +30 -4
  32. package/dist/browser/background.js.map +1 -1
  33. package/dist/browser/background.mjs +30 -4
  34. package/dist/browser/background.mjs.map +1 -1
  35. package/dist/browser/browser-adapter.d.mts +2 -2
  36. package/dist/browser/browser-adapter.d.ts +2 -2
  37. package/dist/cli/index.d.mts +2 -2
  38. package/dist/cli/index.d.ts +2 -2
  39. package/dist/cursor/cursor-adapter.d.mts +2 -2
  40. package/dist/cursor/cursor-adapter.d.ts +2 -2
  41. package/dist/cursor/extension.d.mts +2 -2
  42. package/dist/cursor/extension.d.ts +2 -2
  43. package/dist/cursor/extension.js +30 -4
  44. package/dist/cursor/extension.js.map +1 -1
  45. package/dist/cursor/extension.mjs +30 -4
  46. package/dist/cursor/extension.mjs.map +1 -1
  47. package/dist/{express-4Vau6x6X.d.mts → express-DneHiMhu.d.mts} +1 -1
  48. package/dist/{express-Nq-wWICa.d.ts → express-DsiaQRFt.d.ts} +1 -1
  49. package/dist/gateway/gateway.d.mts +2 -2
  50. package/dist/gateway/gateway.d.ts +2 -2
  51. package/dist/gateway/gateway.js +30 -4
  52. package/dist/gateway/gateway.js.map +1 -1
  53. package/dist/gateway/gateway.mjs +30 -4
  54. package/dist/gateway/gateway.mjs.map +1 -1
  55. package/dist/git-trigger/git-hooks.d.mts +2 -2
  56. package/dist/git-trigger/git-hooks.d.ts +2 -2
  57. package/dist/{index-DkyPV14Y.d.mts → index-C9yWlQ2Y.d.mts} +1 -1
  58. package/dist/{index-DiToN8gh.d.mts → index-DAGm-Sgf.d.mts} +1 -1
  59. package/dist/{index-B-EovXnY.d.ts → index-Dd4alF0l.d.ts} +1 -1
  60. package/dist/{index-CxwCN7AC.d.ts → index-NZiKvrtE.d.ts} +1 -1
  61. package/dist/index.d.mts +7 -7
  62. package/dist/index.d.ts +7 -7
  63. package/dist/index.js +37 -7
  64. package/dist/index.js.map +1 -1
  65. package/dist/index.mjs +37 -7
  66. package/dist/index.mjs.map +1 -1
  67. package/dist/local-evaluator/evaluator.d.mts +2 -2
  68. package/dist/local-evaluator/evaluator.d.ts +2 -2
  69. package/dist/{nextjs-DO_4crcp.d.ts → nextjs-B4WmoiVm.d.ts} +1 -1
  70. package/dist/{nextjs-BTR7Oix-.d.mts → nextjs-vUuVCaBP.d.mts} +1 -1
  71. package/dist/registration/index.d.mts +174 -7
  72. package/dist/registration/index.d.ts +174 -7
  73. package/dist/registration/index.js +171 -6
  74. package/dist/registration/index.js.map +1 -1
  75. package/dist/registration/index.mjs +167 -5
  76. package/dist/registration/index.mjs.map +1 -1
  77. package/dist/{sdk-TnHXD-Oh.d.ts → sdk-BvWp4q2q.d.ts} +1 -1
  78. package/dist/{sdk-DSLCyXIX.d.mts → sdk-Cixo6pTV.d.mts} +1 -1
  79. package/dist/transport/index.d.mts +2 -2
  80. package/dist/transport/index.d.ts +2 -2
  81. package/dist/{types-pU2O0BFq.d.mts → types-C_e1IZdU.d.mts} +1 -1
  82. package/dist/{types-BVp22KkN.d.mts → types-DLai3jly.d.mts} +16 -13
  83. package/dist/{types-BVp22KkN.d.ts → types-DLai3jly.d.ts} +16 -13
  84. package/dist/{types-DVCWReEN.d.ts → types-IUzu-A4u.d.ts} +1 -1
  85. package/dist/ui/index.d.mts +1 -1
  86. package/dist/ui/index.d.ts +1 -1
  87. package/package.json +1 -1
@@ -1,5 +1,5 @@
1
1
  import { RequestHandler, Request } from 'express';
2
- import { V as VerificationResult, E as ExpressMiddlewareOptions, A as AstraSyncCredentials } from './types-BVp22KkN.mjs';
2
+ import { V as VerificationResult, E as ExpressMiddlewareOptions, A as AstraSyncCredentials } from './types-DLai3jly.mjs';
3
3
 
4
4
  /**
5
5
  * AstraSync Universal Verification Gateway - Express Middleware
@@ -1,5 +1,5 @@
1
1
  import { RequestHandler, Request } from 'express';
2
- import { V as VerificationResult, E as ExpressMiddlewareOptions, A as AstraSyncCredentials } from './types-BVp22KkN.js';
2
+ import { V as VerificationResult, E as ExpressMiddlewareOptions, A as AstraSyncCredentials } from './types-DLai3jly.js';
3
3
 
4
4
  /**
5
5
  * AstraSync Universal Verification Gateway - Express Middleware
@@ -1,5 +1,5 @@
1
- import { b as AstraSyncGatewayConfig, P as PDLSSContext, V as VerificationDecision } from '../types-pU2O0BFq.mjs';
2
- import '../types-BVp22KkN.mjs';
1
+ import { b as AstraSyncGatewayConfig, P as PDLSSContext, V as VerificationDecision } from '../types-C_e1IZdU.mjs';
2
+ import '../types-DLai3jly.mjs';
3
3
 
4
4
  /**
5
5
  * AstraSyncGateway — Primary API surface for agent verification.
@@ -1,5 +1,5 @@
1
- import { b as AstraSyncGatewayConfig, P as PDLSSContext, V as VerificationDecision } from '../types-DVCWReEN.js';
2
- import '../types-BVp22KkN.js';
1
+ import { b as AstraSyncGatewayConfig, P as PDLSSContext, V as VerificationDecision } from '../types-IUzu-A4u.js';
2
+ import '../types-DLai3jly.js';
3
3
 
4
4
  /**
5
5
  * AstraSyncGateway — Primary API surface for agent verification.
@@ -3112,8 +3112,18 @@ function cacheResult(credentials, result, ttlSeconds) {
3112
3112
  expiresAt: Date.now() + ttlSeconds * 1e3
3113
3113
  });
3114
3114
  }
3115
- function createGuidanceResponse(config, reason) {
3116
- const guidance = {
3115
+ function createGuidanceResponse(config, reason, options = {}) {
3116
+ const source = options.source ?? "no_credentials";
3117
+ const isApiError = source === "api_error";
3118
+ const guidance = isApiError ? {
3119
+ message: "Verification is temporarily unavailable. Retry with exponential backoff; if the issue persists, contact support with the correlationId.",
3120
+ registrationUrl: `${config.apiBaseUrl.replace("/api", "")}/register`,
3121
+ documentationUrl: `${config.apiBaseUrl.replace("/api", "")}/docs/agent-access`,
3122
+ steps: [
3123
+ "Retry the request with exponential backoff",
3124
+ "If failures persist, share the correlationId with support"
3125
+ ]
3126
+ } : {
3117
3127
  message: "This service verifies AI agents before granting access. Please register your agent with AstraSync.",
3118
3128
  registrationUrl: `${config.apiBaseUrl.replace("/api", "")}/register`,
3119
3129
  documentationUrl: `${config.apiBaseUrl.replace("/api", "")}/docs/agent-access`,
@@ -3134,6 +3144,18 @@ function createGuidanceResponse(config, reason) {
3134
3144
  accessLevel: "none",
3135
3145
  guidance,
3136
3146
  denialReasons: reason ? [reason] : ["No valid agent credentials provided"],
3147
+ // Round-10 (#47, O5): on API-error fallback, surface a typed failure so
3148
+ // partners (and their custom onDenied handlers) can branch on
3149
+ // dimension. Without this, the synthesised stub was indistinguishable
3150
+ // from a real policy deny.
3151
+ failures: isApiError ? [
3152
+ {
3153
+ dimension: "verify_access.api_error",
3154
+ message: reason ?? "Verification temporarily unavailable",
3155
+ guidance: guidance.message
3156
+ }
3157
+ ] : void 0,
3158
+ correlationId: options.correlationId,
3137
3159
  verifiedAt: /* @__PURE__ */ new Date()
3138
3160
  };
3139
3161
  }
@@ -3208,7 +3230,8 @@ async function callVerifyAccessAPI(config, request) {
3208
3230
  if (!response.ok) {
3209
3231
  return {
3210
3232
  success: false,
3211
- error: data.message || data.error || `API returned ${response.status}`
3233
+ error: data.message || data.error || `API returned ${response.status}`,
3234
+ correlationId: typeof data?.correlationId === "string" ? data.correlationId : void 0
3212
3235
  };
3213
3236
  }
3214
3237
  return data;
@@ -3252,7 +3275,10 @@ async function verify(config, request) {
3252
3275
  }
3253
3276
  const apiResponse = await callVerifyAccessAPI(mergedConfig, enrichedRequest);
3254
3277
  if (!apiResponse.success) {
3255
- return createGuidanceResponse(mergedConfig, apiResponse.error);
3278
+ return createGuidanceResponse(mergedConfig, apiResponse.error, {
3279
+ source: "api_error",
3280
+ correlationId: apiResponse.correlationId
3281
+ });
3256
3282
  }
3257
3283
  if (!apiResponse.access?.allowed) {
3258
3284
  const aggregatedFailures = apiResponse.access?.failures;