@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.
- 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 +45 -6
- package/dist/adapters/express.js.map +1 -1
- package/dist/adapters/express.mjs +45 -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 +93 -11
- package/dist/adapters/mcp.js.map +1 -1
- package/dist/adapters/mcp.mjs +93 -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 +27 -5
- package/dist/adapters/nextjs.js.map +1 -1
- package/dist/adapters/nextjs.mjs +27 -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 +27 -5
- package/dist/adapters/sdk.js.map +1 -1
- package/dist/adapters/sdk.mjs +27 -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 +26 -4
- package/dist/browser/background.js.map +1 -1
- package/dist/browser/background.mjs +26 -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 +26 -4
- package/dist/cursor/extension.js.map +1 -1
- package/dist/cursor/extension.mjs +26 -4
- package/dist/cursor/extension.mjs.map +1 -1
- package/dist/{express-BNWqDVIz.d.mts → express-4Vau6x6X.d.mts} +1 -1
- package/dist/{express-BYup_4Jg.d.ts → express-Nq-wWICa.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 +26 -4
- package/dist/gateway/gateway.js.map +1 -1
- package/dist/gateway/gateway.mjs +26 -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-B-EovXnY.d.ts} +1 -1
- package/dist/{index-CSMpOcxV.d.ts → index-CxwCN7AC.d.ts} +1 -1
- package/dist/{index-CK4lNLVn.d.mts → index-DiToN8gh.d.mts} +1 -1
- package/dist/{index-BHXa2WTO.d.mts → index-DkyPV14Y.d.mts} +1 -1
- package/dist/index.d.mts +7 -7
- package/dist/index.d.ts +7 -7
- package/dist/index.js +51 -12
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +51 -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-Bzdfu8Eg.d.mts → nextjs-BTR7Oix-.d.mts} +1 -1
- package/dist/{nextjs-C4h_MpgK.d.ts → nextjs-DO_4crcp.d.ts} +1 -1
- package/dist/{sdk-Tzsn6s-O.d.ts → sdk-DSLCyXIX.d.mts} +9 -2
- package/dist/{sdk-CDdD7EcJ.d.mts → sdk-TnHXD-Oh.d.ts} +9 -2
- package/dist/transport/index.d.mts +2 -2
- package/dist/transport/index.d.ts +2 -2
- package/dist/{types-D_tmbDA_.d.mts → types-BVp22KkN.d.mts} +27 -3
- package/dist/{types-D_tmbDA_.d.ts → types-BVp22KkN.d.ts} +27 -3
- package/dist/{types-Bzp1SMaD.d.ts → types-DVCWReEN.d.ts} +1 -1
- package/dist/{types-z-QVnG4b.d.mts → types-pU2O0BFq.d.mts} +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-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-
|
|
3
|
-
import '../types-
|
|
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
|
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-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-
|
|
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-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
|
-
|
|
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,
|
|
@@ -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({
|
|
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
|
{
|