@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.
- package/README.md +137 -22
- package/dist/adapter-interface/interface.d.mts +2 -2
- package/dist/adapter-interface/interface.d.ts +2 -2
- package/dist/adapters/express.d.mts +2 -2
- package/dist/adapters/express.d.ts +2 -2
- package/dist/adapters/express.js +37 -7
- package/dist/adapters/express.js.map +1 -1
- package/dist/adapters/express.mjs +37 -7
- package/dist/adapters/express.mjs.map +1 -1
- package/dist/adapters/mcp.d.mts +1 -1
- package/dist/adapters/mcp.d.ts +1 -1
- package/dist/adapters/mcp.js +37 -7
- package/dist/adapters/mcp.js.map +1 -1
- package/dist/adapters/mcp.mjs +37 -7
- package/dist/adapters/mcp.mjs.map +1 -1
- package/dist/adapters/nextjs.d.mts +2 -2
- package/dist/adapters/nextjs.d.ts +2 -2
- package/dist/adapters/nextjs.js +30 -4
- package/dist/adapters/nextjs.js.map +1 -1
- package/dist/adapters/nextjs.mjs +30 -4
- package/dist/adapters/nextjs.mjs.map +1 -1
- package/dist/adapters/sdk.d.mts +2 -2
- package/dist/adapters/sdk.d.ts +2 -2
- package/dist/adapters/sdk.js +30 -4
- package/dist/adapters/sdk.js.map +1 -1
- package/dist/adapters/sdk.mjs +30 -4
- package/dist/adapters/sdk.mjs.map +1 -1
- package/dist/agent/index.d.mts +2 -2
- package/dist/agent/index.d.ts +2 -2
- package/dist/bin/astrasync.js +163 -4
- package/dist/browser/background.js +30 -4
- package/dist/browser/background.js.map +1 -1
- package/dist/browser/background.mjs +30 -4
- package/dist/browser/background.mjs.map +1 -1
- package/dist/browser/browser-adapter.d.mts +2 -2
- package/dist/browser/browser-adapter.d.ts +2 -2
- package/dist/cli/index.d.mts +2 -2
- package/dist/cli/index.d.ts +2 -2
- package/dist/cursor/cursor-adapter.d.mts +2 -2
- package/dist/cursor/cursor-adapter.d.ts +2 -2
- package/dist/cursor/extension.d.mts +2 -2
- package/dist/cursor/extension.d.ts +2 -2
- package/dist/cursor/extension.js +30 -4
- package/dist/cursor/extension.js.map +1 -1
- package/dist/cursor/extension.mjs +30 -4
- package/dist/cursor/extension.mjs.map +1 -1
- package/dist/{express-4Vau6x6X.d.mts → express-DneHiMhu.d.mts} +1 -1
- package/dist/{express-Nq-wWICa.d.ts → express-DsiaQRFt.d.ts} +1 -1
- package/dist/gateway/gateway.d.mts +2 -2
- package/dist/gateway/gateway.d.ts +2 -2
- package/dist/gateway/gateway.js +30 -4
- package/dist/gateway/gateway.js.map +1 -1
- package/dist/gateway/gateway.mjs +30 -4
- package/dist/gateway/gateway.mjs.map +1 -1
- package/dist/git-trigger/git-hooks.d.mts +2 -2
- package/dist/git-trigger/git-hooks.d.ts +2 -2
- package/dist/{index-DkyPV14Y.d.mts → index-C9yWlQ2Y.d.mts} +1 -1
- package/dist/{index-DiToN8gh.d.mts → index-DAGm-Sgf.d.mts} +1 -1
- package/dist/{index-B-EovXnY.d.ts → index-Dd4alF0l.d.ts} +1 -1
- package/dist/{index-CxwCN7AC.d.ts → index-NZiKvrtE.d.ts} +1 -1
- package/dist/index.d.mts +7 -7
- package/dist/index.d.ts +7 -7
- package/dist/index.js +37 -7
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +37 -7
- package/dist/index.mjs.map +1 -1
- package/dist/local-evaluator/evaluator.d.mts +2 -2
- package/dist/local-evaluator/evaluator.d.ts +2 -2
- package/dist/{nextjs-DO_4crcp.d.ts → nextjs-B4WmoiVm.d.ts} +1 -1
- package/dist/{nextjs-BTR7Oix-.d.mts → nextjs-vUuVCaBP.d.mts} +1 -1
- package/dist/registration/index.d.mts +174 -7
- package/dist/registration/index.d.ts +174 -7
- package/dist/registration/index.js +171 -6
- package/dist/registration/index.js.map +1 -1
- package/dist/registration/index.mjs +167 -5
- package/dist/registration/index.mjs.map +1 -1
- package/dist/{sdk-TnHXD-Oh.d.ts → sdk-BvWp4q2q.d.ts} +1 -1
- package/dist/{sdk-DSLCyXIX.d.mts → sdk-Cixo6pTV.d.mts} +1 -1
- package/dist/transport/index.d.mts +2 -2
- package/dist/transport/index.d.ts +2 -2
- package/dist/{types-pU2O0BFq.d.mts → types-C_e1IZdU.d.mts} +1 -1
- package/dist/{types-BVp22KkN.d.mts → types-DLai3jly.d.mts} +16 -13
- package/dist/{types-BVp22KkN.d.ts → types-DLai3jly.d.ts} +16 -13
- package/dist/{types-DVCWReEN.d.ts → types-IUzu-A4u.d.ts} +1 -1
- package/dist/ui/index.d.mts +1 -1
- package/dist/ui/index.d.ts +1 -1
- 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-
|
|
3
|
-
import '../types-
|
|
2
|
+
import { V as VerificationDecision, P as PDLSSContext } from '../types-C_e1IZdU.mjs';
|
|
3
|
+
import '../types-DLai3jly.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-
|
|
3
|
-
import '../types-
|
|
2
|
+
import { V as VerificationDecision, P as PDLSSContext } from '../types-IUzu-A4u.js';
|
|
3
|
+
import '../types-DLai3jly.js';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* Git Trigger — Enterprise git push / PR verification
|
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-
|
|
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-
|
|
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-
|
|
4
|
-
export { e as express } from './express-
|
|
5
|
-
export { n as nextjs } from './nextjs-
|
|
6
|
-
export { i as transport } from './index-
|
|
7
|
-
export { A as AgentClient, C as ChallengeHandler, i as agent, r as recordDecision } from './index-
|
|
1
|
+
import { b as AgentCredentials, G as GatewayConfig, a as AccessLevel, c as VerificationRequest, V as VerificationResult } from './types-DLai3jly.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-DLai3jly.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-Cixo6pTV.mjs';
|
|
4
|
+
export { e as express } from './express-DneHiMhu.mjs';
|
|
5
|
+
export { n as nextjs } from './nextjs-vUuVCaBP.mjs';
|
|
6
|
+
export { i as transport } from './index-C9yWlQ2Y.mjs';
|
|
7
|
+
export { A as AgentClient, C as ChallengeHandler, i as agent, r as recordDecision } from './index-DAGm-Sgf.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-
|
|
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-
|
|
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-
|
|
4
|
-
export { e as express } from './express-
|
|
5
|
-
export { n as nextjs } from './nextjs-
|
|
6
|
-
export { i as transport } from './index-
|
|
7
|
-
export { A as AgentClient, C as ChallengeHandler, i as agent, r as recordDecision } from './index-
|
|
1
|
+
import { b as AgentCredentials, G as GatewayConfig, a as AccessLevel, c as VerificationRequest, V as VerificationResult } from './types-DLai3jly.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-DLai3jly.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-BvWp4q2q.js';
|
|
4
|
+
export { e as express } from './express-DsiaQRFt.js';
|
|
5
|
+
export { n as nextjs } from './nextjs-B4WmoiVm.js';
|
|
6
|
+
export { i as transport } from './index-NZiKvrtE.js';
|
|
7
|
+
export { A as AgentClient, C as ChallengeHandler, i as agent, r as recordDecision } from './index-Dd4alF0l.js';
|
|
8
8
|
import 'express';
|
|
9
9
|
import 'next/server';
|
|
10
10
|
import 'jose';
|
package/dist/index.js
CHANGED
|
@@ -269,8 +269,18 @@ function extractCredentials(headers, query) {
|
|
|
269
269
|
function hasCredentials(credentials) {
|
|
270
270
|
return !!(credentials.astraId || credentials.apiKey || credentials.jwt);
|
|
271
271
|
}
|
|
272
|
-
function createGuidanceResponse(config, reason) {
|
|
273
|
-
const
|
|
272
|
+
function createGuidanceResponse(config, reason, options = {}) {
|
|
273
|
+
const source = options.source ?? "no_credentials";
|
|
274
|
+
const isApiError = source === "api_error";
|
|
275
|
+
const guidance = isApiError ? {
|
|
276
|
+
message: "Verification is temporarily unavailable. Retry with exponential backoff; if the issue persists, contact support with the correlationId.",
|
|
277
|
+
registrationUrl: `${config.apiBaseUrl.replace("/api", "")}/register`,
|
|
278
|
+
documentationUrl: `${config.apiBaseUrl.replace("/api", "")}/docs/agent-access`,
|
|
279
|
+
steps: [
|
|
280
|
+
"Retry the request with exponential backoff",
|
|
281
|
+
"If failures persist, share the correlationId with support"
|
|
282
|
+
]
|
|
283
|
+
} : {
|
|
274
284
|
message: "This service verifies AI agents before granting access. Please register your agent with AstraSync.",
|
|
275
285
|
registrationUrl: `${config.apiBaseUrl.replace("/api", "")}/register`,
|
|
276
286
|
documentationUrl: `${config.apiBaseUrl.replace("/api", "")}/docs/agent-access`,
|
|
@@ -291,6 +301,18 @@ function createGuidanceResponse(config, reason) {
|
|
|
291
301
|
accessLevel: "none",
|
|
292
302
|
guidance,
|
|
293
303
|
denialReasons: reason ? [reason] : ["No valid agent credentials provided"],
|
|
304
|
+
// Round-10 (#47, O5): on API-error fallback, surface a typed failure so
|
|
305
|
+
// partners (and their custom onDenied handlers) can branch on
|
|
306
|
+
// dimension. Without this, the synthesised stub was indistinguishable
|
|
307
|
+
// from a real policy deny.
|
|
308
|
+
failures: isApiError ? [
|
|
309
|
+
{
|
|
310
|
+
dimension: "verify_access.api_error",
|
|
311
|
+
message: reason ?? "Verification temporarily unavailable",
|
|
312
|
+
guidance: guidance.message
|
|
313
|
+
}
|
|
314
|
+
] : void 0,
|
|
315
|
+
correlationId: options.correlationId,
|
|
294
316
|
verifiedAt: /* @__PURE__ */ new Date()
|
|
295
317
|
};
|
|
296
318
|
}
|
|
@@ -365,7 +387,8 @@ async function callVerifyAccessAPI(config, request) {
|
|
|
365
387
|
if (!response.ok) {
|
|
366
388
|
return {
|
|
367
389
|
success: false,
|
|
368
|
-
error: data.message || data.error || `API returned ${response.status}
|
|
390
|
+
error: data.message || data.error || `API returned ${response.status}`,
|
|
391
|
+
correlationId: typeof data?.correlationId === "string" ? data.correlationId : void 0
|
|
369
392
|
};
|
|
370
393
|
}
|
|
371
394
|
return data;
|
|
@@ -409,7 +432,10 @@ async function verify(config, request) {
|
|
|
409
432
|
}
|
|
410
433
|
const apiResponse = await callVerifyAccessAPI(mergedConfig, enrichedRequest);
|
|
411
434
|
if (!apiResponse.success) {
|
|
412
|
-
return createGuidanceResponse(mergedConfig, apiResponse.error
|
|
435
|
+
return createGuidanceResponse(mergedConfig, apiResponse.error, {
|
|
436
|
+
source: "api_error",
|
|
437
|
+
correlationId: apiResponse.correlationId
|
|
438
|
+
});
|
|
413
439
|
}
|
|
414
440
|
if (!apiResponse.access?.allowed) {
|
|
415
441
|
const aggregatedFailures = apiResponse.access?.failures;
|
|
@@ -741,13 +767,17 @@ function findRouteConfig(routes, path, method) {
|
|
|
741
767
|
}
|
|
742
768
|
function defaultOnDenied(result, _req, res) {
|
|
743
769
|
const statusCode = result.verified ? 403 : 401;
|
|
770
|
+
res.setHeader("X-Astra-Gateway-Mode", "enforced");
|
|
744
771
|
res.status(statusCode).json({
|
|
745
772
|
success: false,
|
|
746
773
|
error: {
|
|
747
774
|
code: result.verified ? "INSUFFICIENT_ACCESS" : "UNAUTHORIZED",
|
|
748
775
|
message: result.denialReasons?.[0] || "Access denied",
|
|
749
776
|
accessLevel: result.accessLevel,
|
|
750
|
-
guidance: result.guidance
|
|
777
|
+
guidance: result.guidance,
|
|
778
|
+
// Round-10: aggregated per-dimension detail + correlation handle.
|
|
779
|
+
failures: result.failures,
|
|
780
|
+
correlationId: result.correlationId
|
|
751
781
|
}
|
|
752
782
|
});
|
|
753
783
|
}
|
|
@@ -812,7 +842,7 @@ function createMiddleware(options) {
|
|
|
812
842
|
const routeConfig = findRouteConfig(cachedRoutes, req.path, req.method);
|
|
813
843
|
if (!routeConfig) {
|
|
814
844
|
if (config.setPassThroughHeader) {
|
|
815
|
-
res.setHeader("X-Astra-Gateway-Mode", "
|
|
845
|
+
res.setHeader("X-Astra-Gateway-Mode", "unenforced");
|
|
816
846
|
res.setHeader(
|
|
817
847
|
"X-Astra-Gateway-Reason",
|
|
818
848
|
cachedRoutes.length === 0 ? "no-policy" : "no-match"
|
|
@@ -822,7 +852,7 @@ function createMiddleware(options) {
|
|
|
822
852
|
}
|
|
823
853
|
if (routeConfig.minAccessLevel === "none") {
|
|
824
854
|
if (config.setPassThroughHeader) {
|
|
825
|
-
res.setHeader("X-Astra-Gateway-Mode", "
|
|
855
|
+
res.setHeader("X-Astra-Gateway-Mode", "unenforced");
|
|
826
856
|
res.setHeader("X-Astra-Gateway-Reason", "route-none");
|
|
827
857
|
}
|
|
828
858
|
return next();
|