@astrasyncai/verification-gateway 4.6.0 → 5.0.0
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/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 +6 -33
- package/dist/adapters/express.js.map +1 -1
- package/dist/adapters/express.mjs +6 -33
- package/dist/adapters/express.mjs.map +1 -1
- package/dist/adapters/mcp.d.mts +2 -2
- package/dist/adapters/mcp.d.ts +2 -2
- package/dist/adapters/mcp.js +23 -65
- package/dist/adapters/mcp.js.map +1 -1
- package/dist/adapters/mcp.mjs +22 -64
- 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 +4 -30
- package/dist/adapters/nextjs.js.map +1 -1
- package/dist/adapters/nextjs.mjs +4 -30
- 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 +3 -124
- package/dist/adapters/sdk.js.map +1 -1
- package/dist/adapters/sdk.mjs +3 -122
- 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/agent/index.js +1 -1
- package/dist/agent/index.js.map +1 -1
- package/dist/agent/index.mjs +1 -1
- package/dist/agent/index.mjs.map +1 -1
- package/dist/bin/astrasync-claude-hook.js +4 -29
- package/dist/bin/astrasync-codex-hook.js +4 -29
- package/dist/bin/astrasync-guard.js +4 -29
- package/dist/bin/astrasync.js +9 -34
- package/dist/browser/background.js +4 -29
- package/dist/browser/background.js.map +1 -1
- package/dist/browser/background.mjs +4 -29
- 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/claude-code/claude-code-adapter.d.mts +2 -2
- package/dist/claude-code/claude-code-adapter.d.ts +2 -2
- package/dist/cli/index.d.mts +2 -2
- package/dist/cli/index.d.ts +2 -2
- package/dist/cli/index.js +1 -1
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/index.mjs +1 -1
- package/dist/cli/index.mjs.map +1 -1
- package/dist/codex/index.d.mts +2 -2
- package/dist/codex/index.d.ts +2 -2
- package/dist/codex/index.js +4 -29
- package/dist/codex/index.js.map +1 -1
- package/dist/codex/index.mjs +4 -29
- package/dist/codex/index.mjs.map +1 -1
- 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 +4 -29
- package/dist/cursor/extension.js.map +1 -1
- package/dist/cursor/extension.mjs +4 -29
- package/dist/cursor/extension.mjs.map +1 -1
- package/dist/edge-config.d.mts +1 -1
- package/dist/edge-config.d.ts +1 -1
- package/dist/edge-config.js +1 -1
- package/dist/edge-config.js.map +1 -1
- package/dist/edge-config.mjs +1 -1
- package/dist/edge-config.mjs.map +1 -1
- package/dist/edge-core/index.d.mts +1 -3
- package/dist/edge-core/index.d.ts +1 -3
- package/dist/edge-core/index.js +6 -33
- package/dist/edge-core/index.js.map +1 -1
- package/dist/edge-core/index.mjs +6 -33
- package/dist/edge-core/index.mjs.map +1 -1
- package/dist/{express-D-8Ks2Uo.d.ts → express-B5lWuemA.d.ts} +1 -1
- package/dist/{express-DBtPKXOL.d.mts → express-Dm-snUuY.d.mts} +1 -1
- package/dist/gateway/gateway.d.mts +2 -2
- package/dist/gateway/gateway.d.ts +2 -2
- package/dist/gateway/gateway.js +4 -29
- package/dist/gateway/gateway.js.map +1 -1
- package/dist/gateway/gateway.mjs +4 -29
- 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-kGCGWd5x.d.mts → index-B5k_vUmK.d.mts} +1 -1
- package/dist/{index-CUfmJ1Dq.d.mts → index-BOzM6xUq.d.mts} +1 -1
- package/dist/{index-BND3kQev.d.ts → index-dRfxUdFA.d.ts} +1 -1
- package/dist/{index-DlZORQsb.d.ts → index-y8xToocF.d.ts} +1 -1
- package/dist/index.d.mts +10 -10
- package/dist/index.d.ts +10 -10
- package/dist/index.js +25 -217
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +25 -210
- 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/local-evaluator/evaluator.js.map +1 -1
- package/dist/local-evaluator/evaluator.mjs.map +1 -1
- package/dist/{mcp-ZRN4kY3b.d.mts → mcp-DgsyQiQq.d.mts} +53 -52
- package/dist/{mcp-DToTlwIn.d.ts → mcp-OosmAcKf.d.ts} +53 -52
- package/dist/{nextjs-C0KASOy_.d.mts → nextjs-B1sBdEav.d.mts} +1 -1
- package/dist/{nextjs-lwNvWYWT.d.ts → nextjs-DoRmhV_Z.d.ts} +1 -1
- package/dist/registration/index.js +1 -1
- package/dist/registration/index.js.map +1 -1
- package/dist/registration/index.mjs +1 -1
- package/dist/registration/index.mjs.map +1 -1
- package/dist/sdk-B83N3xKc.d.mts +142 -0
- package/dist/sdk-H_9BTNBS.d.ts +142 -0
- package/dist/transport/index.d.mts +2 -2
- package/dist/transport/index.d.ts +2 -2
- package/dist/transport/index.js +1 -1
- package/dist/transport/index.js.map +1 -1
- package/dist/transport/index.mjs +1 -1
- package/dist/transport/index.mjs.map +1 -1
- package/dist/{types-CGPU7HLi.d.ts → types-BK2POWNc.d.ts} +15 -50
- package/dist/{types-Cx9hTpKI.d.mts → types-CJjZvPr9.d.mts} +15 -50
- package/dist/{types-DhhJxKIC.d.ts → types-CXf3q4kZ.d.ts} +1 -3
- package/dist/{types-CfSJLS4i.d.mts → types-DQmop7ZW.d.mts} +1 -3
- package/dist/ui/index.d.mts +2 -17
- package/dist/ui/index.d.ts +2 -17
- package/dist/ui/index.js +1 -43
- package/dist/ui/index.js.map +1 -1
- package/dist/ui/index.mjs +1 -42
- package/dist/ui/index.mjs.map +1 -1
- package/dist/verify.d.mts +3 -4
- package/dist/verify.d.ts +3 -4
- package/dist/verify.js +3 -28
- package/dist/verify.js.map +1 -1
- package/dist/verify.mjs +3 -28
- package/dist/verify.mjs.map +1 -1
- package/package.json +1 -1
- package/dist/sdk-B4aodEwj.d.ts +0 -215
- package/dist/sdk-B9dSwum7.d.mts +0 -215
|
@@ -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-DQmop7ZW.mjs';
|
|
3
|
+
import '../types-CJjZvPr9.mjs';
|
|
4
4
|
import '../metadata-capture.mjs';
|
|
5
5
|
|
|
6
6
|
/**
|
|
@@ -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-CXf3q4kZ.js';
|
|
3
|
+
import '../types-BK2POWNc.js';
|
|
4
4
|
import '../metadata-capture.js';
|
|
5
5
|
|
|
6
6
|
/**
|
package/dist/index.d.mts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { G as GatewayConfig,
|
|
2
|
-
export { a as
|
|
3
|
-
export {
|
|
1
|
+
import { G as GatewayConfig, r as StepUpApprovalInfo, t as StepUpOutcome, s as StepUpApprovalStatus, E as EnhancedVerificationResult, A as AccessFailure } from './types-CJjZvPr9.mjs';
|
|
2
|
+
export { a as AgentCredentials, b as AstraSyncCredentials, c as AttemptOutcome, d as AttemptReport, C as CallerMetadata, e as CommerceArtifactsPayload, f as CommerceShieldProps, g as ConsiderationItem, h as ConsiderationSet, i as CounterpartyType, j as ExpressMiddlewareOptions, F as FiatSettlementBinding, k as GuidanceInfo, N as NextJsMiddlewareOptions, P as PDLSSInfo, l as ProtocolTransport, R as RouteAccessConfig, m as RuntimeChallengeResult, S as SDKOptions, n as SettlementArtifact, o as SettlementArtifactBinding, p as SettlementArtifactBindingBase, q as StablecoinSettlementBinding, T as TokenGuidance, u as TrustLevel, V as VerificationInterstitialProps, v as VerificationRequest, w as VerificationResult, x as VerifiedAgent, y as VerifiedDeveloper, z as VerifiedOrganization } from './types-CJjZvPr9.mjs';
|
|
3
|
+
export { T as TRUST_LEVEL_RANGES, g as getTrustLevel, s as sdk } from './sdk-B83N3xKc.mjs';
|
|
4
4
|
export { VerifyOptions, clearCache, extractCredentials, fetchRoutes, hasCredentials, quickVerify, reportAttempt, reportUnregisteredAttempt, verify } from './verify.mjs';
|
|
5
|
-
export { e as express } from './express-
|
|
6
|
-
export { n as nextjs } from './nextjs-
|
|
7
|
-
export { aR as extractMcpCredentials, bg as setMcpMeta, b1 as transport } from './index-
|
|
8
|
-
export { M as MCP_VERIFIED_HOP_HEADER, a as MCP_VERIFIED_HOP_MAX_AGE_MS, b as McpMiddlewareOptions, T as ToolGateConfig, V as VerifiedHopMarker,
|
|
5
|
+
export { e as express } from './express-Dm-snUuY.mjs';
|
|
6
|
+
export { n as nextjs } from './nextjs-B1sBdEav.mjs';
|
|
7
|
+
export { aR as extractMcpCredentials, bg as setMcpMeta, b1 as transport } from './index-B5k_vUmK.mjs';
|
|
8
|
+
export { M as MCP_VERIFIED_HOP_HEADER, a as MCP_VERIFIED_HOP_MAX_AGE_MS, b as McpMiddlewareOptions, T as ToolGate, c as ToolGateConfig, V as VerifiedHopMarker, d as createMcpMiddleware, i as isVerifiedHopValidFor, f as parseVerifiedHop, s as serializeVerifiedHop } from './mcp-DgsyQiQq.mjs';
|
|
9
9
|
export { AgentProtocol, AgentRecord, AstraSync, AstraSyncConfig, AstraSyncError, AuthenticationError, BuildGuidanceParams, FrameworkConfig, GuidanceEnvelope, HealthResponse, KYDRequiredError, ModelConfig, PDLSSConfig, PDLSSDuration, PDLSSLimits, PDLSSPurpose, PDLSSScope, PDLSSSelfInstantiation, PendingRegistrationResponse, PollRegistrationResult, RegisterOptions, RegisterResult, RegistrationDeniedError, RegistrationExpiredError, RegistrationResponse, RegistrationTimeoutError, VerifyResponse, WaitForApprovalOptions, buildGuidance } from './registration/index.mjs';
|
|
10
|
-
export { A as AgentClient, C as ChallengeHandler, i as agent, r as recordDecision } from './index-
|
|
10
|
+
export { A as AgentClient, C as ChallengeHandler, i as agent, r as recordDecision } from './index-BOzM6xUq.mjs';
|
|
11
11
|
export { DEFAULT_EDGE_CONFIG, EdgeConfig, EdgeMode, EdgePathRule, EdgeVerificationDepth, FetchEdgeConfigResult, FetchEdgeConfigSuccess, _resetEdgeConfigCache, degradeToObserve, fetchEdgeConfig, getEdgeConfig, isEdgeConfig, matchEdgePathRule } from './edge-config.mjs';
|
|
12
12
|
export { DynamicPlatformFingerprint, PLATFORM_AGENT_SIGNATURES, PlatformAgentVendor, PlatformDetectionInput, PlatformFingerprint, PlatformSignatureDef, detectPlatformFingerprint, matchPlatformSignature } from './platform-signatures.mjs';
|
|
13
13
|
export { CAPTURE_SCHEMA_VERSION, MAX_HEADERS, MAX_HEADER_VALUE_BYTES, MAX_TOTAL_BYTES, ObservedMetadata, SanitizeHeadersResult, buildSdkObservedMetadata, deriveConnectionFromHeaders, extractApiKeyFormat, extractPlatformHeaders, sanitizeHeaders } from './metadata-capture.mjs';
|
|
@@ -173,7 +173,7 @@ declare function detectRuntime(userAgent: string | undefined | null): string | u
|
|
|
173
173
|
* silently (never throwing), so this is a no-op there — which is correct:
|
|
174
174
|
* in a browser the page's real UA is the honest identity.
|
|
175
175
|
*/
|
|
176
|
-
declare const SDK_USER_AGENT = "astrasync-sdk/
|
|
176
|
+
declare const SDK_USER_AGENT = "astrasync-sdk/5.0.0";
|
|
177
177
|
declare const sdkFetch: typeof fetch;
|
|
178
178
|
|
|
179
179
|
/**
|
|
@@ -194,6 +194,6 @@ declare const sdkFetch: typeof fetch;
|
|
|
194
194
|
* is fine — bumping both in the release-ceremony commit keeps them
|
|
195
195
|
* lockstep.
|
|
196
196
|
*/
|
|
197
|
-
declare const SDK_VERSION = "
|
|
197
|
+
declare const SDK_VERSION = "5.0.0";
|
|
198
198
|
|
|
199
199
|
export { EnhancedVerificationResult, GatewayConfig, RUNTIME_SIGNATURES, type RuntimeSignature, SDK_USER_AGENT, type SettlementDecision, type SettlementRequest, StepUpApprovalInfo, StepUpApprovalStatus, StepUpOutcome, SDK_VERSION as VERSION, type WellKnownAgenticCommerce, authorizeSettlement, awaitStepUpApproval, detectRuntime, getCachedWellKnownUrls, getWellKnownUrls, pollStepUpStatus, prefetchWellKnown, sdkFetch };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { G as GatewayConfig,
|
|
2
|
-
export { a as
|
|
3
|
-
export {
|
|
1
|
+
import { G as GatewayConfig, r as StepUpApprovalInfo, t as StepUpOutcome, s as StepUpApprovalStatus, E as EnhancedVerificationResult, A as AccessFailure } from './types-BK2POWNc.js';
|
|
2
|
+
export { a as AgentCredentials, b as AstraSyncCredentials, c as AttemptOutcome, d as AttemptReport, C as CallerMetadata, e as CommerceArtifactsPayload, f as CommerceShieldProps, g as ConsiderationItem, h as ConsiderationSet, i as CounterpartyType, j as ExpressMiddlewareOptions, F as FiatSettlementBinding, k as GuidanceInfo, N as NextJsMiddlewareOptions, P as PDLSSInfo, l as ProtocolTransport, R as RouteAccessConfig, m as RuntimeChallengeResult, S as SDKOptions, n as SettlementArtifact, o as SettlementArtifactBinding, p as SettlementArtifactBindingBase, q as StablecoinSettlementBinding, T as TokenGuidance, u as TrustLevel, V as VerificationInterstitialProps, v as VerificationRequest, w as VerificationResult, x as VerifiedAgent, y as VerifiedDeveloper, z as VerifiedOrganization } from './types-BK2POWNc.js';
|
|
3
|
+
export { T as TRUST_LEVEL_RANGES, g as getTrustLevel, s as sdk } from './sdk-H_9BTNBS.js';
|
|
4
4
|
export { VerifyOptions, clearCache, extractCredentials, fetchRoutes, hasCredentials, quickVerify, reportAttempt, reportUnregisteredAttempt, verify } from './verify.js';
|
|
5
|
-
export { e as express } from './express-
|
|
6
|
-
export { n as nextjs } from './nextjs-
|
|
7
|
-
export { aR as extractMcpCredentials, bg as setMcpMeta, b1 as transport } from './index-
|
|
8
|
-
export { M as MCP_VERIFIED_HOP_HEADER, a as MCP_VERIFIED_HOP_MAX_AGE_MS, b as McpMiddlewareOptions, T as ToolGateConfig, V as VerifiedHopMarker,
|
|
5
|
+
export { e as express } from './express-B5lWuemA.js';
|
|
6
|
+
export { n as nextjs } from './nextjs-DoRmhV_Z.js';
|
|
7
|
+
export { aR as extractMcpCredentials, bg as setMcpMeta, b1 as transport } from './index-y8xToocF.js';
|
|
8
|
+
export { M as MCP_VERIFIED_HOP_HEADER, a as MCP_VERIFIED_HOP_MAX_AGE_MS, b as McpMiddlewareOptions, T as ToolGate, c as ToolGateConfig, V as VerifiedHopMarker, d as createMcpMiddleware, i as isVerifiedHopValidFor, f as parseVerifiedHop, s as serializeVerifiedHop } from './mcp-OosmAcKf.js';
|
|
9
9
|
export { AgentProtocol, AgentRecord, AstraSync, AstraSyncConfig, AstraSyncError, AuthenticationError, BuildGuidanceParams, FrameworkConfig, GuidanceEnvelope, HealthResponse, KYDRequiredError, ModelConfig, PDLSSConfig, PDLSSDuration, PDLSSLimits, PDLSSPurpose, PDLSSScope, PDLSSSelfInstantiation, PendingRegistrationResponse, PollRegistrationResult, RegisterOptions, RegisterResult, RegistrationDeniedError, RegistrationExpiredError, RegistrationResponse, RegistrationTimeoutError, VerifyResponse, WaitForApprovalOptions, buildGuidance } from './registration/index.js';
|
|
10
|
-
export { A as AgentClient, C as ChallengeHandler, i as agent, r as recordDecision } from './index-
|
|
10
|
+
export { A as AgentClient, C as ChallengeHandler, i as agent, r as recordDecision } from './index-dRfxUdFA.js';
|
|
11
11
|
export { DEFAULT_EDGE_CONFIG, EdgeConfig, EdgeMode, EdgePathRule, EdgeVerificationDepth, FetchEdgeConfigResult, FetchEdgeConfigSuccess, _resetEdgeConfigCache, degradeToObserve, fetchEdgeConfig, getEdgeConfig, isEdgeConfig, matchEdgePathRule } from './edge-config.js';
|
|
12
12
|
export { DynamicPlatformFingerprint, PLATFORM_AGENT_SIGNATURES, PlatformAgentVendor, PlatformDetectionInput, PlatformFingerprint, PlatformSignatureDef, detectPlatformFingerprint, matchPlatformSignature } from './platform-signatures.js';
|
|
13
13
|
export { CAPTURE_SCHEMA_VERSION, MAX_HEADERS, MAX_HEADER_VALUE_BYTES, MAX_TOTAL_BYTES, ObservedMetadata, SanitizeHeadersResult, buildSdkObservedMetadata, deriveConnectionFromHeaders, extractApiKeyFormat, extractPlatformHeaders, sanitizeHeaders } from './metadata-capture.js';
|
|
@@ -173,7 +173,7 @@ declare function detectRuntime(userAgent: string | undefined | null): string | u
|
|
|
173
173
|
* silently (never throwing), so this is a no-op there — which is correct:
|
|
174
174
|
* in a browser the page's real UA is the honest identity.
|
|
175
175
|
*/
|
|
176
|
-
declare const SDK_USER_AGENT = "astrasync-sdk/
|
|
176
|
+
declare const SDK_USER_AGENT = "astrasync-sdk/5.0.0";
|
|
177
177
|
declare const sdkFetch: typeof fetch;
|
|
178
178
|
|
|
179
179
|
/**
|
|
@@ -194,6 +194,6 @@ declare const sdkFetch: typeof fetch;
|
|
|
194
194
|
* is fine — bumping both in the release-ceremony commit keeps them
|
|
195
195
|
* lockstep.
|
|
196
196
|
*/
|
|
197
|
-
declare const SDK_VERSION = "
|
|
197
|
+
declare const SDK_VERSION = "5.0.0";
|
|
198
198
|
|
|
199
199
|
export { EnhancedVerificationResult, GatewayConfig, RUNTIME_SIGNATURES, type RuntimeSignature, SDK_USER_AGENT, type SettlementDecision, type SettlementRequest, StepUpApprovalInfo, StepUpApprovalStatus, StepUpOutcome, SDK_VERSION as VERSION, type WellKnownAgenticCommerce, authorizeSettlement, awaitStepUpApproval, detectRuntime, getCachedWellKnownUrls, getWellKnownUrls, pollStepUpStatus, prefetchWellKnown, sdkFetch };
|
package/dist/index.js
CHANGED
|
@@ -30,8 +30,6 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
30
30
|
// src/index.ts
|
|
31
31
|
var src_exports = {};
|
|
32
32
|
__export(src_exports, {
|
|
33
|
-
ACCESS_LEVEL_DESCRIPTIONS: () => ACCESS_LEVEL_DESCRIPTIONS,
|
|
34
|
-
ACCESS_LEVEL_HIERARCHY: () => ACCESS_LEVEL_HIERARCHY,
|
|
35
33
|
AgentClient: () => AgentClient,
|
|
36
34
|
AstraSync: () => AstraSync,
|
|
37
35
|
AstraSyncError: () => AstraSyncError,
|
|
@@ -39,7 +37,6 @@ __export(src_exports, {
|
|
|
39
37
|
CAPTURE_SCHEMA_VERSION: () => CAPTURE_SCHEMA_VERSION,
|
|
40
38
|
ChallengeHandler: () => ChallengeHandler,
|
|
41
39
|
DEFAULT_EDGE_CONFIG: () => DEFAULT_EDGE_CONFIG,
|
|
42
|
-
DEFAULT_TRUST_THRESHOLDS: () => DEFAULT_TRUST_THRESHOLDS,
|
|
43
40
|
KYDRequiredError: () => KYDRequiredError,
|
|
44
41
|
MAX_HEADERS: () => MAX_HEADERS,
|
|
45
42
|
MAX_HEADER_VALUE_BYTES: () => MAX_HEADER_VALUE_BYTES,
|
|
@@ -66,7 +63,6 @@ __export(src_exports, {
|
|
|
66
63
|
deriveConnectionFromHeaders: () => deriveConnectionFromHeaders,
|
|
67
64
|
detectPlatformFingerprint: () => detectPlatformFingerprint,
|
|
68
65
|
detectRuntime: () => detectRuntime,
|
|
69
|
-
determineAccessLevel: () => determineAccessLevel,
|
|
70
66
|
express: () => express_exports,
|
|
71
67
|
extractApiKeyFormat: () => extractApiKeyFormat,
|
|
72
68
|
extractCredentials: () => extractCredentials,
|
|
@@ -74,14 +70,11 @@ __export(src_exports, {
|
|
|
74
70
|
extractPlatformHeaders: () => extractPlatformHeaders,
|
|
75
71
|
fetchEdgeConfig: () => fetchEdgeConfig,
|
|
76
72
|
fetchRoutes: () => fetchRoutes,
|
|
77
|
-
getAccessLevelForScore: () => getAccessLevelForScore,
|
|
78
73
|
getCachedWellKnownUrls: () => getCachedWellKnownUrls,
|
|
79
|
-
getCapabilities: () => getCapabilities,
|
|
80
74
|
getEdgeConfig: () => getEdgeConfig,
|
|
81
75
|
getTrustLevel: () => getTrustLevel,
|
|
82
76
|
getWellKnownUrls: () => getWellKnownUrls,
|
|
83
77
|
hasCredentials: () => hasCredentials,
|
|
84
|
-
hasMinimumAccess: () => hasMinimumAccess,
|
|
85
78
|
isEdgeConfig: () => isEdgeConfig,
|
|
86
79
|
isVerifiedHopValidFor: () => isVerifiedHopValidFor,
|
|
87
80
|
matchEdgePathRule: () => matchEdgePathRule,
|
|
@@ -104,32 +97,7 @@ __export(src_exports, {
|
|
|
104
97
|
});
|
|
105
98
|
module.exports = __toCommonJS(src_exports);
|
|
106
99
|
|
|
107
|
-
// src/
|
|
108
|
-
var ACCESS_LEVEL_HIERARCHY = {
|
|
109
|
-
none: 0,
|
|
110
|
-
restricted: 1,
|
|
111
|
-
"read-only": 2,
|
|
112
|
-
standard: 3,
|
|
113
|
-
full: 4,
|
|
114
|
-
internal: 5
|
|
115
|
-
};
|
|
116
|
-
var ACCESS_LEVEL_DESCRIPTIONS = {
|
|
117
|
-
none: "No access - credentials required",
|
|
118
|
-
restricted: "Restricted access - registration prompt only",
|
|
119
|
-
"read-only": "Read-only access - can browse but not modify",
|
|
120
|
-
standard: "Standard access - normal operations per PDLSS policy",
|
|
121
|
-
full: "Full access - all operations for high-trust agents",
|
|
122
|
-
internal: "Internal access - organization member privileges"
|
|
123
|
-
};
|
|
124
|
-
var DEFAULT_TRUST_THRESHOLDS = {
|
|
125
|
-
none: 0,
|
|
126
|
-
restricted: 0,
|
|
127
|
-
"read-only": 20,
|
|
128
|
-
standard: 40,
|
|
129
|
-
full: 70,
|
|
130
|
-
internal: 0
|
|
131
|
-
// Internal is based on org membership, not score
|
|
132
|
-
};
|
|
100
|
+
// src/trust-levels.ts
|
|
133
101
|
var TRUST_LEVEL_RANGES = {
|
|
134
102
|
BRONZE: { min: 0, max: 39 },
|
|
135
103
|
SILVER: { min: 40, max: 59 },
|
|
@@ -142,91 +110,9 @@ function getTrustLevel(score) {
|
|
|
142
110
|
if (score >= 40) return "SILVER";
|
|
143
111
|
return "BRONZE";
|
|
144
112
|
}
|
|
145
|
-
function hasMinimumAccess(actual, required) {
|
|
146
|
-
return ACCESS_LEVEL_HIERARCHY[actual] >= ACCESS_LEVEL_HIERARCHY[required];
|
|
147
|
-
}
|
|
148
|
-
function getAccessLevelForScore(trustScore, thresholds = DEFAULT_TRUST_THRESHOLDS) {
|
|
149
|
-
if (trustScore >= thresholds.full) return "full";
|
|
150
|
-
if (trustScore >= thresholds.standard) return "standard";
|
|
151
|
-
if (trustScore >= thresholds["read-only"]) return "read-only";
|
|
152
|
-
return "restricted";
|
|
153
|
-
}
|
|
154
|
-
function determineAccessLevel(verified, trustScore, isOrgMember, customThresholds) {
|
|
155
|
-
if (!verified) {
|
|
156
|
-
return "none";
|
|
157
|
-
}
|
|
158
|
-
if (isOrgMember) {
|
|
159
|
-
return "internal";
|
|
160
|
-
}
|
|
161
|
-
const thresholds = {
|
|
162
|
-
...DEFAULT_TRUST_THRESHOLDS,
|
|
163
|
-
...customThresholds
|
|
164
|
-
};
|
|
165
|
-
return getAccessLevelForScore(trustScore, thresholds);
|
|
166
|
-
}
|
|
167
|
-
function getCapabilities(accessLevel) {
|
|
168
|
-
switch (accessLevel) {
|
|
169
|
-
case "none":
|
|
170
|
-
return {
|
|
171
|
-
canRead: false,
|
|
172
|
-
canWrite: false,
|
|
173
|
-
canDelete: false,
|
|
174
|
-
canAdmin: false,
|
|
175
|
-
canAccessInternal: false
|
|
176
|
-
};
|
|
177
|
-
case "restricted":
|
|
178
|
-
return {
|
|
179
|
-
canRead: false,
|
|
180
|
-
canWrite: false,
|
|
181
|
-
canDelete: false,
|
|
182
|
-
canAdmin: false,
|
|
183
|
-
canAccessInternal: false
|
|
184
|
-
};
|
|
185
|
-
case "read-only":
|
|
186
|
-
return {
|
|
187
|
-
canRead: true,
|
|
188
|
-
canWrite: false,
|
|
189
|
-
canDelete: false,
|
|
190
|
-
canAdmin: false,
|
|
191
|
-
canAccessInternal: false
|
|
192
|
-
};
|
|
193
|
-
case "standard":
|
|
194
|
-
return {
|
|
195
|
-
canRead: true,
|
|
196
|
-
canWrite: true,
|
|
197
|
-
canDelete: false,
|
|
198
|
-
canAdmin: false,
|
|
199
|
-
canAccessInternal: false
|
|
200
|
-
};
|
|
201
|
-
case "full":
|
|
202
|
-
return {
|
|
203
|
-
canRead: true,
|
|
204
|
-
canWrite: true,
|
|
205
|
-
canDelete: true,
|
|
206
|
-
canAdmin: false,
|
|
207
|
-
canAccessInternal: false
|
|
208
|
-
};
|
|
209
|
-
case "internal":
|
|
210
|
-
return {
|
|
211
|
-
canRead: true,
|
|
212
|
-
canWrite: true,
|
|
213
|
-
canDelete: true,
|
|
214
|
-
canAdmin: true,
|
|
215
|
-
canAccessInternal: true
|
|
216
|
-
};
|
|
217
|
-
default:
|
|
218
|
-
return {
|
|
219
|
-
canRead: false,
|
|
220
|
-
canWrite: false,
|
|
221
|
-
canDelete: false,
|
|
222
|
-
canAdmin: false,
|
|
223
|
-
canAccessInternal: false
|
|
224
|
-
};
|
|
225
|
-
}
|
|
226
|
-
}
|
|
227
113
|
|
|
228
114
|
// src/version.ts
|
|
229
|
-
var SDK_VERSION = "
|
|
115
|
+
var SDK_VERSION = "5.0.0";
|
|
230
116
|
|
|
231
117
|
// src/http.ts
|
|
232
118
|
var SDK_USER_AGENT = `astrasync-sdk/${SDK_VERSION}`;
|
|
@@ -308,11 +194,6 @@ function getCachedWellKnownUrls(apiBaseUrl) {
|
|
|
308
194
|
// src/verify.ts
|
|
309
195
|
var DEFAULT_CONFIG = {
|
|
310
196
|
apiBaseUrl: "https://astrasync.ai/api",
|
|
311
|
-
// v2.3.9 (defect #30): default for unconfigured callers is `'none'` (no
|
|
312
|
-
// access). Pre-rename this defaulted to `'guidance'`, which combined with
|
|
313
|
-
// a route gated at `'guidance'` to silently let unverified traffic
|
|
314
|
-
// through (`hasMinimumAccess('guidance', 'guidance') === true`).
|
|
315
|
-
defaultAccessLevel: "none",
|
|
316
197
|
// minTrustScore + minTrustScoreForFull deprecated in v2.3.0 — server decides.
|
|
317
198
|
// cacheTtl deliberately unset. When undefined, cacheResult applies the 60s
|
|
318
199
|
// default; the caller's explicit value is honoured for cacheable results.
|
|
@@ -513,13 +394,6 @@ function createGuidanceResponse(_config, reason, options = {}) {
|
|
|
513
394
|
// policy is not evaluated (we never reached the gate).
|
|
514
395
|
identityVerified: false,
|
|
515
396
|
policyAllowed: false,
|
|
516
|
-
// v2.3.9 (defect #30): denials grant `'none'`, NEVER a positive band.
|
|
517
|
-
// Adapters additionally short-circuit on `!identityVerified ||
|
|
518
|
-
// !policyAllowed` before the gate check, but the access level still has
|
|
519
|
-
// to be honest at the data layer so downstream consumers (SDK adapters
|
|
520
|
-
// in other languages, custom integrations) inherit the correct
|
|
521
|
-
// semantics.
|
|
522
|
-
accessLevel: "none",
|
|
523
397
|
guidance,
|
|
524
398
|
denialReasons: reason ? [reason] : ["No valid agent credentials provided"],
|
|
525
399
|
// Round-10 (#47, O5): on API-error fallback, surface a typed failure so
|
|
@@ -613,7 +487,6 @@ async function callVerifyAccessAPI(config, request) {
|
|
|
613
487
|
attemptId: typeof data?.attemptId === "string" ? data.attemptId : void 0,
|
|
614
488
|
access: {
|
|
615
489
|
allowed: false,
|
|
616
|
-
accessLevel: "none",
|
|
617
490
|
reason: "endpoint_deactivated",
|
|
618
491
|
failures: [
|
|
619
492
|
{
|
|
@@ -676,7 +549,7 @@ async function verify(config, request, options) {
|
|
|
676
549
|
if (!deprecationWarningShown && (config.minTrustScore !== void 0 || config.minTrustScoreForFull !== void 0)) {
|
|
677
550
|
deprecationWarningShown = true;
|
|
678
551
|
console.warn(
|
|
679
|
-
"[VerificationGateway] minTrustScore / minTrustScoreForFull are deprecated in v2.3.0 and have no effect. Server is now the single source of truth for access
|
|
552
|
+
"[VerificationGateway] minTrustScore / minTrustScoreForFull are deprecated in v2.3.0 and have no effect. Server is now the single source of truth for access decisions (verified ID + runtime challenge + PDLSS + trust score). To gate access to an endpoint, configure the endpoint's trust_score_requirement server-side."
|
|
680
553
|
);
|
|
681
554
|
}
|
|
682
555
|
if (mergedConfig.cacheTtl !== 0 && !options?.bypassCache) {
|
|
@@ -722,14 +595,6 @@ async function verify(config, request, options) {
|
|
|
722
595
|
const result2 = {
|
|
723
596
|
identityVerified: idVerifiedFromBackend,
|
|
724
597
|
policyAllowed: false,
|
|
725
|
-
// v2.3.9 (defect #30): denials grant `'none'`, NEVER a positive band.
|
|
726
|
-
// Pre-rename this hardcoded `'guidance'`, which conflated with the
|
|
727
|
-
// colocated `guidance: {...}` help-payload object below and let
|
|
728
|
-
// denied requests pass any route gated at `'guidance'` because
|
|
729
|
-
// `hasMinimumAccess('guidance', 'guidance') === true`. Adapters now
|
|
730
|
-
// ALSO short-circuit on `!identityVerified || !policyAllowed` before
|
|
731
|
-
// the gate check — belt-and-braces.
|
|
732
|
-
accessLevel: "none",
|
|
733
598
|
// 3.6.0: the server now emits top-level denialReasons on every deny
|
|
734
599
|
// path — prefer it verbatim; the failure-message reconstruction remains
|
|
735
600
|
// as the fallback for older backends.
|
|
@@ -778,7 +643,6 @@ async function verify(config, request, options) {
|
|
|
778
643
|
trustScore: apiResponse.organization.trustScore
|
|
779
644
|
} : void 0;
|
|
780
645
|
const verificationContext = apiResponse.verificationContext;
|
|
781
|
-
const accessLevel = apiResponse.access?.accessLevel ?? "standard";
|
|
782
646
|
const result = {
|
|
783
647
|
// 4.5.0 (probe F1): read idVerified from verificationContext with the
|
|
784
648
|
// SAME absent⇒false default as the deny branch. The previous `!== false`
|
|
@@ -790,7 +654,6 @@ async function verify(config, request, options) {
|
|
|
790
654
|
// this load-bearing must never be defaulted on.
|
|
791
655
|
identityVerified: apiResponse.verificationContext?.idVerified === true,
|
|
792
656
|
policyAllowed: true,
|
|
793
|
-
accessLevel,
|
|
794
657
|
agent,
|
|
795
658
|
developer,
|
|
796
659
|
organization,
|
|
@@ -817,7 +680,6 @@ async function verify(config, request, options) {
|
|
|
817
680
|
};
|
|
818
681
|
if (result.recommendation === "deny") {
|
|
819
682
|
result.policyAllowed = false;
|
|
820
|
-
result.accessLevel = "none";
|
|
821
683
|
result.denialReasons = serverDenialReasons ?? result.recommendationReasons ?? ["Access denied by AstraSync recommendation"];
|
|
822
684
|
result.guidance = result.runtimeChallenge ? {
|
|
823
685
|
message: `Verification failed: ${result.runtimeChallenge.reason || "runtime challenge failed"}`,
|
|
@@ -920,7 +782,6 @@ async function quickVerify(config, credentials) {
|
|
|
920
782
|
return {
|
|
921
783
|
identityVerified: result.identityVerified,
|
|
922
784
|
policyAllowed: result.policyAllowed,
|
|
923
|
-
accessLevel: result.accessLevel,
|
|
924
785
|
reason: result.denialReasons?.[0]
|
|
925
786
|
};
|
|
926
787
|
}
|
|
@@ -1950,7 +1811,6 @@ function defaultOnDenied(result, _req, res) {
|
|
|
1950
1811
|
error: {
|
|
1951
1812
|
code: !result.identityVerified ? "UNAUTHORIZED" : "INSUFFICIENT_ACCESS",
|
|
1952
1813
|
message: result.denialReasons?.[0] || "Access denied",
|
|
1953
|
-
accessLevel: result.accessLevel,
|
|
1954
1814
|
guidance: result.guidance,
|
|
1955
1815
|
// Round-10: aggregated per-dimension detail + correlation handle.
|
|
1956
1816
|
failures: result.failures,
|
|
@@ -2066,11 +1926,11 @@ function createMiddleware(options) {
|
|
|
2066
1926
|
}
|
|
2067
1927
|
const wellKnownUrls = config.apiBaseUrl ? await getWellKnownUrls(config.apiBaseUrl).catch(() => void 0) : void 0;
|
|
2068
1928
|
const credentials = customExtractCredentials ? customExtractCredentials(req) : defaultExtractCredentials(req);
|
|
2069
|
-
const shouldEnforce = routeConfig.
|
|
2070
|
-
if (routeConfig.
|
|
1929
|
+
const shouldEnforce = !routeConfig.observe;
|
|
1930
|
+
if (routeConfig.observe && (!config.evaluateAlwaysIfCredentialed || !credentials.astraId)) {
|
|
2071
1931
|
if (config.setPassThroughHeader) {
|
|
2072
1932
|
res.setHeader("X-Astra-Gateway-Mode", "unenforced");
|
|
2073
|
-
res.setHeader("X-Astra-Gateway-Reason", "route-
|
|
1933
|
+
res.setHeader("X-Astra-Gateway-Reason", "route-observe");
|
|
2074
1934
|
}
|
|
2075
1935
|
beaconPassThrough?.(req);
|
|
2076
1936
|
return next();
|
|
@@ -2107,7 +1967,6 @@ function createMiddleware(options) {
|
|
|
2107
1967
|
const result2 = {
|
|
2108
1968
|
identityVerified: false,
|
|
2109
1969
|
policyAllowed: false,
|
|
2110
|
-
accessLevel: "none",
|
|
2111
1970
|
denialReasons: preCheckFailures.map((f) => f.message),
|
|
2112
1971
|
guidance: {
|
|
2113
1972
|
message: "Request exceeds counterparty-defined PDLSS limits.",
|
|
@@ -2270,7 +2129,6 @@ function createMiddleware(options) {
|
|
|
2270
2129
|
const result = {
|
|
2271
2130
|
identityVerified: false,
|
|
2272
2131
|
policyAllowed: false,
|
|
2273
|
-
accessLevel: "none",
|
|
2274
2132
|
denialReasons: [`Verification middleware internal error: ${errorClass}`],
|
|
2275
2133
|
failures: [
|
|
2276
2134
|
{
|
|
@@ -2599,7 +2457,7 @@ function createMiddleware2(options) {
|
|
|
2599
2457
|
beaconPassThrough?.(request, pathname);
|
|
2600
2458
|
return NextResponse.next();
|
|
2601
2459
|
}
|
|
2602
|
-
if (routeConfig.
|
|
2460
|
+
if (routeConfig.observe) {
|
|
2603
2461
|
beaconPassThrough?.(request, pathname);
|
|
2604
2462
|
return NextResponse.next();
|
|
2605
2463
|
}
|
|
@@ -2629,7 +2487,6 @@ function createMiddleware2(options) {
|
|
|
2629
2487
|
const preCheckResult = {
|
|
2630
2488
|
identityVerified: false,
|
|
2631
2489
|
policyAllowed: false,
|
|
2632
|
-
accessLevel: "none",
|
|
2633
2490
|
denialReasons: preCheckFailures.map((f) => f.message),
|
|
2634
2491
|
guidance: {
|
|
2635
2492
|
message: "Request exceeds counterparty-defined PDLSS limits.",
|
|
@@ -2767,7 +2624,6 @@ function createMiddleware2(options) {
|
|
|
2767
2624
|
}
|
|
2768
2625
|
response.headers.set("X-AstraSync-Identity-Verified", result.identityVerified.toString());
|
|
2769
2626
|
response.headers.set("X-AstraSync-Policy-Allowed", result.policyAllowed.toString());
|
|
2770
|
-
response.headers.set("X-AstraSync-Access-Level", result.accessLevel);
|
|
2771
2627
|
if (result.agent) {
|
|
2772
2628
|
response.headers.set("X-AstraSync-Agent-Id", result.agent.astraId);
|
|
2773
2629
|
}
|
|
@@ -2783,9 +2639,7 @@ var sdk_exports = {};
|
|
|
2783
2639
|
__export(sdk_exports, {
|
|
2784
2640
|
VerificationGatewayClient: () => VerificationGatewayClient,
|
|
2785
2641
|
createClient: () => createClient,
|
|
2786
|
-
getCapabilities: () => getCapabilities,
|
|
2787
2642
|
getTrustLevel: () => getTrustLevel,
|
|
2788
|
-
hasMinimumAccess: () => hasMinimumAccess,
|
|
2789
2643
|
verifyOnce: () => verifyOnce
|
|
2790
2644
|
});
|
|
2791
2645
|
var VerificationGatewayClient = class {
|
|
@@ -2793,7 +2647,6 @@ var VerificationGatewayClient = class {
|
|
|
2793
2647
|
this.config = {
|
|
2794
2648
|
apiBaseUrl: options.apiBaseUrl,
|
|
2795
2649
|
apiKey: options.apiKey,
|
|
2796
|
-
defaultAccessLevel: options.defaultAccessLevel,
|
|
2797
2650
|
minTrustScore: options.minTrustScore,
|
|
2798
2651
|
minTrustScoreForFull: options.minTrustScoreForFull,
|
|
2799
2652
|
cacheTtl: options.cacheTtl,
|
|
@@ -2842,26 +2695,6 @@ var VerificationGatewayClient = class {
|
|
|
2842
2695
|
async quickVerify(credentials) {
|
|
2843
2696
|
return this.executeWithRetry(() => quickVerify(this.config, credentials));
|
|
2844
2697
|
}
|
|
2845
|
-
/**
|
|
2846
|
-
* Check if an agent has a specific access level.
|
|
2847
|
-
*
|
|
2848
|
-
* @deprecated 3.2.0 — the access-level band is informational only; it no
|
|
2849
|
-
* longer gates in the middleware adapters (post-3.1.0 feedback #1). This
|
|
2850
|
-
* explicit opt-in query still works, but prefer gating on the server-side
|
|
2851
|
-
* policy decision (identity + policy + trust) or per-route `minTrustScore`.
|
|
2852
|
-
* Explicit per-route condition→constraint rules are the Phase-2 successor.
|
|
2853
|
-
*/
|
|
2854
|
-
async hasAccess(credentials, requiredLevel) {
|
|
2855
|
-
const result = await this.quickVerify(credentials);
|
|
2856
|
-
return hasMinimumAccess(result.accessLevel, requiredLevel);
|
|
2857
|
-
}
|
|
2858
|
-
/**
|
|
2859
|
-
* Get capabilities for a verified agent
|
|
2860
|
-
*/
|
|
2861
|
-
async getCapabilities(credentials) {
|
|
2862
|
-
const result = await this.quickVerify(credentials);
|
|
2863
|
-
return getCapabilities(result.accessLevel);
|
|
2864
|
-
}
|
|
2865
2698
|
/**
|
|
2866
2699
|
* Verify a specific ASTRA-ID
|
|
2867
2700
|
*/
|
|
@@ -5589,18 +5422,13 @@ function mcpToPdlss(parsed, requestPath, headerPurpose, headerAction, toolGate)
|
|
|
5589
5422
|
}
|
|
5590
5423
|
return { purpose, action, resource, purposeSource, actionSource };
|
|
5591
5424
|
}
|
|
5592
|
-
function
|
|
5593
|
-
if (parsed.isInitialize || parsed.method === "notifications/initialized") return
|
|
5594
|
-
if (parsed.isIntrospection) return
|
|
5595
|
-
|
|
5596
|
-
if (parsed.isToolCall) return "standard";
|
|
5597
|
-
return "standard";
|
|
5425
|
+
function mcpDefaultEnforced(parsed) {
|
|
5426
|
+
if (parsed.isInitialize || parsed.method === "notifications/initialized") return false;
|
|
5427
|
+
if (parsed.isIntrospection) return false;
|
|
5428
|
+
return true;
|
|
5598
5429
|
}
|
|
5599
5430
|
|
|
5600
5431
|
// src/adapters/mcp.ts
|
|
5601
|
-
function normalizeToolGate(gate) {
|
|
5602
|
-
return typeof gate === "string" ? { minAccessLevel: gate } : gate;
|
|
5603
|
-
}
|
|
5604
5432
|
function readSingleHeader(value) {
|
|
5605
5433
|
if (typeof value === "string") return value;
|
|
5606
5434
|
if (Array.isArray(value)) return value[0];
|
|
@@ -5653,7 +5481,6 @@ function defaultMcpDenied(result, req, res) {
|
|
|
5653
5481
|
code: !result.identityVerified ? -32e3 : -32001,
|
|
5654
5482
|
message: result.denialReasons?.[0] ?? "Access denied",
|
|
5655
5483
|
data: {
|
|
5656
|
-
accessLevel: result.accessLevel,
|
|
5657
5484
|
guidance: result.guidance,
|
|
5658
5485
|
// Round-10: aggregated per-dimension detail + correlation handle.
|
|
5659
5486
|
failures: result.failures,
|
|
@@ -5666,20 +5493,19 @@ function defaultMcpDenied(result, req, res) {
|
|
|
5666
5493
|
}
|
|
5667
5494
|
});
|
|
5668
5495
|
}
|
|
5669
|
-
function
|
|
5496
|
+
function resolveGate(parsed, opts) {
|
|
5670
5497
|
if (!parsed.toolName) {
|
|
5671
|
-
|
|
5672
|
-
|
|
5498
|
+
const methodGate = opts.methodGates?.[parsed.method];
|
|
5499
|
+
if (methodGate !== void 0) {
|
|
5500
|
+
return methodGate === "observe" ? { enforce: false, source: "methodGate" } : { enforce: true, config: methodGate, source: "methodGate" };
|
|
5673
5501
|
}
|
|
5674
|
-
return {
|
|
5502
|
+
return { enforce: false, source: "discovery_default" };
|
|
5675
5503
|
}
|
|
5676
|
-
|
|
5677
|
-
|
|
5678
|
-
|
|
5679
|
-
source: "toolGate"
|
|
5680
|
-
};
|
|
5504
|
+
const toolGate = opts.toolGates?.[parsed.toolName];
|
|
5505
|
+
if (toolGate !== void 0) {
|
|
5506
|
+
return toolGate === "observe" ? { enforce: false, source: "toolGate" } : { enforce: true, config: toolGate, source: "toolGate" };
|
|
5681
5507
|
}
|
|
5682
|
-
return {
|
|
5508
|
+
return { enforce: mcpDefaultEnforced(parsed), source: "tier" };
|
|
5683
5509
|
}
|
|
5684
5510
|
function createMcpMiddleware(options) {
|
|
5685
5511
|
const {
|
|
@@ -5699,15 +5525,6 @@ function createMcpMiddleware(options) {
|
|
|
5699
5525
|
prefetchWellKnown(config.apiBaseUrl).catch(() => {
|
|
5700
5526
|
});
|
|
5701
5527
|
}
|
|
5702
|
-
if (toolGates) {
|
|
5703
|
-
for (const [toolName, gate] of Object.entries(toolGates)) {
|
|
5704
|
-
if (typeof gate === "string") {
|
|
5705
|
-
console.warn(
|
|
5706
|
-
`[VerificationGateway/MCP] toolGates['${toolName}'] uses the bare-string shorthand ('${gate}'). Gated tools need a PDLSS purpose (else PDLSS_PURPOSE_REQUIRED 400) and evaluate purpose-only without a declared action. Use the object form instead: { minAccessLevel: '${gate}', purpose: '...', action: '...' }.`
|
|
5707
|
-
);
|
|
5708
|
-
}
|
|
5709
|
-
}
|
|
5710
|
-
}
|
|
5711
5528
|
return async (req, res, next) => {
|
|
5712
5529
|
try {
|
|
5713
5530
|
if (skip) return next();
|
|
@@ -5756,7 +5573,7 @@ function createMcpMiddleware(options) {
|
|
|
5756
5573
|
return next();
|
|
5757
5574
|
}
|
|
5758
5575
|
}
|
|
5759
|
-
const
|
|
5576
|
+
const gateDecision = resolveGate(parsed, {
|
|
5760
5577
|
toolGates,
|
|
5761
5578
|
methodGates
|
|
5762
5579
|
});
|
|
@@ -5765,16 +5582,15 @@ function createMcpMiddleware(options) {
|
|
|
5765
5582
|
req.query
|
|
5766
5583
|
);
|
|
5767
5584
|
if (effectiveAstraId) credentials.astraId = effectiveAstraId;
|
|
5768
|
-
const shouldEnforce =
|
|
5769
|
-
if (
|
|
5585
|
+
const shouldEnforce = gateDecision.enforce;
|
|
5586
|
+
if (!shouldEnforce && (!config.evaluateAlwaysIfCredentialed || !credentials.astraId)) {
|
|
5770
5587
|
if (config.setPassThroughHeader) {
|
|
5771
5588
|
res.setHeader("X-Astra-Gateway-Mode", "unenforced");
|
|
5772
|
-
res.setHeader("X-Astra-Gateway-Reason", "mcp-
|
|
5589
|
+
res.setHeader("X-Astra-Gateway-Reason", "mcp-observe");
|
|
5773
5590
|
}
|
|
5774
5591
|
return next();
|
|
5775
5592
|
}
|
|
5776
|
-
const
|
|
5777
|
-
const gate = rawGate ? normalizeToolGate(rawGate) : void 0;
|
|
5593
|
+
const gate = gateDecision.config;
|
|
5778
5594
|
const headerPurpose = readSingleHeader(req.headers["x-astra-purpose"]);
|
|
5779
5595
|
const headerAction = readSingleHeader(req.headers["x-astra-action"]);
|
|
5780
5596
|
const pdlss = mcpToPdlss(
|
|
@@ -5910,7 +5726,6 @@ function createMcpMiddleware(options) {
|
|
|
5910
5726
|
const result = {
|
|
5911
5727
|
identityVerified: false,
|
|
5912
5728
|
policyAllowed: false,
|
|
5913
|
-
accessLevel: "none",
|
|
5914
5729
|
denialReasons: [`MCP middleware internal error: ${errorClass}`],
|
|
5915
5730
|
failures: [
|
|
5916
5731
|
{
|
|
@@ -6666,8 +6481,6 @@ function detectRuntime(userAgent) {
|
|
|
6666
6481
|
}
|
|
6667
6482
|
// Annotate the CommonJS export names for ESM import in node:
|
|
6668
6483
|
0 && (module.exports = {
|
|
6669
|
-
ACCESS_LEVEL_DESCRIPTIONS,
|
|
6670
|
-
ACCESS_LEVEL_HIERARCHY,
|
|
6671
6484
|
AgentClient,
|
|
6672
6485
|
AstraSync,
|
|
6673
6486
|
AstraSyncError,
|
|
@@ -6675,7 +6488,6 @@ function detectRuntime(userAgent) {
|
|
|
6675
6488
|
CAPTURE_SCHEMA_VERSION,
|
|
6676
6489
|
ChallengeHandler,
|
|
6677
6490
|
DEFAULT_EDGE_CONFIG,
|
|
6678
|
-
DEFAULT_TRUST_THRESHOLDS,
|
|
6679
6491
|
KYDRequiredError,
|
|
6680
6492
|
MAX_HEADERS,
|
|
6681
6493
|
MAX_HEADER_VALUE_BYTES,
|
|
@@ -6702,7 +6514,6 @@ function detectRuntime(userAgent) {
|
|
|
6702
6514
|
deriveConnectionFromHeaders,
|
|
6703
6515
|
detectPlatformFingerprint,
|
|
6704
6516
|
detectRuntime,
|
|
6705
|
-
determineAccessLevel,
|
|
6706
6517
|
express,
|
|
6707
6518
|
extractApiKeyFormat,
|
|
6708
6519
|
extractCredentials,
|
|
@@ -6710,14 +6521,11 @@ function detectRuntime(userAgent) {
|
|
|
6710
6521
|
extractPlatformHeaders,
|
|
6711
6522
|
fetchEdgeConfig,
|
|
6712
6523
|
fetchRoutes,
|
|
6713
|
-
getAccessLevelForScore,
|
|
6714
6524
|
getCachedWellKnownUrls,
|
|
6715
|
-
getCapabilities,
|
|
6716
6525
|
getEdgeConfig,
|
|
6717
6526
|
getTrustLevel,
|
|
6718
6527
|
getWellKnownUrls,
|
|
6719
6528
|
hasCredentials,
|
|
6720
|
-
hasMinimumAccess,
|
|
6721
6529
|
isEdgeConfig,
|
|
6722
6530
|
isVerifiedHopValidFor,
|
|
6723
6531
|
matchEdgePathRule,
|