@astrasyncai/verification-gateway 4.2.1 → 4.4.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 +45 -21
- 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 +145 -21
- package/dist/adapters/express.js.map +1 -1
- package/dist/adapters/express.mjs +145 -21
- package/dist/adapters/express.mjs.map +1 -1
- package/dist/adapters/mcp.d.mts +38 -30
- package/dist/adapters/mcp.d.ts +38 -30
- package/dist/adapters/mcp.js +72 -16
- package/dist/adapters/mcp.js.map +1 -1
- package/dist/adapters/mcp.mjs +72 -16
- 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 +141 -19
- package/dist/adapters/nextjs.js.map +1 -1
- package/dist/adapters/nextjs.mjs +141 -19
- 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 +24 -6
- package/dist/adapters/sdk.js.map +1 -1
- package/dist/adapters/sdk.mjs +24 -6
- 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 +24 -3
- package/dist/agent/index.js.map +1 -1
- package/dist/agent/index.mjs +24 -3
- package/dist/agent/index.mjs.map +1 -1
- package/dist/bin/astrasync-claude-hook.js +22 -4
- package/dist/bin/astrasync-codex-hook.js +22 -4
- package/dist/bin/astrasync-guard.js +26 -8
- package/dist/bin/astrasync.js +76 -23
- package/dist/browser/background.js +22 -4
- package/dist/browser/background.js.map +1 -1
- package/dist/browser/background.mjs +22 -4
- package/dist/browser/background.mjs.map +1 -1
- package/dist/browser/browser-adapter.d.mts +2 -2
- package/dist/browser/browser-adapter.d.ts +2 -2
- package/dist/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 +23 -2
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/index.mjs +23 -2
- 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 +22 -4
- package/dist/codex/index.js.map +1 -1
- package/dist/codex/index.mjs +22 -4
- 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 +22 -4
- package/dist/cursor/extension.js.map +1 -1
- package/dist/cursor/extension.mjs +22 -4
- 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 +24 -1
- package/dist/edge-config.js.map +1 -1
- package/dist/edge-config.mjs +22 -1
- package/dist/edge-config.mjs.map +1 -1
- package/dist/edge-core/index.d.mts +1 -1
- package/dist/edge-core/index.d.ts +1 -1
- package/dist/edge-core/index.js +121 -16
- package/dist/edge-core/index.js.map +1 -1
- package/dist/edge-core/index.mjs +121 -16
- package/dist/edge-core/index.mjs.map +1 -1
- package/dist/{express-D_4hTn5Z.d.mts → express-CR6F3njD.d.mts} +1 -1
- package/dist/{express-BVd1_3FE.d.ts → express-DaqL11tx.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 +22 -4
- package/dist/gateway/gateway.js.map +1 -1
- package/dist/gateway/gateway.mjs +22 -4
- package/dist/gateway/gateway.mjs.map +1 -1
- package/dist/git-trigger/git-hooks.d.mts +2 -2
- package/dist/git-trigger/git-hooks.d.ts +2 -2
- package/dist/{index-BqHKlLOU.d.ts → index-B5Ts1WtM.d.ts} +1 -1
- package/dist/{index-T1aBoUcc.d.ts → index-BfIxCYIZ.d.ts} +1 -1
- package/dist/{index-BTeQ9fgV.d.mts → index-Cub7lK-T.d.mts} +1 -1
- package/dist/{index-DQb5-_1X.d.mts → index-CwAh7Tln.d.mts} +1 -1
- package/dist/index.d.mts +58 -9
- package/dist/index.d.ts +58 -9
- package/dist/index.js +218 -54
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +214 -54
- 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/metadata-capture.d.mts +35 -5
- package/dist/metadata-capture.d.ts +35 -5
- package/dist/metadata-capture.js +44 -6
- package/dist/metadata-capture.js.map +1 -1
- package/dist/metadata-capture.mjs +43 -6
- package/dist/metadata-capture.mjs.map +1 -1
- package/dist/{nextjs-w7RTbP1P.d.ts → nextjs-DL6uE1ye.d.ts} +1 -1
- package/dist/{nextjs-WyeVr2Kp.d.mts → nextjs-DlX6xwbU.d.mts} +1 -1
- package/dist/platform-signatures.d.mts +18 -1
- package/dist/platform-signatures.d.ts +18 -1
- package/dist/platform-signatures.js +35 -2
- package/dist/platform-signatures.js.map +1 -1
- package/dist/platform-signatures.mjs +35 -2
- package/dist/platform-signatures.mjs.map +1 -1
- package/dist/registration/index.js +25 -4
- package/dist/registration/index.js.map +1 -1
- package/dist/registration/index.mjs +25 -4
- package/dist/registration/index.mjs.map +1 -1
- package/dist/{sdk-CbTNIkAa.d.mts → sdk-Bbh9B_dw.d.mts} +1 -1
- package/dist/{sdk-QeX0Z8Ho.d.ts → sdk-C6SASmsh.d.ts} +1 -1
- package/dist/transport/index.d.mts +2 -2
- package/dist/transport/index.d.ts +2 -2
- package/dist/transport/index.js +22 -1
- package/dist/transport/index.js.map +1 -1
- package/dist/transport/index.mjs +22 -1
- package/dist/transport/index.mjs.map +1 -1
- package/dist/{types-r850cOt0.d.mts → types-C0zfSXMB.d.mts} +22 -0
- package/dist/{types-DqfPU5Bl.d.mts → types-C7Rb-w0d.d.mts} +1 -1
- package/dist/{types-sMxBT-nM.d.ts → types-DwSfO7Sb.d.ts} +22 -0
- package/dist/{types-BLUx92FJ.d.ts → types-nIh3HtuA.d.ts} +1 -1
- package/dist/ui/index.d.mts +1 -1
- package/dist/ui/index.d.ts +1 -1
- package/dist/verify.d.mts +1 -1
- package/dist/verify.d.ts +1 -1
- package/dist/verify.js +29 -11
- package/dist/verify.js.map +1 -1
- package/dist/verify.mjs +29 -11
- package/dist/verify.mjs.map +1 -1
- package/package.json +1 -1
|
@@ -897,6 +897,19 @@ interface ExpressMiddlewareOptions extends GatewayConfig {
|
|
|
897
897
|
* disable the beacon and its config fetch entirely.
|
|
898
898
|
*/
|
|
899
899
|
anonymousBeacon?: boolean;
|
|
900
|
+
/**
|
|
901
|
+
* Trust a fresh `X-Astra-Verified-Hop` marker from an upstream AstraSync
|
|
902
|
+
* hop (edge gateway at authenticate/authorize depth, or an MCP outer hop)
|
|
903
|
+
* and skip the duplicate verify-access call when the marker matches the
|
|
904
|
+
* presented `X-Astra-Id` and is within the freshness window. The marker is
|
|
905
|
+
* an UNSIGNED dedupe advisory — enable only when every network path to
|
|
906
|
+
* this middleware crosses a stripping gateway or equivalent trusted
|
|
907
|
+
* boundary. Default false. No `req.agentVerification` is populated on a
|
|
908
|
+
* hop-skip (same contract as the MCP adapter).
|
|
909
|
+
*/
|
|
910
|
+
trustVerifiedHop?: boolean;
|
|
911
|
+
/** Acceptable `X-Astra-Verified-Hop` age in ms (default 60 000). */
|
|
912
|
+
verifiedHopMaxAgeMs?: number;
|
|
900
913
|
}
|
|
901
914
|
/**
|
|
902
915
|
* Next.js middleware options.
|
|
@@ -907,6 +920,15 @@ interface ExpressMiddlewareOptions extends GatewayConfig {
|
|
|
907
920
|
interface NextJsMiddlewareOptions extends GatewayConfig {
|
|
908
921
|
/** Paths to skip verification */
|
|
909
922
|
skipPaths?: string[];
|
|
923
|
+
/**
|
|
924
|
+
* Trust a fresh `X-Astra-Verified-Hop` marker from an upstream AstraSync
|
|
925
|
+
* hop and skip the duplicate verify-access call — see
|
|
926
|
+
* `ExpressMiddlewareOptions.trustVerifiedHop` for the trust model.
|
|
927
|
+
* Default false.
|
|
928
|
+
*/
|
|
929
|
+
trustVerifiedHop?: boolean;
|
|
930
|
+
/** Acceptable `X-Astra-Verified-Hop` age in ms (default 60 000). */
|
|
931
|
+
verifiedHopMaxAgeMs?: number;
|
|
910
932
|
/** Refresh interval (ms) for the remote-fetched route policy. Default: 5 minutes. */
|
|
911
933
|
routesRefreshMs?: number;
|
|
912
934
|
/**
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as AccessLevel, j as CounterpartyType, T as TokenGuidance } from './types-
|
|
1
|
+
import { a as AccessLevel, j as CounterpartyType, T as TokenGuidance } from './types-C0zfSXMB.mjs';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* AstraSync Gateway - Types for gateway modes, local evaluation, and adapter interface.
|
|
@@ -897,6 +897,19 @@ interface ExpressMiddlewareOptions extends GatewayConfig {
|
|
|
897
897
|
* disable the beacon and its config fetch entirely.
|
|
898
898
|
*/
|
|
899
899
|
anonymousBeacon?: boolean;
|
|
900
|
+
/**
|
|
901
|
+
* Trust a fresh `X-Astra-Verified-Hop` marker from an upstream AstraSync
|
|
902
|
+
* hop (edge gateway at authenticate/authorize depth, or an MCP outer hop)
|
|
903
|
+
* and skip the duplicate verify-access call when the marker matches the
|
|
904
|
+
* presented `X-Astra-Id` and is within the freshness window. The marker is
|
|
905
|
+
* an UNSIGNED dedupe advisory — enable only when every network path to
|
|
906
|
+
* this middleware crosses a stripping gateway or equivalent trusted
|
|
907
|
+
* boundary. Default false. No `req.agentVerification` is populated on a
|
|
908
|
+
* hop-skip (same contract as the MCP adapter).
|
|
909
|
+
*/
|
|
910
|
+
trustVerifiedHop?: boolean;
|
|
911
|
+
/** Acceptable `X-Astra-Verified-Hop` age in ms (default 60 000). */
|
|
912
|
+
verifiedHopMaxAgeMs?: number;
|
|
900
913
|
}
|
|
901
914
|
/**
|
|
902
915
|
* Next.js middleware options.
|
|
@@ -907,6 +920,15 @@ interface ExpressMiddlewareOptions extends GatewayConfig {
|
|
|
907
920
|
interface NextJsMiddlewareOptions extends GatewayConfig {
|
|
908
921
|
/** Paths to skip verification */
|
|
909
922
|
skipPaths?: string[];
|
|
923
|
+
/**
|
|
924
|
+
* Trust a fresh `X-Astra-Verified-Hop` marker from an upstream AstraSync
|
|
925
|
+
* hop and skip the duplicate verify-access call — see
|
|
926
|
+
* `ExpressMiddlewareOptions.trustVerifiedHop` for the trust model.
|
|
927
|
+
* Default false.
|
|
928
|
+
*/
|
|
929
|
+
trustVerifiedHop?: boolean;
|
|
930
|
+
/** Acceptable `X-Astra-Verified-Hop` age in ms (default 60 000). */
|
|
931
|
+
verifiedHopMaxAgeMs?: number;
|
|
910
932
|
/** Refresh interval (ms) for the remote-fetched route policy. Default: 5 minutes. */
|
|
911
933
|
routesRefreshMs?: number;
|
|
912
934
|
/**
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as AccessLevel, j as CounterpartyType, T as TokenGuidance } from './types-
|
|
1
|
+
import { a as AccessLevel, j as CounterpartyType, T as TokenGuidance } from './types-DwSfO7Sb.js';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* AstraSync Gateway - Types for gateway modes, local evaluation, and adapter interface.
|
package/dist/ui/index.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { V as VerificationInterstitialProps, x as VerificationResult, b as AgentCredentials, l as GuidanceInfo, v as TrustLevel } from '../types-
|
|
1
|
+
import { V as VerificationInterstitialProps, x as VerificationResult, b as AgentCredentials, l as GuidanceInfo, v as TrustLevel } from '../types-C0zfSXMB.mjs';
|
|
2
2
|
import '../metadata-capture.mjs';
|
|
3
3
|
|
|
4
4
|
/**
|
package/dist/ui/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { V as VerificationInterstitialProps, x as VerificationResult, b as AgentCredentials, l as GuidanceInfo, v as TrustLevel } from '../types-
|
|
1
|
+
import { V as VerificationInterstitialProps, x as VerificationResult, b as AgentCredentials, l as GuidanceInfo, v as TrustLevel } from '../types-DwSfO7Sb.js';
|
|
2
2
|
import '../metadata-capture.js';
|
|
3
3
|
|
|
4
4
|
/**
|
package/dist/verify.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { b as AgentCredentials, G as GatewayConfig, a as AccessLevel, e as AttemptReport, w as VerificationRequest, x as VerificationResult } from './types-
|
|
1
|
+
import { b as AgentCredentials, G as GatewayConfig, a as AccessLevel, e as AttemptReport, w as VerificationRequest, x as VerificationResult } from './types-C0zfSXMB.mjs';
|
|
2
2
|
import { ObservedMetadata } from './metadata-capture.mjs';
|
|
3
3
|
|
|
4
4
|
/**
|
package/dist/verify.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { b as AgentCredentials, G as GatewayConfig, a as AccessLevel, e as AttemptReport, w as VerificationRequest, x as VerificationResult } from './types-
|
|
1
|
+
import { b as AgentCredentials, G as GatewayConfig, a as AccessLevel, e as AttemptReport, w as VerificationRequest, x as VerificationResult } from './types-DwSfO7Sb.js';
|
|
2
2
|
import { ObservedMetadata } from './metadata-capture.js';
|
|
3
3
|
|
|
4
4
|
/**
|
package/dist/verify.js
CHANGED
|
@@ -35,6 +35,27 @@ __export(verify_exports, {
|
|
|
35
35
|
});
|
|
36
36
|
module.exports = __toCommonJS(verify_exports);
|
|
37
37
|
|
|
38
|
+
// src/version.ts
|
|
39
|
+
var SDK_VERSION = "4.4.0";
|
|
40
|
+
|
|
41
|
+
// src/http.ts
|
|
42
|
+
var SDK_USER_AGENT = `astrasync-sdk/${SDK_VERSION}`;
|
|
43
|
+
function withUserAgent(initHeaders) {
|
|
44
|
+
if (!initHeaders) return { "user-agent": SDK_USER_AGENT };
|
|
45
|
+
if (initHeaders instanceof Headers) {
|
|
46
|
+
const copy = new Headers(initHeaders);
|
|
47
|
+
if (!copy.has("user-agent")) copy.set("user-agent", SDK_USER_AGENT);
|
|
48
|
+
return copy;
|
|
49
|
+
}
|
|
50
|
+
if (Array.isArray(initHeaders)) {
|
|
51
|
+
const has2 = initHeaders.some(([name]) => name.toLowerCase() === "user-agent");
|
|
52
|
+
return has2 ? initHeaders : [...initHeaders, ["user-agent", SDK_USER_AGENT]];
|
|
53
|
+
}
|
|
54
|
+
const has = Object.keys(initHeaders).some((name) => name.toLowerCase() === "user-agent");
|
|
55
|
+
return has ? initHeaders : { "user-agent": SDK_USER_AGENT, ...initHeaders };
|
|
56
|
+
}
|
|
57
|
+
var sdkFetch = (input, init) => fetch(input, { ...init, headers: withUserAgent(init?.headers) });
|
|
58
|
+
|
|
38
59
|
// src/access-levels.ts
|
|
39
60
|
function getTrustLevel(score) {
|
|
40
61
|
if (score >= 80) return "PLATINUM";
|
|
@@ -43,9 +64,6 @@ function getTrustLevel(score) {
|
|
|
43
64
|
return "BRONZE";
|
|
44
65
|
}
|
|
45
66
|
|
|
46
|
-
// src/version.ts
|
|
47
|
-
var SDK_VERSION = "4.1.0";
|
|
48
|
-
|
|
49
67
|
// src/well-known.ts
|
|
50
68
|
var CACHE_TTL_MS = 60 * 60 * 1e3;
|
|
51
69
|
var cache = /* @__PURE__ */ new Map();
|
|
@@ -77,7 +95,7 @@ async function performInitCheck(apiBaseUrl, debug, strictInit, apiKey) {
|
|
|
77
95
|
initCheckPerformed = true;
|
|
78
96
|
try {
|
|
79
97
|
const probeUrl = `${apiBaseUrl}/agents/verify-access`;
|
|
80
|
-
const response = await
|
|
98
|
+
const response = await sdkFetch(probeUrl, { method: "HEAD" });
|
|
81
99
|
const contentType = response.headers.get("content-type") ?? "";
|
|
82
100
|
if (contentType.startsWith("text/html")) {
|
|
83
101
|
const message = `[VerificationGateway] apiBaseUrl '${apiBaseUrl}' returned HTML (content-type: ${contentType}). This usually means apiBaseUrl is pointing at a marketing site instead of the API. Expected: 'https://astrasync.ai/api' (prod) or 'https://staging.astrasync.ai/api' (staging).`;
|
|
@@ -91,7 +109,7 @@ async function performInitCheck(apiBaseUrl, debug, strictInit, apiKey) {
|
|
|
91
109
|
);
|
|
92
110
|
}
|
|
93
111
|
if (apiKey) {
|
|
94
|
-
const selfCheck = await
|
|
112
|
+
const selfCheck = await sdkFetch(`${apiBaseUrl}/agents/verify-access/self-check`, {
|
|
95
113
|
headers: { Authorization: `Bearer ${apiKey}` }
|
|
96
114
|
});
|
|
97
115
|
if (selfCheck.status === 401) {
|
|
@@ -344,7 +362,7 @@ async function callVerifyAccessAPI(config, request) {
|
|
|
344
362
|
headers["X-API-Key"] = config.apiKey;
|
|
345
363
|
}
|
|
346
364
|
try {
|
|
347
|
-
const response = await
|
|
365
|
+
const response = await sdkFetch(`${config.apiBaseUrl}/agents/verify-access`, {
|
|
348
366
|
method: "POST",
|
|
349
367
|
headers,
|
|
350
368
|
body: JSON.stringify(body),
|
|
@@ -587,7 +605,7 @@ async function recordDecision(config, sessionId, decision, reason) {
|
|
|
587
605
|
headers["Authorization"] = `Bearer ${config.apiKey}`;
|
|
588
606
|
headers["X-API-Key"] = config.apiKey;
|
|
589
607
|
}
|
|
590
|
-
await
|
|
608
|
+
await sdkFetch(`${config.apiBaseUrl}/agents/verify-access/${sessionId}/decision`, {
|
|
591
609
|
method: "POST",
|
|
592
610
|
headers,
|
|
593
611
|
body: JSON.stringify({ decision, reason })
|
|
@@ -605,7 +623,7 @@ async function reportAttempt(config, report) {
|
|
|
605
623
|
...report,
|
|
606
624
|
...!report.counterpartyId && config.counterpartyId && { counterpartyId: config.counterpartyId }
|
|
607
625
|
};
|
|
608
|
-
await
|
|
626
|
+
await sdkFetch(`${apiBaseUrl}/agents/verify-access/attempt-report`, {
|
|
609
627
|
method: "POST",
|
|
610
628
|
headers,
|
|
611
629
|
body: JSON.stringify(body)
|
|
@@ -620,7 +638,7 @@ async function fetchRoutes(config, counterpartyId) {
|
|
|
620
638
|
headers["X-API-Key"] = config.apiKey;
|
|
621
639
|
}
|
|
622
640
|
try {
|
|
623
|
-
const response = await
|
|
641
|
+
const response = await sdkFetch(
|
|
624
642
|
`${config.apiBaseUrl}/endpoints/${encodeURIComponent(counterpartyId)}/routes`,
|
|
625
643
|
{ method: "GET", headers }
|
|
626
644
|
);
|
|
@@ -654,7 +672,7 @@ async function reportUnregisteredAttempt(config, data) {
|
|
|
654
672
|
...counterpartyUrl && { counterpartyUrl },
|
|
655
673
|
...config.counterpartyId && { counterpartyId: config.counterpartyId }
|
|
656
674
|
};
|
|
657
|
-
await
|
|
675
|
+
await sdkFetch(`${apiBaseUrl}/verification-activity/unregistered-attempt`, {
|
|
658
676
|
method: "POST",
|
|
659
677
|
headers: { "Content-Type": "application/json" },
|
|
660
678
|
body: JSON.stringify(body)
|
|
@@ -663,7 +681,7 @@ async function reportUnregisteredAttempt(config, data) {
|
|
|
663
681
|
}
|
|
664
682
|
async function reportCounterpartyPreCheckFailure(config, data) {
|
|
665
683
|
const apiBaseUrl = config.apiBaseUrl || DEFAULT_CONFIG.apiBaseUrl;
|
|
666
|
-
await
|
|
684
|
+
await sdkFetch(`${apiBaseUrl}/verification-activity/counterparty-pre-check-failure`, {
|
|
667
685
|
method: "POST",
|
|
668
686
|
headers: { "Content-Type": "application/json" },
|
|
669
687
|
body: JSON.stringify(data)
|