@astrasyncai/verification-gateway 2.3.8 → 2.3.9
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 +93 -10
- 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 +39 -6
- package/dist/adapters/express.js.map +1 -1
- package/dist/adapters/express.mjs +39 -6
- 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 +53 -11
- package/dist/adapters/mcp.js.map +1 -1
- package/dist/adapters/mcp.mjs +53 -11
- 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 +21 -5
- package/dist/adapters/nextjs.js.map +1 -1
- package/dist/adapters/nextjs.mjs +21 -5
- 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 +21 -5
- package/dist/adapters/sdk.js.map +1 -1
- package/dist/adapters/sdk.mjs +21 -5
- 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/browser/background.js +20 -4
- package/dist/browser/background.js.map +1 -1
- package/dist/browser/background.mjs +20 -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 +20 -4
- package/dist/cursor/extension.js.map +1 -1
- package/dist/cursor/extension.mjs +20 -4
- package/dist/cursor/extension.mjs.map +1 -1
- package/dist/{express-BNWqDVIz.d.mts → express-BiB51d5t.d.mts} +1 -1
- package/dist/{express-BYup_4Jg.d.ts → express-D6tEDU08.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 +20 -4
- package/dist/gateway/gateway.js.map +1 -1
- package/dist/gateway/gateway.mjs +20 -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-DN3ztP2d.d.ts → index-8DFMpITk.d.ts} +1 -1
- package/dist/{index-BHXa2WTO.d.mts → index-B--6fiDp.d.mts} +1 -1
- package/dist/{index-CK4lNLVn.d.mts → index-CAykfMWK.d.mts} +1 -1
- package/dist/{index-CSMpOcxV.d.ts → index-Yt02MRyu.d.ts} +1 -1
- package/dist/index.d.mts +7 -7
- package/dist/index.d.ts +7 -7
- package/dist/index.js +45 -12
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +45 -12
- 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-C4h_MpgK.d.ts → nextjs-CK5F_tVZ.d.ts} +1 -1
- package/dist/{nextjs-Bzdfu8Eg.d.mts → nextjs-CpxqfQqD.d.mts} +1 -1
- package/dist/{sdk-CDdD7EcJ.d.mts → sdk-BMvauMgP.d.ts} +9 -2
- package/dist/{sdk-Tzsn6s-O.d.ts → sdk-yJjO7yzn.d.mts} +9 -2
- package/dist/transport/index.d.mts +2 -2
- package/dist/transport/index.d.ts +2 -2
- package/dist/{types-z-QVnG4b.d.mts → types-CKafuHDn.d.mts} +1 -1
- package/dist/{types-D_tmbDA_.d.mts → types-UYT4GdPW.d.mts} +15 -3
- package/dist/{types-D_tmbDA_.d.ts → types-UYT4GdPW.d.ts} +15 -3
- package/dist/{types-Bzp1SMaD.d.ts → types-ppkhdldJ.d.ts} +1 -1
- package/dist/ui/index.d.mts +1 -1
- package/dist/ui/index.d.ts +1 -1
- package/dist/ui/index.js +3 -3
- package/dist/ui/index.js.map +1 -1
- package/dist/ui/index.mjs +3 -3
- package/dist/ui/index.mjs.map +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-CKafuHDn.mjs';
|
|
3
|
+
import '../types-UYT4GdPW.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-ppkhdldJ.js';
|
|
3
|
+
import '../types-UYT4GdPW.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-UYT4GdPW.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-UYT4GdPW.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-yJjO7yzn.mjs';
|
|
4
|
+
export { e as express } from './express-BiB51d5t.mjs';
|
|
5
|
+
export { n as nextjs } from './nextjs-CpxqfQqD.mjs';
|
|
6
|
+
export { i as transport } from './index-B--6fiDp.mjs';
|
|
7
|
+
export { A as AgentClient, C as ChallengeHandler, i as agent, r as recordDecision } from './index-CAykfMWK.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-UYT4GdPW.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-UYT4GdPW.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-BMvauMgP.js';
|
|
4
|
+
export { e as express } from './express-D6tEDU08.js';
|
|
5
|
+
export { n as nextjs } from './nextjs-CK5F_tVZ.js';
|
|
6
|
+
export { i as transport } from './index-Yt02MRyu.js';
|
|
7
|
+
export { A as AgentClient, C as ChallengeHandler, i as agent, r as recordDecision } from './index-8DFMpITk.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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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 "
|
|
104
|
+
return "restricted";
|
|
105
105
|
}
|
|
106
106
|
function determineAccessLevel(verified, trustScore, isOrgMember, customThresholds) {
|
|
107
107
|
if (!verified) {
|
|
108
|
-
return "
|
|
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 "
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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,
|
|
@@ -490,7 +506,7 @@ async function verify(config, request) {
|
|
|
490
506
|
}
|
|
491
507
|
return result;
|
|
492
508
|
}
|
|
493
|
-
async function recordDecision(config, sessionId, decision, reason) {
|
|
509
|
+
async function recordDecision(config, sessionId, decision, reason, override) {
|
|
494
510
|
const headers = { "Content-Type": "application/json" };
|
|
495
511
|
if (config.apiKey) {
|
|
496
512
|
headers["Authorization"] = `Bearer ${config.apiKey}`;
|
|
@@ -499,7 +515,16 @@ async function recordDecision(config, sessionId, decision, reason) {
|
|
|
499
515
|
await fetch(`${config.apiBaseUrl}/agents/verify-access/${sessionId}/decision`, {
|
|
500
516
|
method: "POST",
|
|
501
517
|
headers,
|
|
502
|
-
body: JSON.stringify({
|
|
518
|
+
body: JSON.stringify({
|
|
519
|
+
decision,
|
|
520
|
+
reason,
|
|
521
|
+
...override && {
|
|
522
|
+
overriddenBy: override.overriddenBy,
|
|
523
|
+
toolName: override.toolName,
|
|
524
|
+
requestedLevel: override.requestedLevel,
|
|
525
|
+
grantedLevel: override.grantedLevel
|
|
526
|
+
}
|
|
527
|
+
})
|
|
503
528
|
}).catch(() => {
|
|
504
529
|
});
|
|
505
530
|
}
|
|
@@ -852,6 +877,14 @@ function createMiddleware(options) {
|
|
|
852
877
|
});
|
|
853
878
|
req.agentVerification = result;
|
|
854
879
|
const sessionId = result.sessionId;
|
|
880
|
+
if (!result.verified) {
|
|
881
|
+
if (shouldRecordDecisions && sessionId) {
|
|
882
|
+
recordDecision(config, sessionId, "denied", result.denialReasons?.[0]).catch(() => {
|
|
883
|
+
});
|
|
884
|
+
}
|
|
885
|
+
onDenied(result, req, res);
|
|
886
|
+
return;
|
|
887
|
+
}
|
|
855
888
|
if (!hasMinimumAccess(result.accessLevel, routeConfig.minAccessLevel)) {
|
|
856
889
|
if (shouldRecordDecisions && sessionId) {
|
|
857
890
|
recordDecision(config, sessionId, "denied", result.denialReasons?.[0]).catch(() => {
|
|
@@ -1236,7 +1269,7 @@ function createMiddleware2(options) {
|
|
|
1236
1269
|
agentCardUrl: request.headers.get("x-astrasync-agent-card") || void 0
|
|
1237
1270
|
}
|
|
1238
1271
|
});
|
|
1239
|
-
if (!hasMinimumAccess(result.accessLevel, routeConfig.minAccessLevel)) {
|
|
1272
|
+
if (!result.verified || !hasMinimumAccess(result.accessLevel, routeConfig.minAccessLevel)) {
|
|
1240
1273
|
if (pathname.startsWith("/api/")) {
|
|
1241
1274
|
return NextResponse.json(
|
|
1242
1275
|
{
|