@astrasyncai/verification-gateway 4.6.0 → 5.1.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 +25 -35
- package/dist/adapters/express.js.map +1 -1
- package/dist/adapters/express.mjs +25 -35
- 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 +42 -67
- package/dist/adapters/mcp.js.map +1 -1
- package/dist/adapters/mcp.mjs +41 -66
- 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 +23 -32
- package/dist/adapters/nextjs.js.map +1 -1
- package/dist/adapters/nextjs.mjs +23 -32
- 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 +22 -126
- package/dist/adapters/sdk.js.map +1 -1
- package/dist/adapters/sdk.mjs +22 -124
- 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 +23 -31
- package/dist/bin/astrasync-codex-hook.js +23 -31
- package/dist/bin/astrasync-guard.js +23 -31
- package/dist/bin/astrasync.js +28 -36
- package/dist/browser/background.js +23 -31
- package/dist/browser/background.js.map +1 -1
- package/dist/browser/background.mjs +23 -31
- 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 +23 -31
- package/dist/codex/index.js.map +1 -1
- package/dist/codex/index.mjs +23 -31
- 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 +23 -31
- package/dist/cursor/extension.js.map +1 -1
- package/dist/cursor/extension.mjs +23 -31
- 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 +12 -3
- package/dist/edge-core/index.d.ts +12 -3
- package/dist/edge-core/index.js +42 -36
- package/dist/edge-core/index.js.map +1 -1
- package/dist/edge-core/index.mjs +42 -36
- package/dist/edge-core/index.mjs.map +1 -1
- package/dist/{express-DBtPKXOL.d.mts → express-KkBZBMqi.d.mts} +1 -1
- package/dist/{express-D-8Ks2Uo.d.ts → express-xK8pRrmj.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 +23 -31
- package/dist/gateway/gateway.js.map +1 -1
- package/dist/gateway/gateway.mjs +23 -31
- 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-DIRzR5IS.d.mts} +1 -1
- package/dist/{index-DlZORQsb.d.ts → index-DLQ4Rcuc.d.ts} +1 -1
- package/dist/{index-CUfmJ1Dq.d.mts → index-GPDn_EGI.d.mts} +1 -1
- package/dist/{index-BND3kQev.d.ts → index-Hnz5VyMR.d.ts} +1 -1
- package/dist/index.d.mts +14 -10
- package/dist/index.d.ts +14 -10
- package/dist/index.js +44 -219
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +44 -212
- 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-DToTlwIn.d.ts → mcp-DPpu4xQz.d.ts} +53 -52
- package/dist/{mcp-ZRN4kY3b.d.mts → mcp-Dju_Sr1o.d.mts} +53 -52
- package/dist/{nextjs-C0KASOy_.d.mts → nextjs-BuoDBN4g.d.mts} +1 -1
- package/dist/{nextjs-lwNvWYWT.d.ts → nextjs-rZKzY_8o.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-CdO6TIEf.d.mts +142 -0
- package/dist/sdk-DxHuIJBm.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-DhhJxKIC.d.ts → types-3UV7IZx7.d.ts} +1 -3
- package/dist/{types-CGPU7HLi.d.ts → types-CNBaZKxY.d.ts} +24 -50
- package/dist/{types-Cx9hTpKI.d.mts → types-CSHcByFX.d.mts} +24 -50
- package/dist/{types-CfSJLS4i.d.mts → types-CoDjpbVY.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 +22 -30
- package/dist/verify.js.map +1 -1
- package/dist/verify.mjs +22 -30
- 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
|
@@ -3734,7 +3734,7 @@ function verifyLocal(evaluator, context) {
|
|
|
3734
3734
|
return evaluator.evaluate(context);
|
|
3735
3735
|
}
|
|
3736
3736
|
|
|
3737
|
-
// src/
|
|
3737
|
+
// src/trust-levels.ts
|
|
3738
3738
|
function getTrustLevel(score) {
|
|
3739
3739
|
if (score >= 80) return "PLATINUM";
|
|
3740
3740
|
if (score >= 60) return "GOLD";
|
|
@@ -3743,7 +3743,7 @@ function getTrustLevel(score) {
|
|
|
3743
3743
|
}
|
|
3744
3744
|
|
|
3745
3745
|
// src/version.ts
|
|
3746
|
-
var SDK_VERSION = "
|
|
3746
|
+
var SDK_VERSION = "5.0.0";
|
|
3747
3747
|
|
|
3748
3748
|
// src/http.ts
|
|
3749
3749
|
var SDK_USER_AGENT = `astrasync-sdk/${SDK_VERSION}`;
|
|
@@ -3773,11 +3773,6 @@ function getCachedWellKnownUrls(apiBaseUrl) {
|
|
|
3773
3773
|
// src/verify.ts
|
|
3774
3774
|
var DEFAULT_CONFIG = {
|
|
3775
3775
|
apiBaseUrl: "https://astrasync.ai/api",
|
|
3776
|
-
// v2.3.9 (defect #30): default for unconfigured callers is `'none'` (no
|
|
3777
|
-
// access). Pre-rename this defaulted to `'guidance'`, which combined with
|
|
3778
|
-
// a route gated at `'guidance'` to silently let unverified traffic
|
|
3779
|
-
// through (`hasMinimumAccess('guidance', 'guidance') === true`).
|
|
3780
|
-
defaultAccessLevel: "none",
|
|
3781
3776
|
// minTrustScore + minTrustScoreForFull deprecated in v2.3.0 — server decides.
|
|
3782
3777
|
// cacheTtl deliberately unset. When undefined, cacheResult applies the 60s
|
|
3783
3778
|
// default; the caller's explicit value is honoured for cacheable results.
|
|
@@ -3900,6 +3895,14 @@ function cacheResult(request, result, configuredTtl, counterpartyId) {
|
|
|
3900
3895
|
expiresAt: Date.now() + ttlSeconds * 1e3
|
|
3901
3896
|
});
|
|
3902
3897
|
}
|
|
3898
|
+
function mcpGuidance(urls) {
|
|
3899
|
+
if (!urls?.mcpEndpoint) return void 0;
|
|
3900
|
+
return {
|
|
3901
|
+
endpoint: urls.mcpEndpoint,
|
|
3902
|
+
discoveryUrl: urls.mcpDiscoveryUrl,
|
|
3903
|
+
message: "If you are operating inside an MCP-capable host (Claude, ChatGPT, Cursor, or any MCP client), add the AstraSync MCP connector instead of integrating these URLs by hand: registration through the connector is KEYLESS and HUMAN-APPROVED \u2014 your human approves in an in-chat card, and you never see, hold, or transmit an API key, password, or private key."
|
|
3904
|
+
};
|
|
3905
|
+
}
|
|
3903
3906
|
function createGuidanceResponse(_config, reason, options = {}) {
|
|
3904
3907
|
const source = options.source ?? "no_credentials";
|
|
3905
3908
|
const isApiError = source === "api_error";
|
|
@@ -3926,11 +3929,17 @@ function createGuidanceResponse(_config, reason, options = {}) {
|
|
|
3926
3929
|
registrationUrl: urls?.registrationUrl ?? "",
|
|
3927
3930
|
documentationUrl: urls?.documentationUrl ?? "",
|
|
3928
3931
|
steps: [
|
|
3932
|
+
// MCP steering leads when the hosted bridge is advertised — the
|
|
3933
|
+
// connector is the agent-actionable path (keyless, human-approved).
|
|
3934
|
+
...urls?.mcpEndpoint ? [
|
|
3935
|
+
`Fastest path (inside an MCP host): add the AstraSync MCP connector at ${urls.mcpEndpoint} \u2014 keyless, human-approved registration`
|
|
3936
|
+
] : [],
|
|
3929
3937
|
"Register for an AstraSync account",
|
|
3930
3938
|
"Create and register your agent",
|
|
3931
3939
|
"Add your ASTRA-ID to request headers",
|
|
3932
3940
|
"Retry your request"
|
|
3933
|
-
]
|
|
3941
|
+
],
|
|
3942
|
+
...mcpGuidance(urls) && { mcp: mcpGuidance(urls) }
|
|
3934
3943
|
};
|
|
3935
3944
|
return {
|
|
3936
3945
|
// Round-18 G4: createGuidanceResponse fires for unverified-agent path or
|
|
@@ -3938,13 +3947,6 @@ function createGuidanceResponse(_config, reason, options = {}) {
|
|
|
3938
3947
|
// policy is not evaluated (we never reached the gate).
|
|
3939
3948
|
identityVerified: false,
|
|
3940
3949
|
policyAllowed: false,
|
|
3941
|
-
// v2.3.9 (defect #30): denials grant `'none'`, NEVER a positive band.
|
|
3942
|
-
// Adapters additionally short-circuit on `!identityVerified ||
|
|
3943
|
-
// !policyAllowed` before the gate check, but the access level still has
|
|
3944
|
-
// to be honest at the data layer so downstream consumers (SDK adapters
|
|
3945
|
-
// in other languages, custom integrations) inherit the correct
|
|
3946
|
-
// semantics.
|
|
3947
|
-
accessLevel: "none",
|
|
3948
3950
|
guidance,
|
|
3949
3951
|
denialReasons: reason ? [reason] : ["No valid agent credentials provided"],
|
|
3950
3952
|
// Round-10 (#47, O5): on API-error fallback, surface a typed failure so
|
|
@@ -4038,7 +4040,6 @@ async function callVerifyAccessAPI(config, request) {
|
|
|
4038
4040
|
attemptId: typeof data?.attemptId === "string" ? data.attemptId : void 0,
|
|
4039
4041
|
access: {
|
|
4040
4042
|
allowed: false,
|
|
4041
|
-
accessLevel: "none",
|
|
4042
4043
|
reason: "endpoint_deactivated",
|
|
4043
4044
|
failures: [
|
|
4044
4045
|
{
|
|
@@ -4101,7 +4102,7 @@ async function verify(config, request, options) {
|
|
|
4101
4102
|
if (!deprecationWarningShown && (config.minTrustScore !== void 0 || config.minTrustScoreForFull !== void 0)) {
|
|
4102
4103
|
deprecationWarningShown = true;
|
|
4103
4104
|
console.warn(
|
|
4104
|
-
"[VerificationGateway] minTrustScore / minTrustScoreForFull are deprecated in v2.3.0 and have no effect. Server is now the single source of truth for access
|
|
4105
|
+
"[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."
|
|
4105
4106
|
);
|
|
4106
4107
|
}
|
|
4107
4108
|
if (mergedConfig.cacheTtl !== 0 && !options?.bypassCache) {
|
|
@@ -4147,14 +4148,6 @@ async function verify(config, request, options) {
|
|
|
4147
4148
|
const result2 = {
|
|
4148
4149
|
identityVerified: idVerifiedFromBackend,
|
|
4149
4150
|
policyAllowed: false,
|
|
4150
|
-
// v2.3.9 (defect #30): denials grant `'none'`, NEVER a positive band.
|
|
4151
|
-
// Pre-rename this hardcoded `'guidance'`, which conflated with the
|
|
4152
|
-
// colocated `guidance: {...}` help-payload object below and let
|
|
4153
|
-
// denied requests pass any route gated at `'guidance'` because
|
|
4154
|
-
// `hasMinimumAccess('guidance', 'guidance') === true`. Adapters now
|
|
4155
|
-
// ALSO short-circuit on `!identityVerified || !policyAllowed` before
|
|
4156
|
-
// the gate check — belt-and-braces.
|
|
4157
|
-
accessLevel: "none",
|
|
4158
4151
|
// 3.6.0: the server now emits top-level denialReasons on every deny
|
|
4159
4152
|
// path — prefer it verbatim; the failure-message reconstruction remains
|
|
4160
4153
|
// as the fallback for older backends.
|
|
@@ -4165,7 +4158,10 @@ async function verify(config, request, options) {
|
|
|
4165
4158
|
guidance: {
|
|
4166
4159
|
message: apiResponse.access?.reason || "Access denied by PDLSS policy",
|
|
4167
4160
|
registrationUrl: urls?.registrationUrl ?? "",
|
|
4168
|
-
documentationUrl: urls?.documentationUrl ?? ""
|
|
4161
|
+
documentationUrl: urls?.documentationUrl ?? "",
|
|
4162
|
+
// 5.1.0: anonymous callers land on this branch — steer MCP-hosted
|
|
4163
|
+
// agents to the connector (this is what the edge deny body surfaces).
|
|
4164
|
+
...mcpGuidance(urls) && { mcp: mcpGuidance(urls) }
|
|
4169
4165
|
},
|
|
4170
4166
|
verifiedAt: /* @__PURE__ */ new Date(),
|
|
4171
4167
|
// Extract sessionId so decisions can be recorded for denials too
|
|
@@ -4203,7 +4199,6 @@ async function verify(config, request, options) {
|
|
|
4203
4199
|
trustScore: apiResponse.organization.trustScore
|
|
4204
4200
|
} : void 0;
|
|
4205
4201
|
const verificationContext = apiResponse.verificationContext;
|
|
4206
|
-
const accessLevel = apiResponse.access?.accessLevel ?? "standard";
|
|
4207
4202
|
const result = {
|
|
4208
4203
|
// 4.5.0 (probe F1): read idVerified from verificationContext with the
|
|
4209
4204
|
// SAME absent⇒false default as the deny branch. The previous `!== false`
|
|
@@ -4215,7 +4210,6 @@ async function verify(config, request, options) {
|
|
|
4215
4210
|
// this load-bearing must never be defaulted on.
|
|
4216
4211
|
identityVerified: apiResponse.verificationContext?.idVerified === true,
|
|
4217
4212
|
policyAllowed: true,
|
|
4218
|
-
accessLevel,
|
|
4219
4213
|
agent,
|
|
4220
4214
|
developer,
|
|
4221
4215
|
organization,
|
|
@@ -4242,7 +4236,6 @@ async function verify(config, request, options) {
|
|
|
4242
4236
|
};
|
|
4243
4237
|
if (result.recommendation === "deny") {
|
|
4244
4238
|
result.policyAllowed = false;
|
|
4245
|
-
result.accessLevel = "none";
|
|
4246
4239
|
result.denialReasons = serverDenialReasons ?? result.recommendationReasons ?? ["Access denied by AstraSync recommendation"];
|
|
4247
4240
|
result.guidance = result.runtimeChallenge ? {
|
|
4248
4241
|
message: `Verification failed: ${result.runtimeChallenge.reason || "runtime challenge failed"}`,
|
|
@@ -4355,7 +4348,6 @@ function toGatewayConfig(config) {
|
|
|
4355
4348
|
return {
|
|
4356
4349
|
apiBaseUrl: config.apiBaseUrl || "https://api.astrasync.ai",
|
|
4357
4350
|
apiKey: config.apiKey,
|
|
4358
|
-
defaultAccessLevel: config.defaultAccessLevel,
|
|
4359
4351
|
minTrustScore: config.minTrustScore,
|
|
4360
4352
|
minTrustScoreForFull: config.minTrustScoreForFull,
|
|
4361
4353
|
cacheTtl: config.cacheTtl,
|
|
@@ -4383,7 +4375,7 @@ function toDecision(result) {
|
|
|
4383
4375
|
if (result.identityVerified && result.policyAllowed) {
|
|
4384
4376
|
return {
|
|
4385
4377
|
recommendation: "ALLOW",
|
|
4386
|
-
reason: `Verified
|
|
4378
|
+
reason: result.agent?.trustScore ? `Verified (trust score ${result.agent.trustScore})` : "Verified",
|
|
4387
4379
|
trustScore: result.agent?.trustScore,
|
|
4388
4380
|
sessionId: "sessionId" in result ? result.sessionId : void 0
|
|
4389
4381
|
};
|
|
@@ -3733,7 +3733,7 @@ function verifyLocal(evaluator, context) {
|
|
|
3733
3733
|
return evaluator.evaluate(context);
|
|
3734
3734
|
}
|
|
3735
3735
|
|
|
3736
|
-
// src/
|
|
3736
|
+
// src/trust-levels.ts
|
|
3737
3737
|
function getTrustLevel(score) {
|
|
3738
3738
|
if (score >= 80) return "PLATINUM";
|
|
3739
3739
|
if (score >= 60) return "GOLD";
|
|
@@ -3742,7 +3742,7 @@ function getTrustLevel(score) {
|
|
|
3742
3742
|
}
|
|
3743
3743
|
|
|
3744
3744
|
// src/version.ts
|
|
3745
|
-
var SDK_VERSION = "
|
|
3745
|
+
var SDK_VERSION = "5.0.0";
|
|
3746
3746
|
|
|
3747
3747
|
// src/http.ts
|
|
3748
3748
|
var SDK_USER_AGENT = `astrasync-sdk/${SDK_VERSION}`;
|
|
@@ -3772,11 +3772,6 @@ function getCachedWellKnownUrls(apiBaseUrl) {
|
|
|
3772
3772
|
// src/verify.ts
|
|
3773
3773
|
var DEFAULT_CONFIG = {
|
|
3774
3774
|
apiBaseUrl: "https://astrasync.ai/api",
|
|
3775
|
-
// v2.3.9 (defect #30): default for unconfigured callers is `'none'` (no
|
|
3776
|
-
// access). Pre-rename this defaulted to `'guidance'`, which combined with
|
|
3777
|
-
// a route gated at `'guidance'` to silently let unverified traffic
|
|
3778
|
-
// through (`hasMinimumAccess('guidance', 'guidance') === true`).
|
|
3779
|
-
defaultAccessLevel: "none",
|
|
3780
3775
|
// minTrustScore + minTrustScoreForFull deprecated in v2.3.0 — server decides.
|
|
3781
3776
|
// cacheTtl deliberately unset. When undefined, cacheResult applies the 60s
|
|
3782
3777
|
// default; the caller's explicit value is honoured for cacheable results.
|
|
@@ -3899,6 +3894,14 @@ function cacheResult(request, result, configuredTtl, counterpartyId) {
|
|
|
3899
3894
|
expiresAt: Date.now() + ttlSeconds * 1e3
|
|
3900
3895
|
});
|
|
3901
3896
|
}
|
|
3897
|
+
function mcpGuidance(urls) {
|
|
3898
|
+
if (!urls?.mcpEndpoint) return void 0;
|
|
3899
|
+
return {
|
|
3900
|
+
endpoint: urls.mcpEndpoint,
|
|
3901
|
+
discoveryUrl: urls.mcpDiscoveryUrl,
|
|
3902
|
+
message: "If you are operating inside an MCP-capable host (Claude, ChatGPT, Cursor, or any MCP client), add the AstraSync MCP connector instead of integrating these URLs by hand: registration through the connector is KEYLESS and HUMAN-APPROVED \u2014 your human approves in an in-chat card, and you never see, hold, or transmit an API key, password, or private key."
|
|
3903
|
+
};
|
|
3904
|
+
}
|
|
3902
3905
|
function createGuidanceResponse(_config, reason, options = {}) {
|
|
3903
3906
|
const source = options.source ?? "no_credentials";
|
|
3904
3907
|
const isApiError = source === "api_error";
|
|
@@ -3925,11 +3928,17 @@ function createGuidanceResponse(_config, reason, options = {}) {
|
|
|
3925
3928
|
registrationUrl: urls?.registrationUrl ?? "",
|
|
3926
3929
|
documentationUrl: urls?.documentationUrl ?? "",
|
|
3927
3930
|
steps: [
|
|
3931
|
+
// MCP steering leads when the hosted bridge is advertised — the
|
|
3932
|
+
// connector is the agent-actionable path (keyless, human-approved).
|
|
3933
|
+
...urls?.mcpEndpoint ? [
|
|
3934
|
+
`Fastest path (inside an MCP host): add the AstraSync MCP connector at ${urls.mcpEndpoint} \u2014 keyless, human-approved registration`
|
|
3935
|
+
] : [],
|
|
3928
3936
|
"Register for an AstraSync account",
|
|
3929
3937
|
"Create and register your agent",
|
|
3930
3938
|
"Add your ASTRA-ID to request headers",
|
|
3931
3939
|
"Retry your request"
|
|
3932
|
-
]
|
|
3940
|
+
],
|
|
3941
|
+
...mcpGuidance(urls) && { mcp: mcpGuidance(urls) }
|
|
3933
3942
|
};
|
|
3934
3943
|
return {
|
|
3935
3944
|
// Round-18 G4: createGuidanceResponse fires for unverified-agent path or
|
|
@@ -3937,13 +3946,6 @@ function createGuidanceResponse(_config, reason, options = {}) {
|
|
|
3937
3946
|
// policy is not evaluated (we never reached the gate).
|
|
3938
3947
|
identityVerified: false,
|
|
3939
3948
|
policyAllowed: false,
|
|
3940
|
-
// v2.3.9 (defect #30): denials grant `'none'`, NEVER a positive band.
|
|
3941
|
-
// Adapters additionally short-circuit on `!identityVerified ||
|
|
3942
|
-
// !policyAllowed` before the gate check, but the access level still has
|
|
3943
|
-
// to be honest at the data layer so downstream consumers (SDK adapters
|
|
3944
|
-
// in other languages, custom integrations) inherit the correct
|
|
3945
|
-
// semantics.
|
|
3946
|
-
accessLevel: "none",
|
|
3947
3949
|
guidance,
|
|
3948
3950
|
denialReasons: reason ? [reason] : ["No valid agent credentials provided"],
|
|
3949
3951
|
// Round-10 (#47, O5): on API-error fallback, surface a typed failure so
|
|
@@ -4037,7 +4039,6 @@ async function callVerifyAccessAPI(config, request) {
|
|
|
4037
4039
|
attemptId: typeof data?.attemptId === "string" ? data.attemptId : void 0,
|
|
4038
4040
|
access: {
|
|
4039
4041
|
allowed: false,
|
|
4040
|
-
accessLevel: "none",
|
|
4041
4042
|
reason: "endpoint_deactivated",
|
|
4042
4043
|
failures: [
|
|
4043
4044
|
{
|
|
@@ -4100,7 +4101,7 @@ async function verify(config, request, options) {
|
|
|
4100
4101
|
if (!deprecationWarningShown && (config.minTrustScore !== void 0 || config.minTrustScoreForFull !== void 0)) {
|
|
4101
4102
|
deprecationWarningShown = true;
|
|
4102
4103
|
console.warn(
|
|
4103
|
-
"[VerificationGateway] minTrustScore / minTrustScoreForFull are deprecated in v2.3.0 and have no effect. Server is now the single source of truth for access
|
|
4104
|
+
"[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."
|
|
4104
4105
|
);
|
|
4105
4106
|
}
|
|
4106
4107
|
if (mergedConfig.cacheTtl !== 0 && !options?.bypassCache) {
|
|
@@ -4146,14 +4147,6 @@ async function verify(config, request, options) {
|
|
|
4146
4147
|
const result2 = {
|
|
4147
4148
|
identityVerified: idVerifiedFromBackend,
|
|
4148
4149
|
policyAllowed: false,
|
|
4149
|
-
// v2.3.9 (defect #30): denials grant `'none'`, NEVER a positive band.
|
|
4150
|
-
// Pre-rename this hardcoded `'guidance'`, which conflated with the
|
|
4151
|
-
// colocated `guidance: {...}` help-payload object below and let
|
|
4152
|
-
// denied requests pass any route gated at `'guidance'` because
|
|
4153
|
-
// `hasMinimumAccess('guidance', 'guidance') === true`. Adapters now
|
|
4154
|
-
// ALSO short-circuit on `!identityVerified || !policyAllowed` before
|
|
4155
|
-
// the gate check — belt-and-braces.
|
|
4156
|
-
accessLevel: "none",
|
|
4157
4150
|
// 3.6.0: the server now emits top-level denialReasons on every deny
|
|
4158
4151
|
// path — prefer it verbatim; the failure-message reconstruction remains
|
|
4159
4152
|
// as the fallback for older backends.
|
|
@@ -4164,7 +4157,10 @@ async function verify(config, request, options) {
|
|
|
4164
4157
|
guidance: {
|
|
4165
4158
|
message: apiResponse.access?.reason || "Access denied by PDLSS policy",
|
|
4166
4159
|
registrationUrl: urls?.registrationUrl ?? "",
|
|
4167
|
-
documentationUrl: urls?.documentationUrl ?? ""
|
|
4160
|
+
documentationUrl: urls?.documentationUrl ?? "",
|
|
4161
|
+
// 5.1.0: anonymous callers land on this branch — steer MCP-hosted
|
|
4162
|
+
// agents to the connector (this is what the edge deny body surfaces).
|
|
4163
|
+
...mcpGuidance(urls) && { mcp: mcpGuidance(urls) }
|
|
4168
4164
|
},
|
|
4169
4165
|
verifiedAt: /* @__PURE__ */ new Date(),
|
|
4170
4166
|
// Extract sessionId so decisions can be recorded for denials too
|
|
@@ -4202,7 +4198,6 @@ async function verify(config, request, options) {
|
|
|
4202
4198
|
trustScore: apiResponse.organization.trustScore
|
|
4203
4199
|
} : void 0;
|
|
4204
4200
|
const verificationContext = apiResponse.verificationContext;
|
|
4205
|
-
const accessLevel = apiResponse.access?.accessLevel ?? "standard";
|
|
4206
4201
|
const result = {
|
|
4207
4202
|
// 4.5.0 (probe F1): read idVerified from verificationContext with the
|
|
4208
4203
|
// SAME absent⇒false default as the deny branch. The previous `!== false`
|
|
@@ -4214,7 +4209,6 @@ async function verify(config, request, options) {
|
|
|
4214
4209
|
// this load-bearing must never be defaulted on.
|
|
4215
4210
|
identityVerified: apiResponse.verificationContext?.idVerified === true,
|
|
4216
4211
|
policyAllowed: true,
|
|
4217
|
-
accessLevel,
|
|
4218
4212
|
agent,
|
|
4219
4213
|
developer,
|
|
4220
4214
|
organization,
|
|
@@ -4241,7 +4235,6 @@ async function verify(config, request, options) {
|
|
|
4241
4235
|
};
|
|
4242
4236
|
if (result.recommendation === "deny") {
|
|
4243
4237
|
result.policyAllowed = false;
|
|
4244
|
-
result.accessLevel = "none";
|
|
4245
4238
|
result.denialReasons = serverDenialReasons ?? result.recommendationReasons ?? ["Access denied by AstraSync recommendation"];
|
|
4246
4239
|
result.guidance = result.runtimeChallenge ? {
|
|
4247
4240
|
message: `Verification failed: ${result.runtimeChallenge.reason || "runtime challenge failed"}`,
|
|
@@ -4354,7 +4347,6 @@ function toGatewayConfig(config) {
|
|
|
4354
4347
|
return {
|
|
4355
4348
|
apiBaseUrl: config.apiBaseUrl || "https://api.astrasync.ai",
|
|
4356
4349
|
apiKey: config.apiKey,
|
|
4357
|
-
defaultAccessLevel: config.defaultAccessLevel,
|
|
4358
4350
|
minTrustScore: config.minTrustScore,
|
|
4359
4351
|
minTrustScoreForFull: config.minTrustScoreForFull,
|
|
4360
4352
|
cacheTtl: config.cacheTtl,
|
|
@@ -4382,7 +4374,7 @@ function toDecision(result) {
|
|
|
4382
4374
|
if (result.identityVerified && result.policyAllowed) {
|
|
4383
4375
|
return {
|
|
4384
4376
|
recommendation: "ALLOW",
|
|
4385
|
-
reason: `Verified
|
|
4377
|
+
reason: result.agent?.trustScore ? `Verified (trust score ${result.agent.trustScore})` : "Verified",
|
|
4386
4378
|
trustScore: result.agent?.trustScore,
|
|
4387
4379
|
sessionId: "sessionId" in result ? result.sessionId : void 0
|
|
4388
4380
|
};
|
|
@@ -3705,7 +3705,7 @@ Policy saved to ${outputPath}`);
|
|
|
3705
3705
|
};
|
|
3706
3706
|
|
|
3707
3707
|
// src/version.ts
|
|
3708
|
-
var SDK_VERSION = "
|
|
3708
|
+
var SDK_VERSION = "5.0.0";
|
|
3709
3709
|
|
|
3710
3710
|
// src/http.ts
|
|
3711
3711
|
var SDK_USER_AGENT = `astrasync-sdk/${SDK_VERSION}`;
|
|
@@ -4663,7 +4663,7 @@ function verifyLocal(evaluator, context) {
|
|
|
4663
4663
|
return evaluator.evaluate(context);
|
|
4664
4664
|
}
|
|
4665
4665
|
|
|
4666
|
-
// src/
|
|
4666
|
+
// src/trust-levels.ts
|
|
4667
4667
|
function getTrustLevel(score) {
|
|
4668
4668
|
if (score >= 80) return "PLATINUM";
|
|
4669
4669
|
if (score >= 60) return "GOLD";
|
|
@@ -4681,11 +4681,6 @@ function getCachedWellKnownUrls(apiBaseUrl) {
|
|
|
4681
4681
|
// src/verify.ts
|
|
4682
4682
|
var DEFAULT_CONFIG = {
|
|
4683
4683
|
apiBaseUrl: "https://astrasync.ai/api",
|
|
4684
|
-
// v2.3.9 (defect #30): default for unconfigured callers is `'none'` (no
|
|
4685
|
-
// access). Pre-rename this defaulted to `'guidance'`, which combined with
|
|
4686
|
-
// a route gated at `'guidance'` to silently let unverified traffic
|
|
4687
|
-
// through (`hasMinimumAccess('guidance', 'guidance') === true`).
|
|
4688
|
-
defaultAccessLevel: "none",
|
|
4689
4684
|
// minTrustScore + minTrustScoreForFull deprecated in v2.3.0 — server decides.
|
|
4690
4685
|
// cacheTtl deliberately unset. When undefined, cacheResult applies the 60s
|
|
4691
4686
|
// default; the caller's explicit value is honoured for cacheable results.
|
|
@@ -4808,6 +4803,14 @@ function cacheResult(request2, result, configuredTtl, counterpartyId) {
|
|
|
4808
4803
|
expiresAt: Date.now() + ttlSeconds * 1e3
|
|
4809
4804
|
});
|
|
4810
4805
|
}
|
|
4806
|
+
function mcpGuidance(urls) {
|
|
4807
|
+
if (!urls?.mcpEndpoint) return void 0;
|
|
4808
|
+
return {
|
|
4809
|
+
endpoint: urls.mcpEndpoint,
|
|
4810
|
+
discoveryUrl: urls.mcpDiscoveryUrl,
|
|
4811
|
+
message: "If you are operating inside an MCP-capable host (Claude, ChatGPT, Cursor, or any MCP client), add the AstraSync MCP connector instead of integrating these URLs by hand: registration through the connector is KEYLESS and HUMAN-APPROVED \u2014 your human approves in an in-chat card, and you never see, hold, or transmit an API key, password, or private key."
|
|
4812
|
+
};
|
|
4813
|
+
}
|
|
4811
4814
|
function createGuidanceResponse(_config, reason, options = {}) {
|
|
4812
4815
|
const source = options.source ?? "no_credentials";
|
|
4813
4816
|
const isApiError = source === "api_error";
|
|
@@ -4834,11 +4837,17 @@ function createGuidanceResponse(_config, reason, options = {}) {
|
|
|
4834
4837
|
registrationUrl: urls?.registrationUrl ?? "",
|
|
4835
4838
|
documentationUrl: urls?.documentationUrl ?? "",
|
|
4836
4839
|
steps: [
|
|
4840
|
+
// MCP steering leads when the hosted bridge is advertised — the
|
|
4841
|
+
// connector is the agent-actionable path (keyless, human-approved).
|
|
4842
|
+
...urls?.mcpEndpoint ? [
|
|
4843
|
+
`Fastest path (inside an MCP host): add the AstraSync MCP connector at ${urls.mcpEndpoint} \u2014 keyless, human-approved registration`
|
|
4844
|
+
] : [],
|
|
4837
4845
|
"Register for an AstraSync account",
|
|
4838
4846
|
"Create and register your agent",
|
|
4839
4847
|
"Add your ASTRA-ID to request headers",
|
|
4840
4848
|
"Retry your request"
|
|
4841
|
-
]
|
|
4849
|
+
],
|
|
4850
|
+
...mcpGuidance(urls) && { mcp: mcpGuidance(urls) }
|
|
4842
4851
|
};
|
|
4843
4852
|
return {
|
|
4844
4853
|
// Round-18 G4: createGuidanceResponse fires for unverified-agent path or
|
|
@@ -4846,13 +4855,6 @@ function createGuidanceResponse(_config, reason, options = {}) {
|
|
|
4846
4855
|
// policy is not evaluated (we never reached the gate).
|
|
4847
4856
|
identityVerified: false,
|
|
4848
4857
|
policyAllowed: false,
|
|
4849
|
-
// v2.3.9 (defect #30): denials grant `'none'`, NEVER a positive band.
|
|
4850
|
-
// Adapters additionally short-circuit on `!identityVerified ||
|
|
4851
|
-
// !policyAllowed` before the gate check, but the access level still has
|
|
4852
|
-
// to be honest at the data layer so downstream consumers (SDK adapters
|
|
4853
|
-
// in other languages, custom integrations) inherit the correct
|
|
4854
|
-
// semantics.
|
|
4855
|
-
accessLevel: "none",
|
|
4856
4858
|
guidance,
|
|
4857
4859
|
denialReasons: reason ? [reason] : ["No valid agent credentials provided"],
|
|
4858
4860
|
// Round-10 (#47, O5): on API-error fallback, surface a typed failure so
|
|
@@ -4946,7 +4948,6 @@ async function callVerifyAccessAPI(config, request2) {
|
|
|
4946
4948
|
attemptId: typeof data?.attemptId === "string" ? data.attemptId : void 0,
|
|
4947
4949
|
access: {
|
|
4948
4950
|
allowed: false,
|
|
4949
|
-
accessLevel: "none",
|
|
4950
4951
|
reason: "endpoint_deactivated",
|
|
4951
4952
|
failures: [
|
|
4952
4953
|
{
|
|
@@ -5009,7 +5010,7 @@ async function verify(config, request2, options) {
|
|
|
5009
5010
|
if (!deprecationWarningShown && (config.minTrustScore !== void 0 || config.minTrustScoreForFull !== void 0)) {
|
|
5010
5011
|
deprecationWarningShown = true;
|
|
5011
5012
|
console.warn(
|
|
5012
|
-
"[VerificationGateway] minTrustScore / minTrustScoreForFull are deprecated in v2.3.0 and have no effect. Server is now the single source of truth for access
|
|
5013
|
+
"[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."
|
|
5013
5014
|
);
|
|
5014
5015
|
}
|
|
5015
5016
|
if (mergedConfig.cacheTtl !== 0 && !options?.bypassCache) {
|
|
@@ -5055,14 +5056,6 @@ async function verify(config, request2, options) {
|
|
|
5055
5056
|
const result2 = {
|
|
5056
5057
|
identityVerified: idVerifiedFromBackend,
|
|
5057
5058
|
policyAllowed: false,
|
|
5058
|
-
// v2.3.9 (defect #30): denials grant `'none'`, NEVER a positive band.
|
|
5059
|
-
// Pre-rename this hardcoded `'guidance'`, which conflated with the
|
|
5060
|
-
// colocated `guidance: {...}` help-payload object below and let
|
|
5061
|
-
// denied requests pass any route gated at `'guidance'` because
|
|
5062
|
-
// `hasMinimumAccess('guidance', 'guidance') === true`. Adapters now
|
|
5063
|
-
// ALSO short-circuit on `!identityVerified || !policyAllowed` before
|
|
5064
|
-
// the gate check — belt-and-braces.
|
|
5065
|
-
accessLevel: "none",
|
|
5066
5059
|
// 3.6.0: the server now emits top-level denialReasons on every deny
|
|
5067
5060
|
// path — prefer it verbatim; the failure-message reconstruction remains
|
|
5068
5061
|
// as the fallback for older backends.
|
|
@@ -5073,7 +5066,10 @@ async function verify(config, request2, options) {
|
|
|
5073
5066
|
guidance: {
|
|
5074
5067
|
message: apiResponse.access?.reason || "Access denied by PDLSS policy",
|
|
5075
5068
|
registrationUrl: urls?.registrationUrl ?? "",
|
|
5076
|
-
documentationUrl: urls?.documentationUrl ?? ""
|
|
5069
|
+
documentationUrl: urls?.documentationUrl ?? "",
|
|
5070
|
+
// 5.1.0: anonymous callers land on this branch — steer MCP-hosted
|
|
5071
|
+
// agents to the connector (this is what the edge deny body surfaces).
|
|
5072
|
+
...mcpGuidance(urls) && { mcp: mcpGuidance(urls) }
|
|
5077
5073
|
},
|
|
5078
5074
|
verifiedAt: /* @__PURE__ */ new Date(),
|
|
5079
5075
|
// Extract sessionId so decisions can be recorded for denials too
|
|
@@ -5111,7 +5107,6 @@ async function verify(config, request2, options) {
|
|
|
5111
5107
|
trustScore: apiResponse.organization.trustScore
|
|
5112
5108
|
} : void 0;
|
|
5113
5109
|
const verificationContext = apiResponse.verificationContext;
|
|
5114
|
-
const accessLevel = apiResponse.access?.accessLevel ?? "standard";
|
|
5115
5110
|
const result = {
|
|
5116
5111
|
// 4.5.0 (probe F1): read idVerified from verificationContext with the
|
|
5117
5112
|
// SAME absent⇒false default as the deny branch. The previous `!== false`
|
|
@@ -5123,7 +5118,6 @@ async function verify(config, request2, options) {
|
|
|
5123
5118
|
// this load-bearing must never be defaulted on.
|
|
5124
5119
|
identityVerified: apiResponse.verificationContext?.idVerified === true,
|
|
5125
5120
|
policyAllowed: true,
|
|
5126
|
-
accessLevel,
|
|
5127
5121
|
agent,
|
|
5128
5122
|
developer,
|
|
5129
5123
|
organization,
|
|
@@ -5150,7 +5144,6 @@ async function verify(config, request2, options) {
|
|
|
5150
5144
|
};
|
|
5151
5145
|
if (result.recommendation === "deny") {
|
|
5152
5146
|
result.policyAllowed = false;
|
|
5153
|
-
result.accessLevel = "none";
|
|
5154
5147
|
result.denialReasons = serverDenialReasons ?? result.recommendationReasons ?? ["Access denied by AstraSync recommendation"];
|
|
5155
5148
|
result.guidance = result.runtimeChallenge ? {
|
|
5156
5149
|
message: `Verification failed: ${result.runtimeChallenge.reason || "runtime challenge failed"}`,
|
|
@@ -5263,7 +5256,6 @@ function toGatewayConfig(config) {
|
|
|
5263
5256
|
return {
|
|
5264
5257
|
apiBaseUrl: config.apiBaseUrl || "https://api.astrasync.ai",
|
|
5265
5258
|
apiKey: config.apiKey,
|
|
5266
|
-
defaultAccessLevel: config.defaultAccessLevel,
|
|
5267
5259
|
minTrustScore: config.minTrustScore,
|
|
5268
5260
|
minTrustScoreForFull: config.minTrustScoreForFull,
|
|
5269
5261
|
cacheTtl: config.cacheTtl,
|
|
@@ -5291,7 +5283,7 @@ function toDecision(result) {
|
|
|
5291
5283
|
if (result.identityVerified && result.policyAllowed) {
|
|
5292
5284
|
return {
|
|
5293
5285
|
recommendation: "ALLOW",
|
|
5294
|
-
reason: `Verified
|
|
5286
|
+
reason: result.agent?.trustScore ? `Verified (trust score ${result.agent.trustScore})` : "Verified",
|
|
5295
5287
|
trustScore: result.agent?.trustScore,
|
|
5296
5288
|
sessionId: "sessionId" in result ? result.sessionId : void 0
|
|
5297
5289
|
};
|