@astrasyncai/verification-gateway 4.3.0 → 4.5.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/adapters/express.js +104 -28
- package/dist/adapters/express.js.map +1 -1
- package/dist/adapters/express.mjs +104 -28
- package/dist/adapters/express.mjs.map +1 -1
- package/dist/adapters/mcp.js +63 -21
- package/dist/adapters/mcp.js.map +1 -1
- package/dist/adapters/mcp.mjs +63 -21
- package/dist/adapters/mcp.mjs.map +1 -1
- package/dist/adapters/nextjs.js +103 -27
- package/dist/adapters/nextjs.js.map +1 -1
- package/dist/adapters/nextjs.mjs +103 -27
- package/dist/adapters/nextjs.mjs.map +1 -1
- package/dist/adapters/sdk.js +33 -12
- package/dist/adapters/sdk.js.map +1 -1
- package/dist/adapters/sdk.mjs +33 -12
- package/dist/adapters/sdk.mjs.map +1 -1
- 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 +31 -10
- package/dist/bin/astrasync-codex-hook.js +31 -10
- package/dist/bin/astrasync-guard.js +35 -14
- package/dist/bin/astrasync.js +75 -29
- package/dist/browser/background.js +31 -10
- package/dist/browser/background.js.map +1 -1
- package/dist/browser/background.mjs +31 -10
- package/dist/browser/background.mjs.map +1 -1
- 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.js +31 -10
- package/dist/codex/index.js.map +1 -1
- package/dist/codex/index.mjs +31 -10
- package/dist/codex/index.mjs.map +1 -1
- package/dist/cursor/extension.js +31 -10
- package/dist/cursor/extension.js.map +1 -1
- package/dist/cursor/extension.mjs +31 -10
- package/dist/cursor/extension.mjs.map +1 -1
- package/dist/edge-config.d.mts +11 -4
- package/dist/edge-config.d.ts +11 -4
- 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 +21 -7
- package/dist/edge-core/index.d.ts +21 -7
- package/dist/edge-core/index.js +170 -25
- package/dist/edge-core/index.js.map +1 -1
- package/dist/edge-core/index.mjs +170 -25
- package/dist/edge-core/index.mjs.map +1 -1
- package/dist/gateway/gateway.js +31 -10
- package/dist/gateway/gateway.js.map +1 -1
- package/dist/gateway/gateway.mjs +31 -10
- package/dist/gateway/gateway.mjs.map +1 -1
- package/dist/index.d.mts +51 -2
- package/dist/index.d.ts +51 -2
- package/dist/index.js +169 -40
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +165 -40
- package/dist/index.mjs.map +1 -1
- package/dist/metadata-capture.d.mts +17 -0
- package/dist/metadata-capture.d.ts +17 -0
- package/dist/metadata-capture.js +25 -4
- package/dist/metadata-capture.js.map +1 -1
- package/dist/metadata-capture.mjs +25 -4
- package/dist/metadata-capture.mjs.map +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/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/verify.js +38 -17
- package/dist/verify.js.map +1 -1
- package/dist/verify.mjs +38 -17
- package/dist/verify.mjs.map +1 -1
- package/package.json +2 -2
|
@@ -3701,7 +3701,25 @@ function getTrustLevel(score) {
|
|
|
3701
3701
|
}
|
|
3702
3702
|
|
|
3703
3703
|
// src/version.ts
|
|
3704
|
-
var SDK_VERSION = "4.
|
|
3704
|
+
var SDK_VERSION = "4.5.0";
|
|
3705
|
+
|
|
3706
|
+
// src/http.ts
|
|
3707
|
+
var SDK_USER_AGENT = `astrasync-sdk/${SDK_VERSION}`;
|
|
3708
|
+
function withUserAgent(initHeaders) {
|
|
3709
|
+
if (!initHeaders) return { "user-agent": SDK_USER_AGENT };
|
|
3710
|
+
if (initHeaders instanceof Headers) {
|
|
3711
|
+
const copy = new Headers(initHeaders);
|
|
3712
|
+
if (!copy.has("user-agent")) copy.set("user-agent", SDK_USER_AGENT);
|
|
3713
|
+
return copy;
|
|
3714
|
+
}
|
|
3715
|
+
if (Array.isArray(initHeaders)) {
|
|
3716
|
+
const has2 = initHeaders.some(([name]) => name.toLowerCase() === "user-agent");
|
|
3717
|
+
return has2 ? initHeaders : [...initHeaders, ["user-agent", SDK_USER_AGENT]];
|
|
3718
|
+
}
|
|
3719
|
+
const has = Object.keys(initHeaders).some((name) => name.toLowerCase() === "user-agent");
|
|
3720
|
+
return has ? initHeaders : { "user-agent": SDK_USER_AGENT, ...initHeaders };
|
|
3721
|
+
}
|
|
3722
|
+
var sdkFetch = (input, init) => fetch(input, { ...init, headers: withUserAgent(init?.headers) });
|
|
3705
3723
|
|
|
3706
3724
|
// src/well-known.ts
|
|
3707
3725
|
var CACHE_TTL_MS = 60 * 60 * 1e3;
|
|
@@ -3731,7 +3749,7 @@ async function performInitCheck(apiBaseUrl, debug, strictInit, apiKey) {
|
|
|
3731
3749
|
initCheckPerformed = true;
|
|
3732
3750
|
try {
|
|
3733
3751
|
const probeUrl = `${apiBaseUrl}/agents/verify-access`;
|
|
3734
|
-
const response = await
|
|
3752
|
+
const response = await sdkFetch(probeUrl, { method: "HEAD" });
|
|
3735
3753
|
const contentType = response.headers.get("content-type") ?? "";
|
|
3736
3754
|
if (contentType.startsWith("text/html")) {
|
|
3737
3755
|
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).`;
|
|
@@ -3745,7 +3763,7 @@ async function performInitCheck(apiBaseUrl, debug, strictInit, apiKey) {
|
|
|
3745
3763
|
);
|
|
3746
3764
|
}
|
|
3747
3765
|
if (apiKey) {
|
|
3748
|
-
const selfCheck = await
|
|
3766
|
+
const selfCheck = await sdkFetch(`${apiBaseUrl}/agents/verify-access/self-check`, {
|
|
3749
3767
|
headers: { Authorization: `Bearer ${apiKey}` }
|
|
3750
3768
|
});
|
|
3751
3769
|
if (selfCheck.status === 401) {
|
|
@@ -3958,7 +3976,7 @@ async function callVerifyAccessAPI(config, request) {
|
|
|
3958
3976
|
headers["X-API-Key"] = config.apiKey;
|
|
3959
3977
|
}
|
|
3960
3978
|
try {
|
|
3961
|
-
const response = await
|
|
3979
|
+
const response = await sdkFetch(`${config.apiBaseUrl}/agents/verify-access`, {
|
|
3962
3980
|
method: "POST",
|
|
3963
3981
|
headers,
|
|
3964
3982
|
body: JSON.stringify(body),
|
|
@@ -4140,12 +4158,15 @@ async function verify(config, request, options) {
|
|
|
4140
4158
|
const verificationContext = apiResponse.verificationContext;
|
|
4141
4159
|
const accessLevel = apiResponse.access?.accessLevel ?? "standard";
|
|
4142
4160
|
const result = {
|
|
4143
|
-
//
|
|
4144
|
-
//
|
|
4145
|
-
//
|
|
4146
|
-
//
|
|
4147
|
-
//
|
|
4148
|
-
|
|
4161
|
+
// 4.5.0 (probe F1): read idVerified from verificationContext with the
|
|
4162
|
+
// SAME absent⇒false default as the deny branch. The previous `!== false`
|
|
4163
|
+
// default manufactured `identityVerified: true` for anonymous
|
|
4164
|
+
// allow_full/allow_partial/audit responses (which allow access but omit
|
|
4165
|
+
// verificationContext entirely) — the "anonymous caller labelled
|
|
4166
|
+
// verified" defect. Every authenticated success response has carried
|
|
4167
|
+
// `verificationContext.idVerified: true` since v2.2.4, so a truth claim
|
|
4168
|
+
// this load-bearing must never be defaulted on.
|
|
4169
|
+
identityVerified: apiResponse.verificationContext?.idVerified === true,
|
|
4149
4170
|
policyAllowed: true,
|
|
4150
4171
|
accessLevel,
|
|
4151
4172
|
agent,
|
|
@@ -3700,7 +3700,25 @@ function getTrustLevel(score) {
|
|
|
3700
3700
|
}
|
|
3701
3701
|
|
|
3702
3702
|
// src/version.ts
|
|
3703
|
-
var SDK_VERSION = "4.
|
|
3703
|
+
var SDK_VERSION = "4.5.0";
|
|
3704
|
+
|
|
3705
|
+
// src/http.ts
|
|
3706
|
+
var SDK_USER_AGENT = `astrasync-sdk/${SDK_VERSION}`;
|
|
3707
|
+
function withUserAgent(initHeaders) {
|
|
3708
|
+
if (!initHeaders) return { "user-agent": SDK_USER_AGENT };
|
|
3709
|
+
if (initHeaders instanceof Headers) {
|
|
3710
|
+
const copy = new Headers(initHeaders);
|
|
3711
|
+
if (!copy.has("user-agent")) copy.set("user-agent", SDK_USER_AGENT);
|
|
3712
|
+
return copy;
|
|
3713
|
+
}
|
|
3714
|
+
if (Array.isArray(initHeaders)) {
|
|
3715
|
+
const has2 = initHeaders.some(([name]) => name.toLowerCase() === "user-agent");
|
|
3716
|
+
return has2 ? initHeaders : [...initHeaders, ["user-agent", SDK_USER_AGENT]];
|
|
3717
|
+
}
|
|
3718
|
+
const has = Object.keys(initHeaders).some((name) => name.toLowerCase() === "user-agent");
|
|
3719
|
+
return has ? initHeaders : { "user-agent": SDK_USER_AGENT, ...initHeaders };
|
|
3720
|
+
}
|
|
3721
|
+
var sdkFetch = (input, init) => fetch(input, { ...init, headers: withUserAgent(init?.headers) });
|
|
3704
3722
|
|
|
3705
3723
|
// src/well-known.ts
|
|
3706
3724
|
var CACHE_TTL_MS = 60 * 60 * 1e3;
|
|
@@ -3730,7 +3748,7 @@ async function performInitCheck(apiBaseUrl, debug, strictInit, apiKey) {
|
|
|
3730
3748
|
initCheckPerformed = true;
|
|
3731
3749
|
try {
|
|
3732
3750
|
const probeUrl = `${apiBaseUrl}/agents/verify-access`;
|
|
3733
|
-
const response = await
|
|
3751
|
+
const response = await sdkFetch(probeUrl, { method: "HEAD" });
|
|
3734
3752
|
const contentType = response.headers.get("content-type") ?? "";
|
|
3735
3753
|
if (contentType.startsWith("text/html")) {
|
|
3736
3754
|
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).`;
|
|
@@ -3744,7 +3762,7 @@ async function performInitCheck(apiBaseUrl, debug, strictInit, apiKey) {
|
|
|
3744
3762
|
);
|
|
3745
3763
|
}
|
|
3746
3764
|
if (apiKey) {
|
|
3747
|
-
const selfCheck = await
|
|
3765
|
+
const selfCheck = await sdkFetch(`${apiBaseUrl}/agents/verify-access/self-check`, {
|
|
3748
3766
|
headers: { Authorization: `Bearer ${apiKey}` }
|
|
3749
3767
|
});
|
|
3750
3768
|
if (selfCheck.status === 401) {
|
|
@@ -3957,7 +3975,7 @@ async function callVerifyAccessAPI(config, request) {
|
|
|
3957
3975
|
headers["X-API-Key"] = config.apiKey;
|
|
3958
3976
|
}
|
|
3959
3977
|
try {
|
|
3960
|
-
const response = await
|
|
3978
|
+
const response = await sdkFetch(`${config.apiBaseUrl}/agents/verify-access`, {
|
|
3961
3979
|
method: "POST",
|
|
3962
3980
|
headers,
|
|
3963
3981
|
body: JSON.stringify(body),
|
|
@@ -4139,12 +4157,15 @@ async function verify(config, request, options) {
|
|
|
4139
4157
|
const verificationContext = apiResponse.verificationContext;
|
|
4140
4158
|
const accessLevel = apiResponse.access?.accessLevel ?? "standard";
|
|
4141
4159
|
const result = {
|
|
4142
|
-
//
|
|
4143
|
-
//
|
|
4144
|
-
//
|
|
4145
|
-
//
|
|
4146
|
-
//
|
|
4147
|
-
|
|
4160
|
+
// 4.5.0 (probe F1): read idVerified from verificationContext with the
|
|
4161
|
+
// SAME absent⇒false default as the deny branch. The previous `!== false`
|
|
4162
|
+
// default manufactured `identityVerified: true` for anonymous
|
|
4163
|
+
// allow_full/allow_partial/audit responses (which allow access but omit
|
|
4164
|
+
// verificationContext entirely) — the "anonymous caller labelled
|
|
4165
|
+
// verified" defect. Every authenticated success response has carried
|
|
4166
|
+
// `verificationContext.idVerified: true` since v2.2.4, so a truth claim
|
|
4167
|
+
// this load-bearing must never be defaulted on.
|
|
4168
|
+
identityVerified: apiResponse.verificationContext?.idVerified === true,
|
|
4148
4169
|
policyAllowed: true,
|
|
4149
4170
|
accessLevel,
|
|
4150
4171
|
agent,
|
|
@@ -3677,6 +3677,27 @@ Policy saved to ${outputPath}`);
|
|
|
3677
3677
|
}
|
|
3678
3678
|
};
|
|
3679
3679
|
|
|
3680
|
+
// src/version.ts
|
|
3681
|
+
var SDK_VERSION = "4.5.0";
|
|
3682
|
+
|
|
3683
|
+
// src/http.ts
|
|
3684
|
+
var SDK_USER_AGENT = `astrasync-sdk/${SDK_VERSION}`;
|
|
3685
|
+
function withUserAgent(initHeaders) {
|
|
3686
|
+
if (!initHeaders) return { "user-agent": SDK_USER_AGENT };
|
|
3687
|
+
if (initHeaders instanceof Headers) {
|
|
3688
|
+
const copy = new Headers(initHeaders);
|
|
3689
|
+
if (!copy.has("user-agent")) copy.set("user-agent", SDK_USER_AGENT);
|
|
3690
|
+
return copy;
|
|
3691
|
+
}
|
|
3692
|
+
if (Array.isArray(initHeaders)) {
|
|
3693
|
+
const has2 = initHeaders.some(([name]) => name.toLowerCase() === "user-agent");
|
|
3694
|
+
return has2 ? initHeaders : [...initHeaders, ["user-agent", SDK_USER_AGENT]];
|
|
3695
|
+
}
|
|
3696
|
+
const has = Object.keys(initHeaders).some((name) => name.toLowerCase() === "user-agent");
|
|
3697
|
+
return has ? initHeaders : { "user-agent": SDK_USER_AGENT, ...initHeaders };
|
|
3698
|
+
}
|
|
3699
|
+
var sdkFetch = (input, init) => fetch(input, { ...init, headers: withUserAgent(init?.headers) });
|
|
3700
|
+
|
|
3680
3701
|
// src/cli/upgrade.ts
|
|
3681
3702
|
var UpgradeFlow = class {
|
|
3682
3703
|
constructor(config, callbacks, trigger) {
|
|
@@ -3822,7 +3843,7 @@ var UpgradeFlow = class {
|
|
|
3822
3843
|
*/
|
|
3823
3844
|
async validateApiKey(apiKey) {
|
|
3824
3845
|
try {
|
|
3825
|
-
const response = await
|
|
3846
|
+
const response = await sdkFetch(`${this.platformUrl}/api/v1/auth/me`, {
|
|
3826
3847
|
headers: { Authorization: `Bearer ${apiKey}` }
|
|
3827
3848
|
});
|
|
3828
3849
|
if (!response.ok) {
|
|
@@ -3844,7 +3865,7 @@ var UpgradeFlow = class {
|
|
|
3844
3865
|
async uploadPolicy(apiKey) {
|
|
3845
3866
|
const policyYaml = toYaml(this.config.policy);
|
|
3846
3867
|
try {
|
|
3847
|
-
const response = await
|
|
3868
|
+
const response = await sdkFetch(`${this.platformUrl}/api/v1/agents/policies/upload`, {
|
|
3848
3869
|
method: "POST",
|
|
3849
3870
|
headers: {
|
|
3850
3871
|
"Content-Type": "application/json",
|
|
@@ -4608,9 +4629,6 @@ function getTrustLevel(score) {
|
|
|
4608
4629
|
return "BRONZE";
|
|
4609
4630
|
}
|
|
4610
4631
|
|
|
4611
|
-
// src/version.ts
|
|
4612
|
-
var SDK_VERSION = "4.1.0";
|
|
4613
|
-
|
|
4614
4632
|
// src/well-known.ts
|
|
4615
4633
|
var CACHE_TTL_MS = 60 * 60 * 1e3;
|
|
4616
4634
|
var cache = /* @__PURE__ */ new Map();
|
|
@@ -4639,7 +4657,7 @@ async function performInitCheck(apiBaseUrl, debug, strictInit, apiKey) {
|
|
|
4639
4657
|
initCheckPerformed = true;
|
|
4640
4658
|
try {
|
|
4641
4659
|
const probeUrl = `${apiBaseUrl}/agents/verify-access`;
|
|
4642
|
-
const response = await
|
|
4660
|
+
const response = await sdkFetch(probeUrl, { method: "HEAD" });
|
|
4643
4661
|
const contentType = response.headers.get("content-type") ?? "";
|
|
4644
4662
|
if (contentType.startsWith("text/html")) {
|
|
4645
4663
|
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).`;
|
|
@@ -4653,7 +4671,7 @@ async function performInitCheck(apiBaseUrl, debug, strictInit, apiKey) {
|
|
|
4653
4671
|
);
|
|
4654
4672
|
}
|
|
4655
4673
|
if (apiKey) {
|
|
4656
|
-
const selfCheck = await
|
|
4674
|
+
const selfCheck = await sdkFetch(`${apiBaseUrl}/agents/verify-access/self-check`, {
|
|
4657
4675
|
headers: { Authorization: `Bearer ${apiKey}` }
|
|
4658
4676
|
});
|
|
4659
4677
|
if (selfCheck.status === 401) {
|
|
@@ -4866,7 +4884,7 @@ async function callVerifyAccessAPI(config, request2) {
|
|
|
4866
4884
|
headers["X-API-Key"] = config.apiKey;
|
|
4867
4885
|
}
|
|
4868
4886
|
try {
|
|
4869
|
-
const response = await
|
|
4887
|
+
const response = await sdkFetch(`${config.apiBaseUrl}/agents/verify-access`, {
|
|
4870
4888
|
method: "POST",
|
|
4871
4889
|
headers,
|
|
4872
4890
|
body: JSON.stringify(body),
|
|
@@ -5048,12 +5066,15 @@ async function verify(config, request2, options) {
|
|
|
5048
5066
|
const verificationContext = apiResponse.verificationContext;
|
|
5049
5067
|
const accessLevel = apiResponse.access?.accessLevel ?? "standard";
|
|
5050
5068
|
const result = {
|
|
5051
|
-
//
|
|
5052
|
-
//
|
|
5053
|
-
//
|
|
5054
|
-
//
|
|
5055
|
-
//
|
|
5056
|
-
|
|
5069
|
+
// 4.5.0 (probe F1): read idVerified from verificationContext with the
|
|
5070
|
+
// SAME absent⇒false default as the deny branch. The previous `!== false`
|
|
5071
|
+
// default manufactured `identityVerified: true` for anonymous
|
|
5072
|
+
// allow_full/allow_partial/audit responses (which allow access but omit
|
|
5073
|
+
// verificationContext entirely) — the "anonymous caller labelled
|
|
5074
|
+
// verified" defect. Every authenticated success response has carried
|
|
5075
|
+
// `verificationContext.idVerified: true` since v2.2.4, so a truth claim
|
|
5076
|
+
// this load-bearing must never be defaulted on.
|
|
5077
|
+
identityVerified: apiResponse.verificationContext?.idVerified === true,
|
|
5057
5078
|
policyAllowed: true,
|
|
5058
5079
|
accessLevel,
|
|
5059
5080
|
agent,
|
package/dist/bin/astrasync.js
CHANGED
|
@@ -26,6 +26,40 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
26
26
|
mod
|
|
27
27
|
));
|
|
28
28
|
|
|
29
|
+
// src/version.ts
|
|
30
|
+
var SDK_VERSION;
|
|
31
|
+
var init_version = __esm({
|
|
32
|
+
"src/version.ts"() {
|
|
33
|
+
"use strict";
|
|
34
|
+
SDK_VERSION = "4.5.0";
|
|
35
|
+
}
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
// src/http.ts
|
|
39
|
+
function withUserAgent(initHeaders) {
|
|
40
|
+
if (!initHeaders) return { "user-agent": SDK_USER_AGENT };
|
|
41
|
+
if (initHeaders instanceof Headers) {
|
|
42
|
+
const copy = new Headers(initHeaders);
|
|
43
|
+
if (!copy.has("user-agent")) copy.set("user-agent", SDK_USER_AGENT);
|
|
44
|
+
return copy;
|
|
45
|
+
}
|
|
46
|
+
if (Array.isArray(initHeaders)) {
|
|
47
|
+
const has2 = initHeaders.some(([name]) => name.toLowerCase() === "user-agent");
|
|
48
|
+
return has2 ? initHeaders : [...initHeaders, ["user-agent", SDK_USER_AGENT]];
|
|
49
|
+
}
|
|
50
|
+
const has = Object.keys(initHeaders).some((name) => name.toLowerCase() === "user-agent");
|
|
51
|
+
return has ? initHeaders : { "user-agent": SDK_USER_AGENT, ...initHeaders };
|
|
52
|
+
}
|
|
53
|
+
var SDK_USER_AGENT, sdkFetch;
|
|
54
|
+
var init_http = __esm({
|
|
55
|
+
"src/http.ts"() {
|
|
56
|
+
"use strict";
|
|
57
|
+
init_version();
|
|
58
|
+
SDK_USER_AGENT = `astrasync-sdk/${SDK_VERSION}`;
|
|
59
|
+
sdkFetch = (input, init) => fetch(input, { ...init, headers: withUserAgent(init?.headers) });
|
|
60
|
+
}
|
|
61
|
+
});
|
|
62
|
+
|
|
29
63
|
// src/registration/errors.ts
|
|
30
64
|
var AstraSyncError, KYDRequiredError, AuthenticationError, RegistrationDeniedError, RegistrationExpiredError, RegistrationTimeoutError;
|
|
31
65
|
var init_errors = __esm({
|
|
@@ -101,6 +135,7 @@ var DEFAULT_BASE_URL, sleep, AstraSync;
|
|
|
101
135
|
var init_api = __esm({
|
|
102
136
|
"src/registration/api.ts"() {
|
|
103
137
|
"use strict";
|
|
138
|
+
init_http();
|
|
104
139
|
init_errors();
|
|
105
140
|
DEFAULT_BASE_URL = "https://astrasync.ai";
|
|
106
141
|
sleep = (ms) => new Promise((r) => setTimeout(r, ms));
|
|
@@ -222,7 +257,7 @@ var init_api = __esm({
|
|
|
222
257
|
*/
|
|
223
258
|
async pollRegistration(requestId) {
|
|
224
259
|
const url = `${this.baseUrl}/api/agents/request-registration/${requestId}`;
|
|
225
|
-
const res = await
|
|
260
|
+
const res = await sdkFetch(url, { headers: { Accept: "application/json" } });
|
|
226
261
|
if (!res.ok) {
|
|
227
262
|
const errBody = await res.json().catch(() => ({}));
|
|
228
263
|
throw new AstraSyncError(
|
|
@@ -279,7 +314,7 @@ var init_api = __esm({
|
|
|
279
314
|
* Check API health.
|
|
280
315
|
*/
|
|
281
316
|
async health() {
|
|
282
|
-
const res = await
|
|
317
|
+
const res = await sdkFetch(`${this.baseUrl}/api/health/`);
|
|
283
318
|
if (!res.ok) {
|
|
284
319
|
throw new AstraSyncError(`Health check failed: ${res.status}`, res.status);
|
|
285
320
|
}
|
|
@@ -306,7 +341,7 @@ var init_api = __esm({
|
|
|
306
341
|
const signature = await this.signRequest(method, endpoint, body || {});
|
|
307
342
|
headers["X-AstraSync-Signature"] = signature;
|
|
308
343
|
}
|
|
309
|
-
const res = await
|
|
344
|
+
const res = await sdkFetch(url, {
|
|
310
345
|
method,
|
|
311
346
|
headers,
|
|
312
347
|
...body ? { body: JSON.stringify(body) } : {}
|
|
@@ -331,7 +366,7 @@ var init_api = __esm({
|
|
|
331
366
|
if (this.cachedJwt && this.jwtExpiresAt && Date.now() < this.jwtExpiresAt) {
|
|
332
367
|
return this.cachedJwt;
|
|
333
368
|
}
|
|
334
|
-
const res = await
|
|
369
|
+
const res = await sdkFetch(`${this.baseUrl}/api/auth/login`, {
|
|
335
370
|
method: "POST",
|
|
336
371
|
headers: { "Content-Type": "application/json" },
|
|
337
372
|
body: JSON.stringify({ email: this.email, password: this.password })
|
|
@@ -4019,6 +4054,7 @@ var UpgradeFlow;
|
|
|
4019
4054
|
var init_upgrade = __esm({
|
|
4020
4055
|
"src/cli/upgrade.ts"() {
|
|
4021
4056
|
"use strict";
|
|
4057
|
+
init_http();
|
|
4022
4058
|
init_pdlss_parser();
|
|
4023
4059
|
UpgradeFlow = class {
|
|
4024
4060
|
constructor(config, callbacks, trigger) {
|
|
@@ -4164,7 +4200,7 @@ var init_upgrade = __esm({
|
|
|
4164
4200
|
*/
|
|
4165
4201
|
async validateApiKey(apiKey) {
|
|
4166
4202
|
try {
|
|
4167
|
-
const response = await
|
|
4203
|
+
const response = await sdkFetch(`${this.platformUrl}/api/v1/auth/me`, {
|
|
4168
4204
|
headers: { Authorization: `Bearer ${apiKey}` }
|
|
4169
4205
|
});
|
|
4170
4206
|
if (!response.ok) {
|
|
@@ -4186,7 +4222,7 @@ var init_upgrade = __esm({
|
|
|
4186
4222
|
async uploadPolicy(apiKey) {
|
|
4187
4223
|
const policyYaml = toYaml(this.config.policy);
|
|
4188
4224
|
try {
|
|
4189
|
-
const response = await
|
|
4225
|
+
const response = await sdkFetch(`${this.platformUrl}/api/v1/agents/policies/upload`, {
|
|
4190
4226
|
method: "POST",
|
|
4191
4227
|
headers: {
|
|
4192
4228
|
"Content-Type": "application/json",
|
|
@@ -4995,15 +5031,6 @@ var init_access_levels = __esm({
|
|
|
4995
5031
|
}
|
|
4996
5032
|
});
|
|
4997
5033
|
|
|
4998
|
-
// src/version.ts
|
|
4999
|
-
var SDK_VERSION;
|
|
5000
|
-
var init_version = __esm({
|
|
5001
|
-
"src/version.ts"() {
|
|
5002
|
-
"use strict";
|
|
5003
|
-
SDK_VERSION = "4.1.0";
|
|
5004
|
-
}
|
|
5005
|
-
});
|
|
5006
|
-
|
|
5007
5034
|
// src/well-known.ts
|
|
5008
5035
|
function getCachedWellKnownUrls(apiBaseUrl) {
|
|
5009
5036
|
return cache.get(apiBaseUrl)?.data;
|
|
@@ -5012,6 +5039,7 @@ var CACHE_TTL_MS, cache;
|
|
|
5012
5039
|
var init_well_known = __esm({
|
|
5013
5040
|
"src/well-known.ts"() {
|
|
5014
5041
|
"use strict";
|
|
5042
|
+
init_http();
|
|
5015
5043
|
CACHE_TTL_MS = 60 * 60 * 1e3;
|
|
5016
5044
|
cache = /* @__PURE__ */ new Map();
|
|
5017
5045
|
}
|
|
@@ -5022,7 +5050,7 @@ async function performInitCheck(apiBaseUrl, debug, strictInit, apiKey) {
|
|
|
5022
5050
|
initCheckPerformed = true;
|
|
5023
5051
|
try {
|
|
5024
5052
|
const probeUrl = `${apiBaseUrl}/agents/verify-access`;
|
|
5025
|
-
const response = await
|
|
5053
|
+
const response = await sdkFetch(probeUrl, { method: "HEAD" });
|
|
5026
5054
|
const contentType = response.headers.get("content-type") ?? "";
|
|
5027
5055
|
if (contentType.startsWith("text/html")) {
|
|
5028
5056
|
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).`;
|
|
@@ -5036,7 +5064,7 @@ async function performInitCheck(apiBaseUrl, debug, strictInit, apiKey) {
|
|
|
5036
5064
|
);
|
|
5037
5065
|
}
|
|
5038
5066
|
if (apiKey) {
|
|
5039
|
-
const selfCheck = await
|
|
5067
|
+
const selfCheck = await sdkFetch(`${apiBaseUrl}/agents/verify-access/self-check`, {
|
|
5040
5068
|
headers: { Authorization: `Bearer ${apiKey}` }
|
|
5041
5069
|
});
|
|
5042
5070
|
if (selfCheck.status === 401) {
|
|
@@ -5247,7 +5275,7 @@ async function callVerifyAccessAPI(config, request2) {
|
|
|
5247
5275
|
headers["X-API-Key"] = config.apiKey;
|
|
5248
5276
|
}
|
|
5249
5277
|
try {
|
|
5250
|
-
const response = await
|
|
5278
|
+
const response = await sdkFetch(`${config.apiBaseUrl}/agents/verify-access`, {
|
|
5251
5279
|
method: "POST",
|
|
5252
5280
|
headers,
|
|
5253
5281
|
body: JSON.stringify(body),
|
|
@@ -5429,12 +5457,15 @@ async function verify(config, request2, options) {
|
|
|
5429
5457
|
const verificationContext = apiResponse.verificationContext;
|
|
5430
5458
|
const accessLevel = apiResponse.access?.accessLevel ?? "standard";
|
|
5431
5459
|
const result = {
|
|
5432
|
-
//
|
|
5433
|
-
//
|
|
5434
|
-
//
|
|
5435
|
-
//
|
|
5436
|
-
//
|
|
5437
|
-
|
|
5460
|
+
// 4.5.0 (probe F1): read idVerified from verificationContext with the
|
|
5461
|
+
// SAME absent⇒false default as the deny branch. The previous `!== false`
|
|
5462
|
+
// default manufactured `identityVerified: true` for anonymous
|
|
5463
|
+
// allow_full/allow_partial/audit responses (which allow access but omit
|
|
5464
|
+
// verificationContext entirely) — the "anonymous caller labelled
|
|
5465
|
+
// verified" defect. Every authenticated success response has carried
|
|
5466
|
+
// `verificationContext.idVerified: true` since v2.2.4, so a truth claim
|
|
5467
|
+
// this load-bearing must never be defaulted on.
|
|
5468
|
+
identityVerified: apiResponse.verificationContext?.idVerified === true,
|
|
5438
5469
|
policyAllowed: true,
|
|
5439
5470
|
accessLevel,
|
|
5440
5471
|
agent,
|
|
@@ -5488,6 +5519,7 @@ var DEFAULT_CONFIG, initCheckPerformed, deprecationWarningShown, verificationCac
|
|
|
5488
5519
|
var init_verify = __esm({
|
|
5489
5520
|
"src/verify.ts"() {
|
|
5490
5521
|
"use strict";
|
|
5522
|
+
init_http();
|
|
5491
5523
|
init_access_levels();
|
|
5492
5524
|
init_version();
|
|
5493
5525
|
init_well_known();
|
|
@@ -5517,6 +5549,7 @@ var FALLBACK_MAX_WAIT_MS;
|
|
|
5517
5549
|
var init_stepup_poll = __esm({
|
|
5518
5550
|
"src/adapters/stepup-poll.ts"() {
|
|
5519
5551
|
"use strict";
|
|
5552
|
+
init_http();
|
|
5520
5553
|
FALLBACK_MAX_WAIT_MS = 5 * 60 * 1e3;
|
|
5521
5554
|
}
|
|
5522
5555
|
});
|
|
@@ -5538,7 +5571,7 @@ var init_settlement = __esm({
|
|
|
5538
5571
|
});
|
|
5539
5572
|
|
|
5540
5573
|
// src/transport/http.ts
|
|
5541
|
-
var
|
|
5574
|
+
var init_http2 = __esm({
|
|
5542
5575
|
"src/transport/http.ts"() {
|
|
5543
5576
|
"use strict";
|
|
5544
5577
|
}
|
|
@@ -5579,6 +5612,7 @@ var DEFAULT_EDGE_CONFIG, DEFAULT_TTL_MS, DEFAULT_MAX_STALE_MS;
|
|
|
5579
5612
|
var init_edge_config = __esm({
|
|
5580
5613
|
"src/edge-config.ts"() {
|
|
5581
5614
|
"use strict";
|
|
5615
|
+
init_http();
|
|
5582
5616
|
DEFAULT_EDGE_CONFIG = Object.freeze({
|
|
5583
5617
|
version: 1,
|
|
5584
5618
|
mode: "observe",
|
|
@@ -5657,7 +5691,7 @@ var init_express = __esm({
|
|
|
5657
5691
|
"use strict";
|
|
5658
5692
|
init_stepup_poll();
|
|
5659
5693
|
init_verify();
|
|
5660
|
-
|
|
5694
|
+
init_http2();
|
|
5661
5695
|
init_verified_hop();
|
|
5662
5696
|
init_http_pdlss();
|
|
5663
5697
|
init_approval_gate();
|
|
@@ -5676,7 +5710,7 @@ var init_nextjs = __esm({
|
|
|
5676
5710
|
"use strict";
|
|
5677
5711
|
init_stepup_poll();
|
|
5678
5712
|
init_verify();
|
|
5679
|
-
|
|
5713
|
+
init_http2();
|
|
5680
5714
|
init_pdlss_pre_check();
|
|
5681
5715
|
init_metadata_capture();
|
|
5682
5716
|
init_anonymous_beacon();
|
|
@@ -5782,6 +5816,7 @@ var init_rfc9421_verify = __esm({
|
|
|
5782
5816
|
var init_ucp = __esm({
|
|
5783
5817
|
"src/transport/ucp.ts"() {
|
|
5784
5818
|
"use strict";
|
|
5819
|
+
init_http();
|
|
5785
5820
|
init_purpose_mapping2();
|
|
5786
5821
|
}
|
|
5787
5822
|
});
|
|
@@ -5950,10 +5985,10 @@ var init_web_bot_auth = __esm({
|
|
|
5950
5985
|
var init_transport = __esm({
|
|
5951
5986
|
"src/transport/index.ts"() {
|
|
5952
5987
|
"use strict";
|
|
5953
|
-
|
|
5988
|
+
init_http2();
|
|
5954
5989
|
init_a2a();
|
|
5955
5990
|
init_mcp();
|
|
5956
|
-
|
|
5991
|
+
init_http2();
|
|
5957
5992
|
init_a2a();
|
|
5958
5993
|
init_mcp();
|
|
5959
5994
|
init_purpose_mapping2();
|
|
@@ -6032,6 +6067,7 @@ var init_client = __esm({
|
|
|
6032
6067
|
"src/agent/client.ts"() {
|
|
6033
6068
|
"use strict";
|
|
6034
6069
|
init_http();
|
|
6070
|
+
init_http2();
|
|
6035
6071
|
init_a2a();
|
|
6036
6072
|
init_mcp();
|
|
6037
6073
|
init_transport();
|
|
@@ -6057,6 +6093,7 @@ var init_pdlss_formatter = __esm({
|
|
|
6057
6093
|
var init_decision_client = __esm({
|
|
6058
6094
|
"src/agent/decision-client.ts"() {
|
|
6059
6095
|
"use strict";
|
|
6096
|
+
init_http();
|
|
6060
6097
|
}
|
|
6061
6098
|
});
|
|
6062
6099
|
|
|
@@ -6072,6 +6109,13 @@ var init_agent = __esm({
|
|
|
6072
6109
|
}
|
|
6073
6110
|
});
|
|
6074
6111
|
|
|
6112
|
+
// src/runtime-signatures.ts
|
|
6113
|
+
var init_runtime_signatures = __esm({
|
|
6114
|
+
"src/runtime-signatures.ts"() {
|
|
6115
|
+
"use strict";
|
|
6116
|
+
}
|
|
6117
|
+
});
|
|
6118
|
+
|
|
6075
6119
|
// src/index.ts
|
|
6076
6120
|
var init_src = __esm({
|
|
6077
6121
|
"src/index.ts"() {
|
|
@@ -6097,6 +6141,8 @@ var init_src = __esm({
|
|
|
6097
6141
|
init_verify();
|
|
6098
6142
|
init_verify();
|
|
6099
6143
|
init_metadata_capture();
|
|
6144
|
+
init_runtime_signatures();
|
|
6145
|
+
init_http();
|
|
6100
6146
|
init_version();
|
|
6101
6147
|
}
|
|
6102
6148
|
});
|
|
@@ -3938,7 +3938,25 @@ function getTrustLevel(score) {
|
|
|
3938
3938
|
}
|
|
3939
3939
|
|
|
3940
3940
|
// src/version.ts
|
|
3941
|
-
var SDK_VERSION = "4.
|
|
3941
|
+
var SDK_VERSION = "4.5.0";
|
|
3942
|
+
|
|
3943
|
+
// src/http.ts
|
|
3944
|
+
var SDK_USER_AGENT = `astrasync-sdk/${SDK_VERSION}`;
|
|
3945
|
+
function withUserAgent(initHeaders) {
|
|
3946
|
+
if (!initHeaders) return { "user-agent": SDK_USER_AGENT };
|
|
3947
|
+
if (initHeaders instanceof Headers) {
|
|
3948
|
+
const copy = new Headers(initHeaders);
|
|
3949
|
+
if (!copy.has("user-agent")) copy.set("user-agent", SDK_USER_AGENT);
|
|
3950
|
+
return copy;
|
|
3951
|
+
}
|
|
3952
|
+
if (Array.isArray(initHeaders)) {
|
|
3953
|
+
const has2 = initHeaders.some(([name]) => name.toLowerCase() === "user-agent");
|
|
3954
|
+
return has2 ? initHeaders : [...initHeaders, ["user-agent", SDK_USER_AGENT]];
|
|
3955
|
+
}
|
|
3956
|
+
const has = Object.keys(initHeaders).some((name) => name.toLowerCase() === "user-agent");
|
|
3957
|
+
return has ? initHeaders : { "user-agent": SDK_USER_AGENT, ...initHeaders };
|
|
3958
|
+
}
|
|
3959
|
+
var sdkFetch = (input, init) => fetch(input, { ...init, headers: withUserAgent(init?.headers) });
|
|
3942
3960
|
|
|
3943
3961
|
// src/well-known.ts
|
|
3944
3962
|
var CACHE_TTL_MS = 60 * 60 * 1e3;
|
|
@@ -3968,7 +3986,7 @@ async function performInitCheck(apiBaseUrl, debug, strictInit, apiKey) {
|
|
|
3968
3986
|
initCheckPerformed = true;
|
|
3969
3987
|
try {
|
|
3970
3988
|
const probeUrl = `${apiBaseUrl}/agents/verify-access`;
|
|
3971
|
-
const response = await
|
|
3989
|
+
const response = await sdkFetch(probeUrl, { method: "HEAD" });
|
|
3972
3990
|
const contentType = response.headers.get("content-type") ?? "";
|
|
3973
3991
|
if (contentType.startsWith("text/html")) {
|
|
3974
3992
|
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).`;
|
|
@@ -3982,7 +4000,7 @@ async function performInitCheck(apiBaseUrl, debug, strictInit, apiKey) {
|
|
|
3982
4000
|
);
|
|
3983
4001
|
}
|
|
3984
4002
|
if (apiKey) {
|
|
3985
|
-
const selfCheck = await
|
|
4003
|
+
const selfCheck = await sdkFetch(`${apiBaseUrl}/agents/verify-access/self-check`, {
|
|
3986
4004
|
headers: { Authorization: `Bearer ${apiKey}` }
|
|
3987
4005
|
});
|
|
3988
4006
|
if (selfCheck.status === 401) {
|
|
@@ -4195,7 +4213,7 @@ async function callVerifyAccessAPI(config, request) {
|
|
|
4195
4213
|
headers["X-API-Key"] = config.apiKey;
|
|
4196
4214
|
}
|
|
4197
4215
|
try {
|
|
4198
|
-
const response = await
|
|
4216
|
+
const response = await sdkFetch(`${config.apiBaseUrl}/agents/verify-access`, {
|
|
4199
4217
|
method: "POST",
|
|
4200
4218
|
headers,
|
|
4201
4219
|
body: JSON.stringify(body),
|
|
@@ -4377,12 +4395,15 @@ async function verify(config, request, options) {
|
|
|
4377
4395
|
const verificationContext = apiResponse.verificationContext;
|
|
4378
4396
|
const accessLevel = apiResponse.access?.accessLevel ?? "standard";
|
|
4379
4397
|
const result = {
|
|
4380
|
-
//
|
|
4381
|
-
//
|
|
4382
|
-
//
|
|
4383
|
-
//
|
|
4384
|
-
//
|
|
4385
|
-
|
|
4398
|
+
// 4.5.0 (probe F1): read idVerified from verificationContext with the
|
|
4399
|
+
// SAME absent⇒false default as the deny branch. The previous `!== false`
|
|
4400
|
+
// default manufactured `identityVerified: true` for anonymous
|
|
4401
|
+
// allow_full/allow_partial/audit responses (which allow access but omit
|
|
4402
|
+
// verificationContext entirely) — the "anonymous caller labelled
|
|
4403
|
+
// verified" defect. Every authenticated success response has carried
|
|
4404
|
+
// `verificationContext.idVerified: true` since v2.2.4, so a truth claim
|
|
4405
|
+
// this load-bearing must never be defaulted on.
|
|
4406
|
+
identityVerified: apiResponse.verificationContext?.idVerified === true,
|
|
4386
4407
|
policyAllowed: true,
|
|
4387
4408
|
accessLevel,
|
|
4388
4409
|
agent,
|