@astrasyncai/verification-gateway 5.12.0 → 5.14.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 +63 -19
- package/dist/adapters/express.js.map +1 -1
- package/dist/adapters/express.mjs +63 -19
- package/dist/adapters/express.mjs.map +1 -1
- package/dist/adapters/mcp.js +26 -9
- package/dist/adapters/mcp.js.map +1 -1
- package/dist/adapters/mcp.mjs +26 -9
- package/dist/adapters/mcp.mjs.map +1 -1
- package/dist/adapters/nextjs.js +63 -19
- package/dist/adapters/nextjs.js.map +1 -1
- package/dist/adapters/nextjs.mjs +63 -19
- package/dist/adapters/nextjs.mjs.map +1 -1
- package/dist/adapters/sdk.js +26 -9
- package/dist/adapters/sdk.js.map +1 -1
- package/dist/adapters/sdk.mjs +26 -9
- package/dist/adapters/sdk.mjs.map +1 -1
- 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 +53 -18
- package/dist/bin/astrasync-codex-hook.js +53 -18
- package/dist/bin/astrasync-guard.js +53 -18
- package/dist/bin/astrasync.js +54 -19
- package/dist/browser/background.js +53 -18
- package/dist/browser/background.js.map +1 -1
- package/dist/browser/background.mjs +53 -18
- package/dist/browser/background.mjs.map +1 -1
- 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.js +53 -18
- package/dist/codex/index.js.map +1 -1
- package/dist/codex/index.mjs +53 -18
- package/dist/codex/index.mjs.map +1 -1
- package/dist/cursor/extension.js +53 -18
- package/dist/cursor/extension.js.map +1 -1
- package/dist/cursor/extension.mjs +53 -18
- package/dist/cursor/extension.mjs.map +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 +32 -4
- package/dist/edge-core/index.d.ts +32 -4
- package/dist/edge-core/index.js +53 -18
- package/dist/edge-core/index.js.map +1 -1
- package/dist/edge-core/index.mjs +53 -18
- package/dist/edge-core/index.mjs.map +1 -1
- package/dist/gateway/gateway.js +53 -18
- package/dist/gateway/gateway.js.map +1 -1
- package/dist/gateway/gateway.mjs +53 -18
- package/dist/gateway/gateway.mjs.map +1 -1
- package/dist/index.d.mts +2 -12
- package/dist/index.d.ts +2 -12
- package/dist/index.js +63 -19
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +63 -19
- package/dist/index.mjs.map +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/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/verify.d.mts +0 -10
- package/dist/verify.d.ts +0 -10
- package/dist/verify.js +36 -10
- package/dist/verify.js.map +1 -1
- package/dist/verify.mjs +36 -10
- package/dist/verify.mjs.map +1 -1
- package/package.json +3 -2
package/dist/adapters/mcp.js
CHANGED
|
@@ -32,7 +32,7 @@ __export(mcp_exports, {
|
|
|
32
32
|
module.exports = __toCommonJS(mcp_exports);
|
|
33
33
|
|
|
34
34
|
// src/version.ts
|
|
35
|
-
var SDK_VERSION = "5.
|
|
35
|
+
var SDK_VERSION = "5.14.0";
|
|
36
36
|
|
|
37
37
|
// src/http.ts
|
|
38
38
|
var SDK_USER_AGENT = `astrasync-sdk/${SDK_VERSION}`;
|
|
@@ -166,7 +166,7 @@ var DEFAULT_CONFIG = {
|
|
|
166
166
|
};
|
|
167
167
|
var initCheckPerformed = false;
|
|
168
168
|
var deprecationWarningShown = false;
|
|
169
|
-
async function performInitCheck(apiBaseUrl, debug, strictInit, apiKey) {
|
|
169
|
+
async function performInitCheck(apiBaseUrl, debug, strictInit, apiKey, counterparty) {
|
|
170
170
|
initCheckPerformed = true;
|
|
171
171
|
try {
|
|
172
172
|
const probeUrl = `${apiBaseUrl}/agents/verify-access`;
|
|
@@ -184,7 +184,8 @@ async function performInitCheck(apiBaseUrl, debug, strictInit, apiKey) {
|
|
|
184
184
|
);
|
|
185
185
|
}
|
|
186
186
|
if (apiKey) {
|
|
187
|
-
const
|
|
187
|
+
const q = counterparty?.id ? `?counterpartyId=${encodeURIComponent(counterparty.id)}` : counterparty?.url ? `?counterpartyUrl=${encodeURIComponent(counterparty.url)}` : "";
|
|
188
|
+
const selfCheck = await sdkFetch(`${apiBaseUrl}/agents/verify-access/self-check${q}`, {
|
|
188
189
|
headers: { Authorization: `Bearer ${apiKey}` }
|
|
189
190
|
});
|
|
190
191
|
if (selfCheck.status === 401) {
|
|
@@ -196,6 +197,13 @@ async function performInitCheck(apiBaseUrl, debug, strictInit, apiKey) {
|
|
|
196
197
|
console.error(message);
|
|
197
198
|
} else if (selfCheck.ok) {
|
|
198
199
|
const body = await selfCheck.json().catch(() => ({}));
|
|
200
|
+
if (body.counterparty && body.counterparty.canVerify === false) {
|
|
201
|
+
const message = `[VerificationGateway] the configured AstraSync API key cannot verify for this endpoint (${body.counterparty.message ?? "endpoint not found or owned by another account"}). Every inbound agent will be turned away until the key or counterparty is corrected.`;
|
|
202
|
+
if (strictInit) {
|
|
203
|
+
throw new Error(`${message} (strictInit=true)`);
|
|
204
|
+
}
|
|
205
|
+
console.error(message);
|
|
206
|
+
}
|
|
199
207
|
if (typeof body.daysToExpiry === "number" && body.daysToExpiry <= 7) {
|
|
200
208
|
console.warn(
|
|
201
209
|
`[VerificationGateway] the configured AstraSync API key expires in ${body.daysToExpiry} day(s) \u2014 rotate it at Settings \u2192 Developer Tools before integrations start failing.`
|
|
@@ -334,11 +342,11 @@ function createGuidanceResponse(_config, reason, options = {}) {
|
|
|
334
342
|
const isMisconfig = source === "merchant_misconfig";
|
|
335
343
|
const urls = options.urls;
|
|
336
344
|
const guidance = isMisconfig ? {
|
|
337
|
-
message: "This site's AstraSync integration is misconfigured (its API key was revoked, expired, or
|
|
345
|
+
message: "This site's AstraSync integration is misconfigured (its API key was revoked, expired, rotated, or belongs to another account). Your identity and the AstraSync platform are fine \u2014 contact the site operator. Retrying will not help.",
|
|
338
346
|
registrationUrl: urls?.registrationUrl ?? "",
|
|
339
347
|
documentationUrl: options.remediation?.docsUrl ?? urls?.documentationUrl ?? "",
|
|
340
348
|
steps: [
|
|
341
|
-
"Report the failure to the site operator \u2014 their AstraSync API key needs
|
|
349
|
+
"Report the failure to the site operator \u2014 their AstraSync API key needs replacing",
|
|
342
350
|
"Do not retry: the failure is deterministic until the operator updates their key"
|
|
343
351
|
]
|
|
344
352
|
} : isApiError ? {
|
|
@@ -550,12 +558,13 @@ async function callVerifyAccessAPI(config, request) {
|
|
|
550
558
|
};
|
|
551
559
|
}
|
|
552
560
|
if (!response.ok) {
|
|
553
|
-
|
|
561
|
+
const keyMismatch = response.status === 403 && data?.error === "COUNTERPARTY_KEY_MISMATCH";
|
|
562
|
+
if (response.status === 401 || keyMismatch) {
|
|
554
563
|
return {
|
|
555
564
|
success: false,
|
|
556
565
|
error: data.message || data.error || "Integration API key rejected",
|
|
557
566
|
misconfig: true,
|
|
558
|
-
misconfigCode: typeof data?.code === "string" ? data.code : void 0,
|
|
567
|
+
misconfigCode: keyMismatch ? "counterparty_key_mismatch" : typeof data?.code === "string" ? data.code : void 0,
|
|
559
568
|
remediation: data?.remediation && typeof data.remediation === "object" ? data.remediation : void 0,
|
|
560
569
|
correlationId: typeof data?.correlationId === "string" ? data.correlationId : void 0,
|
|
561
570
|
attemptId: typeof data?.attemptId === "string" ? data.attemptId : void 0
|
|
@@ -588,14 +597,22 @@ async function verify(config, request, options) {
|
|
|
588
597
|
mergedConfig.apiBaseUrl,
|
|
589
598
|
mergedConfig.debug,
|
|
590
599
|
true,
|
|
591
|
-
mergedConfig.apiKey
|
|
600
|
+
mergedConfig.apiKey,
|
|
601
|
+
{
|
|
602
|
+
id: mergedConfig.counterpartyId,
|
|
603
|
+
url: mergedConfig.counterpartyUrl ?? request.counterpartyUrl
|
|
604
|
+
}
|
|
592
605
|
);
|
|
593
606
|
} else {
|
|
594
607
|
void performInitCheck(
|
|
595
608
|
mergedConfig.apiBaseUrl,
|
|
596
609
|
mergedConfig.debug,
|
|
597
610
|
false,
|
|
598
|
-
mergedConfig.apiKey
|
|
611
|
+
mergedConfig.apiKey,
|
|
612
|
+
{
|
|
613
|
+
id: mergedConfig.counterpartyId,
|
|
614
|
+
url: mergedConfig.counterpartyUrl ?? request.counterpartyUrl
|
|
615
|
+
}
|
|
599
616
|
);
|
|
600
617
|
}
|
|
601
618
|
}
|