@astrasyncai/verification-gateway 5.0.0 → 5.2.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 +20 -3
- package/dist/adapters/express.js.map +1 -1
- package/dist/adapters/express.mjs +20 -3
- 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 +20 -3
- package/dist/adapters/mcp.js.map +1 -1
- package/dist/adapters/mcp.mjs +20 -3
- 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 +20 -3
- package/dist/adapters/nextjs.js.map +1 -1
- package/dist/adapters/nextjs.mjs +20 -3
- 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 +20 -3
- package/dist/adapters/sdk.js.map +1 -1
- package/dist/adapters/sdk.mjs +20 -3
- 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 +20 -3
- package/dist/bin/astrasync-codex-hook.js +20 -3
- package/dist/bin/astrasync-guard.js +20 -3
- package/dist/bin/astrasync.js +20 -3
- package/dist/browser/background.js +20 -3
- package/dist/browser/background.js.map +1 -1
- package/dist/browser/background.mjs +20 -3
- 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 +20 -3
- package/dist/codex/index.js.map +1 -1
- package/dist/codex/index.mjs +20 -3
- 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 +20 -3
- package/dist/cursor/extension.js.map +1 -1
- package/dist/cursor/extension.mjs +20 -3
- 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 +21 -2
- package/dist/edge-core/index.d.ts +21 -2
- package/dist/edge-core/index.js +40 -7
- package/dist/edge-core/index.js.map +1 -1
- package/dist/edge-core/index.mjs +40 -7
- package/dist/edge-core/index.mjs.map +1 -1
- package/dist/{express-Dm-snUuY.d.mts → express-KkBZBMqi.d.mts} +1 -1
- package/dist/{express-B5lWuemA.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 +20 -3
- package/dist/gateway/gateway.js.map +1 -1
- package/dist/gateway/gateway.mjs +20 -3
- 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-B5k_vUmK.d.mts → index-DIRzR5IS.d.mts} +1 -1
- package/dist/{index-y8xToocF.d.ts → index-DLQ4Rcuc.d.ts} +1 -1
- package/dist/{index-BOzM6xUq.d.mts → index-GPDn_EGI.d.mts} +1 -1
- package/dist/{index-dRfxUdFA.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 +20 -3
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +20 -3
- 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/{mcp-OosmAcKf.d.ts → mcp-DPpu4xQz.d.ts} +1 -1
- package/dist/{mcp-DgsyQiQq.d.mts → mcp-Dju_Sr1o.d.mts} +1 -1
- package/dist/{nextjs-B1sBdEav.d.mts → nextjs-BuoDBN4g.d.mts} +1 -1
- package/dist/{nextjs-DoRmhV_Z.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-B83N3xKc.d.mts → sdk-CdO6TIEf.d.mts} +1 -1
- package/dist/{sdk-H_9BTNBS.d.ts → sdk-DxHuIJBm.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 +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-CXf3q4kZ.d.ts → types-3UV7IZx7.d.ts} +1 -1
- package/dist/{types-BK2POWNc.d.ts → types-CNBaZKxY.d.ts} +9 -0
- package/dist/{types-CJjZvPr9.d.mts → types-CSHcByFX.d.mts} +9 -0
- package/dist/{types-DQmop7ZW.d.mts → types-CoDjpbVY.d.mts} +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 +20 -3
- package/dist/verify.js.map +1 -1
- package/dist/verify.mjs +20 -3
- package/dist/verify.mjs.map +1 -1
- package/package.json +1 -1
package/dist/edge-core/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// src/version.ts
|
|
2
|
-
var SDK_VERSION = "5.
|
|
2
|
+
var SDK_VERSION = "5.2.0";
|
|
3
3
|
|
|
4
4
|
// src/http.ts
|
|
5
5
|
var SDK_USER_AGENT = `astrasync-sdk/${SDK_VERSION}`;
|
|
@@ -484,6 +484,14 @@ function extractCredentials(headers, query) {
|
|
|
484
484
|
}
|
|
485
485
|
return credentials;
|
|
486
486
|
}
|
|
487
|
+
function mcpGuidance(urls) {
|
|
488
|
+
if (!urls?.mcpEndpoint) return void 0;
|
|
489
|
+
return {
|
|
490
|
+
endpoint: urls.mcpEndpoint,
|
|
491
|
+
discoveryUrl: urls.mcpDiscoveryUrl,
|
|
492
|
+
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."
|
|
493
|
+
};
|
|
494
|
+
}
|
|
487
495
|
function createGuidanceResponse(_config, reason, options = {}) {
|
|
488
496
|
const source = options.source ?? "no_credentials";
|
|
489
497
|
const isApiError = source === "api_error";
|
|
@@ -510,11 +518,17 @@ function createGuidanceResponse(_config, reason, options = {}) {
|
|
|
510
518
|
registrationUrl: urls?.registrationUrl ?? "",
|
|
511
519
|
documentationUrl: urls?.documentationUrl ?? "",
|
|
512
520
|
steps: [
|
|
521
|
+
// MCP steering leads when the hosted bridge is advertised — the
|
|
522
|
+
// connector is the agent-actionable path (keyless, human-approved).
|
|
523
|
+
...urls?.mcpEndpoint ? [
|
|
524
|
+
`Fastest path (inside an MCP host): add the AstraSync MCP connector at ${urls.mcpEndpoint} \u2014 keyless, human-approved registration`
|
|
525
|
+
] : [],
|
|
513
526
|
"Register for an AstraSync account",
|
|
514
527
|
"Create and register your agent",
|
|
515
528
|
"Add your ASTRA-ID to request headers",
|
|
516
529
|
"Retry your request"
|
|
517
|
-
]
|
|
530
|
+
],
|
|
531
|
+
...mcpGuidance(urls) && { mcp: mcpGuidance(urls) }
|
|
518
532
|
};
|
|
519
533
|
return {
|
|
520
534
|
// Round-18 G4: createGuidanceResponse fires for unverified-agent path or
|
|
@@ -733,7 +747,10 @@ async function verify(config, request, options) {
|
|
|
733
747
|
guidance: {
|
|
734
748
|
message: apiResponse.access?.reason || "Access denied by PDLSS policy",
|
|
735
749
|
registrationUrl: urls?.registrationUrl ?? "",
|
|
736
|
-
documentationUrl: urls?.documentationUrl ?? ""
|
|
750
|
+
documentationUrl: urls?.documentationUrl ?? "",
|
|
751
|
+
// 5.1.0: anonymous callers land on this branch — steer MCP-hosted
|
|
752
|
+
// agents to the connector (this is what the edge deny body surfaces).
|
|
753
|
+
...mcpGuidance(urls) && { mcp: mcpGuidance(urls) }
|
|
737
754
|
},
|
|
738
755
|
verifiedAt: /* @__PURE__ */ new Date(),
|
|
739
756
|
// Extract sessionId so decisions can be recorded for denials too
|
|
@@ -1096,8 +1113,17 @@ var PROTOCOL_MESSAGES = {
|
|
|
1096
1113
|
"platform-ua": "This traffic was identified as a platform AI agent without AstraSync credentials. Register the agent to access this property with a verified identity.",
|
|
1097
1114
|
"x-astra": "The presented AstraSync credentials failed verification or were denied by this property\u2019s access policy."
|
|
1098
1115
|
};
|
|
1099
|
-
function
|
|
1100
|
-
|
|
1116
|
+
function fallbackMcpEndpoint(origin) {
|
|
1117
|
+
try {
|
|
1118
|
+
const host = new URL(origin).hostname.replace(/^www\./, "");
|
|
1119
|
+
if (host === "astrasync.ai" || host.endsWith(".astrasync.ai")) return `https://mcp.${host}/mcp`;
|
|
1120
|
+
} catch {
|
|
1121
|
+
}
|
|
1122
|
+
return void 0;
|
|
1123
|
+
}
|
|
1124
|
+
function buildDenyBody(outcome, apiBaseUrl, publicBaseUrl) {
|
|
1125
|
+
const origin = (publicBaseUrl || apiBaseUrl).replace(/\/api\/?$/, "");
|
|
1126
|
+
const mcpEndpoint = outcome.guidance?.mcp?.endpoint || fallbackMcpEndpoint(origin);
|
|
1101
1127
|
const protocolMessage = (outcome.protocol && PROTOCOL_MESSAGES[outcome.protocol]) ?? "This request could not be verified by AstraSync.";
|
|
1102
1128
|
return {
|
|
1103
1129
|
success: false,
|
|
@@ -1114,7 +1140,14 @@ function buildDenyBody(outcome, apiBaseUrl) {
|
|
|
1114
1140
|
// well-known cache is cold — empty means "use the fallback".
|
|
1115
1141
|
message: outcome.guidance?.message || "Register this agent with AstraSync to receive verifiable credentials.",
|
|
1116
1142
|
registrationUrl: outcome.guidance?.registrationUrl || `${origin}/register`,
|
|
1117
|
-
documentationUrl: outcome.guidance?.documentationUrl || `${origin}/docs/edge-adapter
|
|
1143
|
+
documentationUrl: outcome.guidance?.documentationUrl || `${origin}/docs/edge-adapter`,
|
|
1144
|
+
...mcpEndpoint && {
|
|
1145
|
+
mcp: {
|
|
1146
|
+
endpoint: mcpEndpoint,
|
|
1147
|
+
discoveryUrl: outcome.guidance?.mcp?.discoveryUrl || `${mcpEndpoint.replace(/\/mcp$/, "")}/.well-known/mcp.json`,
|
|
1148
|
+
message: outcome.guidance?.mcp?.message || "Inside an MCP host? Add the AstraSync MCP connector at this endpoint instead of the registration URL \u2014 registration through the connector is keyless and human-approved (your human approves in an in-chat card; you never handle credentials)."
|
|
1149
|
+
}
|
|
1150
|
+
}
|
|
1118
1151
|
}
|
|
1119
1152
|
}
|
|
1120
1153
|
};
|
|
@@ -1186,7 +1219,7 @@ function applyOutcome(options, outcome, policy) {
|
|
|
1186
1219
|
action: "respond",
|
|
1187
1220
|
status: 403,
|
|
1188
1221
|
headers: {},
|
|
1189
|
-
bodyJson: buildDenyBody(outcome, options.apiBaseUrl)
|
|
1222
|
+
bodyJson: buildDenyBody(outcome, options.apiBaseUrl, options.publicBaseUrl)
|
|
1190
1223
|
};
|
|
1191
1224
|
case "manual_review":
|
|
1192
1225
|
return {
|