@astrasyncai/verification-gateway 4.5.1 → 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/README.md +1 -1
- 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 +11 -33
- package/dist/adapters/express.js.map +1 -1
- package/dist/adapters/express.mjs +11 -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 +28 -65
- package/dist/adapters/mcp.js.map +1 -1
- package/dist/adapters/mcp.mjs +27 -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 +9 -30
- package/dist/adapters/nextjs.js.map +1 -1
- package/dist/adapters/nextjs.mjs +9 -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 +8 -124
- package/dist/adapters/sdk.js.map +1 -1
- package/dist/adapters/sdk.mjs +8 -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 +63 -41
- package/dist/bin/astrasync-codex-hook.js +63 -41
- package/dist/bin/astrasync-guard.js +63 -41
- package/dist/bin/astrasync.js +75 -48
- package/dist/browser/background.js +63 -41
- package/dist/browser/background.js.map +1 -1
- package/dist/browser/background.mjs +63 -41
- 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 +33 -6
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/index.mjs +33 -6
- 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 +63 -41
- package/dist/codex/index.js.map +1 -1
- package/dist/codex/index.mjs +63 -41
- 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 +63 -41
- package/dist/cursor/extension.js.map +1 -1
- package/dist/cursor/extension.mjs +63 -41
- 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 +11 -33
- package/dist/edge-core/index.js.map +1 -1
- package/dist/edge-core/index.mjs +11 -33
- package/dist/edge-core/index.mjs.map +1 -1
- package/dist/{express-DaqL11tx.d.ts → express-B5lWuemA.d.ts} +1 -1
- package/dist/{express-CR6F3njD.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 +63 -41
- package/dist/gateway/gateway.js.map +1 -1
- package/dist/gateway/gateway.mjs +63 -41
- 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-Cub7lK-T.d.mts → index-B5k_vUmK.d.mts} +1 -1
- package/dist/{index-BfIxCYIZ.d.ts → index-BOzM6xUq.d.mts} +1 -2
- package/dist/{index-CwAh7Tln.d.mts → index-dRfxUdFA.d.ts} +1 -2
- package/dist/{index-B5Ts1WtM.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 +30 -217
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +30 -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 +22 -7
- package/dist/local-evaluator/evaluator.js.map +1 -1
- package/dist/local-evaluator/evaluator.mjs +22 -7
- package/dist/local-evaluator/evaluator.mjs.map +1 -1
- package/dist/{mcp-BgBJu4Jl.d.mts → mcp-DgsyQiQq.d.mts} +53 -52
- package/dist/{mcp--DgKOwfu.d.ts → mcp-OosmAcKf.d.ts} +53 -52
- package/dist/{nextjs-DlX6xwbU.d.mts → nextjs-B1sBdEav.d.mts} +1 -1
- package/dist/{nextjs-DL6uE1ye.d.ts → nextjs-DoRmhV_Z.d.ts} +1 -1
- package/dist/registration/index.d.mts +5 -1
- package/dist/registration/index.d.ts +5 -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-DwSfO7Sb.d.ts → types-BK2POWNc.d.ts} +23 -50
- package/dist/{types-C0zfSXMB.d.mts → types-CJjZvPr9.d.mts} +23 -50
- package/dist/{types-C7Rb-w0d.d.mts → types-CXf3q4kZ.d.ts} +14 -3
- package/dist/{types-nIh3HtuA.d.ts → types-DQmop7ZW.d.mts} +14 -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 +8 -28
- package/dist/verify.js.map +1 -1
- package/dist/verify.mjs +8 -28
- package/dist/verify.mjs.map +1 -1
- package/package.json +1 -1
- package/dist/sdk-Bbh9B_dw.d.mts +0 -215
- package/dist/sdk-C6SASmsh.d.ts +0 -215
package/dist/edge-core/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// src/version.ts
|
|
2
|
-
var SDK_VERSION = "
|
|
2
|
+
var SDK_VERSION = "5.0.0";
|
|
3
3
|
|
|
4
4
|
// src/http.ts
|
|
5
5
|
var SDK_USER_AGENT = `astrasync-sdk/${SDK_VERSION}`;
|
|
@@ -310,7 +310,7 @@ function detectPlatformFingerprint(input) {
|
|
|
310
310
|
return matchPlatformSignature(PLATFORM_AGENT_SIGNATURES, input);
|
|
311
311
|
}
|
|
312
312
|
|
|
313
|
-
// src/
|
|
313
|
+
// src/trust-levels.ts
|
|
314
314
|
function getTrustLevel(score) {
|
|
315
315
|
if (score >= 80) return "PLATINUM";
|
|
316
316
|
if (score >= 60) return "GOLD";
|
|
@@ -328,11 +328,6 @@ function getCachedWellKnownUrls(apiBaseUrl) {
|
|
|
328
328
|
// src/verify.ts
|
|
329
329
|
var DEFAULT_CONFIG = {
|
|
330
330
|
apiBaseUrl: "https://astrasync.ai/api",
|
|
331
|
-
// v2.3.9 (defect #30): default for unconfigured callers is `'none'` (no
|
|
332
|
-
// access). Pre-rename this defaulted to `'guidance'`, which combined with
|
|
333
|
-
// a route gated at `'guidance'` to silently let unverified traffic
|
|
334
|
-
// through (`hasMinimumAccess('guidance', 'guidance') === true`).
|
|
335
|
-
defaultAccessLevel: "none",
|
|
336
331
|
// minTrustScore + minTrustScoreForFull deprecated in v2.3.0 — server decides.
|
|
337
332
|
// cacheTtl deliberately unset. When undefined, cacheResult applies the 60s
|
|
338
333
|
// default; the caller's explicit value is honoured for cacheable results.
|
|
@@ -527,13 +522,6 @@ function createGuidanceResponse(_config, reason, options = {}) {
|
|
|
527
522
|
// policy is not evaluated (we never reached the gate).
|
|
528
523
|
identityVerified: false,
|
|
529
524
|
policyAllowed: false,
|
|
530
|
-
// v2.3.9 (defect #30): denials grant `'none'`, NEVER a positive band.
|
|
531
|
-
// Adapters additionally short-circuit on `!identityVerified ||
|
|
532
|
-
// !policyAllowed` before the gate check, but the access level still has
|
|
533
|
-
// to be honest at the data layer so downstream consumers (SDK adapters
|
|
534
|
-
// in other languages, custom integrations) inherit the correct
|
|
535
|
-
// semantics.
|
|
536
|
-
accessLevel: "none",
|
|
537
525
|
guidance,
|
|
538
526
|
denialReasons: reason ? [reason] : ["No valid agent credentials provided"],
|
|
539
527
|
// Round-10 (#47, O5): on API-error fallback, surface a typed failure so
|
|
@@ -556,6 +544,11 @@ function createGuidanceResponse(_config, reason, options = {}) {
|
|
|
556
544
|
// 4.0.0: typed marker so adapters render the misconfig envelope (503 +
|
|
557
545
|
// MERCHANT_VERIFICATION_MISCONFIGURED) without string-matching.
|
|
558
546
|
...isMisconfig && { misconfigured: true },
|
|
547
|
+
// 4.6.0: a transient api_error is retryable — mark it so consumers surface
|
|
548
|
+
// "temporarily unavailable, retry" (recommendation 'error') instead of
|
|
549
|
+
// coercing the absent recommendation to a policy 'deny'. Misconfig is
|
|
550
|
+
// deterministic and intentionally NOT marked retryable.
|
|
551
|
+
...isApiError && { retryable: true },
|
|
559
552
|
correlationId: options.correlationId,
|
|
560
553
|
attemptId: options.attemptId,
|
|
561
554
|
verifiedAt: /* @__PURE__ */ new Date()
|
|
@@ -622,7 +615,6 @@ async function callVerifyAccessAPI(config, request) {
|
|
|
622
615
|
attemptId: typeof data?.attemptId === "string" ? data.attemptId : void 0,
|
|
623
616
|
access: {
|
|
624
617
|
allowed: false,
|
|
625
|
-
accessLevel: "none",
|
|
626
618
|
reason: "endpoint_deactivated",
|
|
627
619
|
failures: [
|
|
628
620
|
{
|
|
@@ -685,7 +677,7 @@ async function verify(config, request, options) {
|
|
|
685
677
|
if (!deprecationWarningShown && (config.minTrustScore !== void 0 || config.minTrustScoreForFull !== void 0)) {
|
|
686
678
|
deprecationWarningShown = true;
|
|
687
679
|
console.warn(
|
|
688
|
-
"[VerificationGateway] minTrustScore / minTrustScoreForFull are deprecated in v2.3.0 and have no effect. Server is now the single source of truth for access
|
|
680
|
+
"[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."
|
|
689
681
|
);
|
|
690
682
|
}
|
|
691
683
|
if (mergedConfig.cacheTtl !== 0 && !options?.bypassCache) {
|
|
@@ -731,14 +723,6 @@ async function verify(config, request, options) {
|
|
|
731
723
|
const result2 = {
|
|
732
724
|
identityVerified: idVerifiedFromBackend,
|
|
733
725
|
policyAllowed: false,
|
|
734
|
-
// v2.3.9 (defect #30): denials grant `'none'`, NEVER a positive band.
|
|
735
|
-
// Pre-rename this hardcoded `'guidance'`, which conflated with the
|
|
736
|
-
// colocated `guidance: {...}` help-payload object below and let
|
|
737
|
-
// denied requests pass any route gated at `'guidance'` because
|
|
738
|
-
// `hasMinimumAccess('guidance', 'guidance') === true`. Adapters now
|
|
739
|
-
// ALSO short-circuit on `!identityVerified || !policyAllowed` before
|
|
740
|
-
// the gate check — belt-and-braces.
|
|
741
|
-
accessLevel: "none",
|
|
742
726
|
// 3.6.0: the server now emits top-level denialReasons on every deny
|
|
743
727
|
// path — prefer it verbatim; the failure-message reconstruction remains
|
|
744
728
|
// as the fallback for older backends.
|
|
@@ -787,7 +771,6 @@ async function verify(config, request, options) {
|
|
|
787
771
|
trustScore: apiResponse.organization.trustScore
|
|
788
772
|
} : void 0;
|
|
789
773
|
const verificationContext = apiResponse.verificationContext;
|
|
790
|
-
const accessLevel = apiResponse.access?.accessLevel ?? "standard";
|
|
791
774
|
const result = {
|
|
792
775
|
// 4.5.0 (probe F1): read idVerified from verificationContext with the
|
|
793
776
|
// SAME absent⇒false default as the deny branch. The previous `!== false`
|
|
@@ -799,7 +782,6 @@ async function verify(config, request, options) {
|
|
|
799
782
|
// this load-bearing must never be defaulted on.
|
|
800
783
|
identityVerified: apiResponse.verificationContext?.idVerified === true,
|
|
801
784
|
policyAllowed: true,
|
|
802
|
-
accessLevel,
|
|
803
785
|
agent,
|
|
804
786
|
developer,
|
|
805
787
|
organization,
|
|
@@ -826,7 +808,6 @@ async function verify(config, request, options) {
|
|
|
826
808
|
};
|
|
827
809
|
if (result.recommendation === "deny") {
|
|
828
810
|
result.policyAllowed = false;
|
|
829
|
-
result.accessLevel = "none";
|
|
830
811
|
result.denialReasons = serverDenialReasons ?? result.recommendationReasons ?? ["Access denied by AstraSync recommendation"];
|
|
831
812
|
result.guidance = result.runtimeChallenge ? {
|
|
832
813
|
message: `Verification failed: ${result.runtimeChallenge.reason || "runtime challenge failed"}`,
|
|
@@ -1173,7 +1154,6 @@ var ASAT_HEADERS = {
|
|
|
1173
1154
|
trustScore: "X-AstraSync-Trust-Score",
|
|
1174
1155
|
agentId: "X-AstraSync-Agent-Id",
|
|
1175
1156
|
developerId: "X-AstraSync-Developer-Id",
|
|
1176
|
-
permissions: "X-AstraSync-Permissions",
|
|
1177
1157
|
observedDecision: "X-AstraSync-Observed-Decision"
|
|
1178
1158
|
};
|
|
1179
1159
|
var STRIP_HEADER_PREFIXES = ["x-astrasync-", "x-astra-verified-hop"];
|
|
@@ -1222,12 +1202,11 @@ function applyOutcome(options, outcome, policy) {
|
|
|
1222
1202
|
}
|
|
1223
1203
|
function asatHeaders(outcome) {
|
|
1224
1204
|
if (!outcome.asat) return {};
|
|
1225
|
-
const { trustScore, agentId, developerId
|
|
1205
|
+
const { trustScore, agentId, developerId } = outcome.asat;
|
|
1226
1206
|
return {
|
|
1227
1207
|
...trustScore !== void 0 && { [ASAT_HEADERS.trustScore]: String(trustScore) },
|
|
1228
1208
|
...agentId && { [ASAT_HEADERS.agentId]: agentId },
|
|
1229
|
-
...developerId && { [ASAT_HEADERS.developerId]: developerId }
|
|
1230
|
-
...accessLevel && { [ASAT_HEADERS.permissions]: accessLevel }
|
|
1209
|
+
...developerId && { [ASAT_HEADERS.developerId]: developerId }
|
|
1231
1210
|
};
|
|
1232
1211
|
}
|
|
1233
1212
|
function verifiedHopHeader(outcome) {
|
|
@@ -1435,8 +1414,7 @@ function outcomeFromVerifyResult(classification, result) {
|
|
|
1435
1414
|
outcome.asat = {
|
|
1436
1415
|
trustScore: result.agent?.trustScore,
|
|
1437
1416
|
agentId: result.agent?.astraId,
|
|
1438
|
-
developerId: result.developer?.astradId
|
|
1439
|
-
accessLevel: result.accessLevel
|
|
1417
|
+
developerId: result.developer?.astradId
|
|
1440
1418
|
};
|
|
1441
1419
|
return outcome;
|
|
1442
1420
|
}
|