@astrasyncai/verification-gateway 3.2.0 → 3.2.1
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 +24 -1
- package/dist/adapters/express.js.map +1 -1
- package/dist/adapters/express.mjs +24 -1
- package/dist/adapters/express.mjs.map +1 -1
- package/dist/adapters/mcp.js +24 -1
- package/dist/adapters/mcp.js.map +1 -1
- package/dist/adapters/mcp.mjs +24 -1
- package/dist/adapters/mcp.mjs.map +1 -1
- package/dist/adapters/nextjs.js +19 -3
- package/dist/adapters/nextjs.js.map +1 -1
- package/dist/adapters/nextjs.mjs +19 -3
- package/dist/adapters/nextjs.mjs.map +1 -1
- package/dist/adapters/sdk.js +1 -1
- package/dist/adapters/sdk.js.map +1 -1
- package/dist/adapters/sdk.mjs +1 -1
- package/dist/adapters/sdk.mjs.map +1 -1
- package/dist/browser/background.js +1 -1
- package/dist/browser/background.js.map +1 -1
- package/dist/browser/background.mjs +1 -1
- package/dist/browser/background.mjs.map +1 -1
- package/dist/cursor/extension.js +1 -1
- package/dist/cursor/extension.js.map +1 -1
- package/dist/cursor/extension.mjs +1 -1
- package/dist/cursor/extension.mjs.map +1 -1
- package/dist/gateway/gateway.js +1 -1
- package/dist/gateway/gateway.js.map +1 -1
- package/dist/gateway/gateway.mjs +1 -1
- package/dist/gateway/gateway.mjs.map +1 -1
- package/dist/index.js +39 -3
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +39 -3
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/adapters/nextjs.js
CHANGED
|
@@ -44,7 +44,7 @@ function getTrustLevel(score) {
|
|
|
44
44
|
}
|
|
45
45
|
|
|
46
46
|
// src/version.ts
|
|
47
|
-
var SDK_VERSION = "3.2.
|
|
47
|
+
var SDK_VERSION = "3.2.1";
|
|
48
48
|
|
|
49
49
|
// src/well-known.ts
|
|
50
50
|
var CACHE_TTL_MS = 60 * 60 * 1e3;
|
|
@@ -650,6 +650,19 @@ function resolveHttpPdlss(input) {
|
|
|
650
650
|
return { purpose, action, purposeSource, actionSource };
|
|
651
651
|
}
|
|
652
652
|
|
|
653
|
+
// src/adapters/approval-gate.ts
|
|
654
|
+
var APPROVAL_REASON = "Transaction is above the autonomous limit and requires human approval, which is not yet available \u2014 it cannot be completed automatically.";
|
|
655
|
+
function requiresHumanApproval(result) {
|
|
656
|
+
return result.requiresStepUp === true || result.requiresApproval === true;
|
|
657
|
+
}
|
|
658
|
+
function annotateApprovalRequired(result) {
|
|
659
|
+
result.failures = [
|
|
660
|
+
...result.failures ?? [],
|
|
661
|
+
{ dimension: "commerce.intent.approval_required", message: APPROVAL_REASON }
|
|
662
|
+
];
|
|
663
|
+
result.denialReasons = [APPROVAL_REASON, ...result.denialReasons ?? []];
|
|
664
|
+
}
|
|
665
|
+
|
|
653
666
|
// src/adapters/nextjs.ts
|
|
654
667
|
function escapeHtml(value) {
|
|
655
668
|
return value.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
@@ -1009,7 +1022,9 @@ function createMiddleware(options) {
|
|
|
1009
1022
|
agentCardUrl: request.headers.get("x-astrasync-agent-card") || void 0
|
|
1010
1023
|
}
|
|
1011
1024
|
});
|
|
1012
|
-
|
|
1025
|
+
const approvalRequired = result.identityVerified && result.policyAllowed && requiresHumanApproval(result);
|
|
1026
|
+
if (approvalRequired) annotateApprovalRequired(result);
|
|
1027
|
+
if (!result.identityVerified || !result.policyAllowed || approvalRequired) {
|
|
1013
1028
|
if (pathname.startsWith("/api/")) {
|
|
1014
1029
|
return NextResponse.json(
|
|
1015
1030
|
{
|
|
@@ -1019,7 +1034,8 @@ function createMiddleware(options) {
|
|
|
1019
1034
|
// OK, policy denied (update PDLSS / step up).
|
|
1020
1035
|
code: !result.identityVerified ? "UNAUTHORIZED" : "POLICY_DENIED",
|
|
1021
1036
|
message: result.denialReasons?.[0] || "Access denied",
|
|
1022
|
-
guidance: result.guidance
|
|
1037
|
+
guidance: result.guidance,
|
|
1038
|
+
failures: result.failures
|
|
1023
1039
|
}
|
|
1024
1040
|
},
|
|
1025
1041
|
{ status: !result.identityVerified ? 401 : 403 }
|