@astrasyncai/verification-gateway 3.3.0 → 3.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/README.md +86 -0
- 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 +27 -5
- package/dist/adapters/express.js.map +1 -1
- package/dist/adapters/express.mjs +27 -5
- package/dist/adapters/express.mjs.map +1 -1
- package/dist/adapters/mcp.d.mts +1 -1
- package/dist/adapters/mcp.d.ts +1 -1
- package/dist/adapters/mcp.js +10 -5
- package/dist/adapters/mcp.js.map +1 -1
- package/dist/adapters/mcp.mjs +10 -5
- 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 +10 -5
- package/dist/adapters/nextjs.js.map +1 -1
- package/dist/adapters/nextjs.mjs +10 -5
- 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 +7 -3
- package/dist/adapters/sdk.js.map +1 -1
- package/dist/adapters/sdk.mjs +7 -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/browser/background.js +2814 -2343
- package/dist/browser/background.js.map +1 -1
- package/dist/browser/background.mjs +2814 -2343
- 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/cli/index.d.mts +2 -2
- package/dist/cli/index.d.ts +2 -2
- package/dist/cli/index.js +2813 -2346
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/index.mjs +2813 -2346
- package/dist/cli/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 +2815 -2344
- package/dist/cursor/extension.js.map +1 -1
- package/dist/cursor/extension.mjs +2817 -2346
- package/dist/cursor/extension.mjs.map +1 -1
- package/dist/{express-DAOTESQo.d.mts → express-BH5ADAyb.d.mts} +1 -1
- package/dist/{express-Lb8-Ybio.d.ts → express-jUzLIoep.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 +2814 -2343
- package/dist/gateway/gateway.js.map +1 -1
- package/dist/gateway/gateway.mjs +2816 -2345
- 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-kxLJ873R.d.mts → index-BR2nmxBU.d.mts} +5 -1
- package/dist/{index-E3fAidVt.d.ts → index-DEixUCu0.d.ts} +5 -1
- package/dist/{index-DFwfHOGj.d.ts → index-DlCnmpJH.d.ts} +1 -1
- package/dist/{index-BLeiWFLu.d.mts → index-aZHAWujT.d.mts} +1 -1
- package/dist/index.d.mts +11 -9
- package/dist/index.d.ts +11 -9
- package/dist/index.js +56 -13
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +56 -13
- 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/{nextjs-BXK0nD73.d.ts → nextjs-DfXOd0Au.d.ts} +1 -1
- package/dist/{nextjs-CFQ_KDFf.d.mts → nextjs-LTeoPqMH.d.mts} +1 -1
- package/dist/{sdk-D1MuiiNz.d.mts → sdk-DKhwVL9X.d.mts} +1 -1
- package/dist/{sdk-C7qAfpGB.d.ts → sdk-LmvyDVpL.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 -4
- package/dist/transport/index.js.map +1 -1
- package/dist/transport/index.mjs +22 -4
- package/dist/transport/index.mjs.map +1 -1
- package/dist/{types-ClvUqrEm.d.mts → types-C8HyQEaz.d.mts} +1 -1
- package/dist/{types-B_wnd7ZX.d.mts → types-DrDIouvO.d.mts} +54 -3
- package/dist/{types-B_wnd7ZX.d.ts → types-DrDIouvO.d.ts} +54 -3
- package/dist/{types-B6uD4jAI.d.ts → types-xofemo0G.d.ts} +1 -1
- package/dist/ui/index.d.mts +1 -1
- package/dist/ui/index.d.ts +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -126,7 +126,7 @@ function getCapabilities(accessLevel) {
|
|
|
126
126
|
}
|
|
127
127
|
|
|
128
128
|
// src/version.ts
|
|
129
|
-
var SDK_VERSION = "3.
|
|
129
|
+
var SDK_VERSION = "3.5.0";
|
|
130
130
|
|
|
131
131
|
// src/well-known.ts
|
|
132
132
|
var CACHE_TTL_MS = 60 * 60 * 1e3;
|
|
@@ -544,7 +544,9 @@ async function verify(config, request) {
|
|
|
544
544
|
// linking key (the sessionId-equivalent for anonymous callers).
|
|
545
545
|
correlationId: apiResponse.correlationId,
|
|
546
546
|
recommendation: apiResponse.recommendation,
|
|
547
|
-
recommendationReasons: apiResponse.recommendationReasons
|
|
547
|
+
recommendationReasons: apiResponse.recommendationReasons,
|
|
548
|
+
stepUpApproval: apiResponse.stepUpApproval,
|
|
549
|
+
settlement: apiResponse.settlement
|
|
548
550
|
};
|
|
549
551
|
return result2;
|
|
550
552
|
}
|
|
@@ -596,7 +598,9 @@ async function verify(config, request) {
|
|
|
596
598
|
tokenGuidance: apiResponse.tokenGuidance,
|
|
597
599
|
recommendation: apiResponse.recommendation,
|
|
598
600
|
recommendationReasons: apiResponse.recommendationReasons,
|
|
599
|
-
warningHeader: apiResponse.warningHeader
|
|
601
|
+
warningHeader: apiResponse.warningHeader,
|
|
602
|
+
stepUpApproval: apiResponse.stepUpApproval,
|
|
603
|
+
settlement: apiResponse.settlement
|
|
600
604
|
};
|
|
601
605
|
if (result.recommendation === "deny") {
|
|
602
606
|
result.policyAllowed = false;
|
|
@@ -677,7 +681,7 @@ async function quickVerify(config, credentials) {
|
|
|
677
681
|
}
|
|
678
682
|
|
|
679
683
|
// src/adapters/approval-gate.ts
|
|
680
|
-
var APPROVAL_REASON = "Transaction is above the autonomous limit and requires human approval
|
|
684
|
+
var APPROVAL_REASON = "Transaction is above the autonomous limit and requires human approval. The agent owner can approve or deny this transaction in the AstraSync dashboard.";
|
|
681
685
|
function requiresHumanApproval(result) {
|
|
682
686
|
return result.requiresStepUp === true || result.requiresApproval === true;
|
|
683
687
|
}
|
|
@@ -733,7 +737,8 @@ async function authorizeSettlement(config, req) {
|
|
|
733
737
|
recommendation,
|
|
734
738
|
reason: authorized ? void 0 : result.denialReasons?.[0] ?? (requiresHumanApproval(result) ? "Transaction is above the autonomous limit and requires human approval; settlement cannot be authorized automatically." : "Settlement not authorized by the agent's PDLSS limits."),
|
|
735
739
|
failures: result.failures,
|
|
736
|
-
correlationId: result.correlationId
|
|
740
|
+
correlationId: result.correlationId,
|
|
741
|
+
stepUpApproval: requiresHumanApproval(result) ? result.stepUpApproval : void 0
|
|
737
742
|
};
|
|
738
743
|
}
|
|
739
744
|
|
|
@@ -1020,7 +1025,8 @@ function defaultOnDenied(result, _req, res) {
|
|
|
1020
1025
|
guidance: result.guidance,
|
|
1021
1026
|
// Round-10: aggregated per-dimension detail + correlation handle.
|
|
1022
1027
|
failures: result.failures,
|
|
1023
|
-
correlationId: result.correlationId
|
|
1028
|
+
correlationId: result.correlationId,
|
|
1029
|
+
stepUpApproval: result.stepUpApproval
|
|
1024
1030
|
}
|
|
1025
1031
|
});
|
|
1026
1032
|
}
|
|
@@ -1170,6 +1176,21 @@ function createMiddleware(options) {
|
|
|
1170
1176
|
);
|
|
1171
1177
|
}
|
|
1172
1178
|
const agentCardUrl = typeof req.headers["x-astrasync-agent-card"] === "string" ? req.headers["x-astrasync-agent-card"] : void 0;
|
|
1179
|
+
let txValue;
|
|
1180
|
+
let txCurrency;
|
|
1181
|
+
if (config.extractTransactionValue) {
|
|
1182
|
+
try {
|
|
1183
|
+
const extracted = config.extractTransactionValue(req);
|
|
1184
|
+
if (extracted) {
|
|
1185
|
+
txValue = extracted.value;
|
|
1186
|
+
txCurrency = extracted.currency;
|
|
1187
|
+
}
|
|
1188
|
+
} catch (e) {
|
|
1189
|
+
if (config.debug) {
|
|
1190
|
+
console.warn("[VerificationGateway] extractTransactionValue threw:", e);
|
|
1191
|
+
}
|
|
1192
|
+
}
|
|
1193
|
+
}
|
|
1173
1194
|
const result = await verify(config, {
|
|
1174
1195
|
credentials,
|
|
1175
1196
|
purpose,
|
|
@@ -1180,6 +1201,8 @@ function createMiddleware(options) {
|
|
|
1180
1201
|
counterpartyType: config.counterpartyType || "api",
|
|
1181
1202
|
enableRuntimeChallenge,
|
|
1182
1203
|
durationRequired: astraCreds?.pdlss?.duration?.maxSessionDuration,
|
|
1204
|
+
...txValue !== void 0 && { transactionValue: txValue },
|
|
1205
|
+
...txCurrency && { currency: txCurrency },
|
|
1183
1206
|
callerMetadata: {
|
|
1184
1207
|
sourceIp: originalClientIp,
|
|
1185
1208
|
userAgent: req.headers["user-agent"],
|
|
@@ -1670,7 +1693,8 @@ function createMiddleware2(options) {
|
|
|
1670
1693
|
code: !result.identityVerified ? "UNAUTHORIZED" : "POLICY_DENIED",
|
|
1671
1694
|
message: result.denialReasons?.[0] || "Access denied",
|
|
1672
1695
|
guidance: result.guidance,
|
|
1673
|
-
failures: result.failures
|
|
1696
|
+
failures: result.failures,
|
|
1697
|
+
stepUpApproval: result.stepUpApproval
|
|
1674
1698
|
}
|
|
1675
1699
|
},
|
|
1676
1700
|
{ status: !result.identityVerified ? 401 : 403 }
|
|
@@ -2159,15 +2183,33 @@ function extractMPPTransactionValue(challenge) {
|
|
|
2159
2183
|
source: `challenge.request.amount (method=${challenge.method ?? "unknown"})`
|
|
2160
2184
|
};
|
|
2161
2185
|
}
|
|
2186
|
+
var KNOWN_TOKEN_DECIMALS = {
|
|
2187
|
+
USDC: 6,
|
|
2188
|
+
USDT: 6,
|
|
2189
|
+
DAI: 18,
|
|
2190
|
+
ETH: 18,
|
|
2191
|
+
WETH: 18
|
|
2192
|
+
};
|
|
2162
2193
|
function extractX402TransactionValue(req) {
|
|
2163
|
-
const
|
|
2194
|
+
const rawAmount = req.maxAmountRequired ?? req.amount;
|
|
2164
2195
|
const currency = req.currency ?? req.asset;
|
|
2165
|
-
if (typeof
|
|
2196
|
+
if (typeof rawAmount !== "number" || !currency) return null;
|
|
2197
|
+
const source = req.maxAmountRequired !== void 0 ? "maxAmountRequired" : "amount";
|
|
2198
|
+
const decimals = KNOWN_TOKEN_DECIMALS[currency.toUpperCase()];
|
|
2199
|
+
if (decimals !== void 0) {
|
|
2200
|
+
return {
|
|
2201
|
+
protocol: "x402",
|
|
2202
|
+
amount: rawAmount / Math.pow(10, decimals),
|
|
2203
|
+
currency,
|
|
2204
|
+
source
|
|
2205
|
+
};
|
|
2206
|
+
}
|
|
2166
2207
|
return {
|
|
2167
2208
|
protocol: "x402",
|
|
2168
|
-
amount,
|
|
2209
|
+
amount: rawAmount,
|
|
2169
2210
|
currency,
|
|
2170
|
-
source
|
|
2211
|
+
source,
|
|
2212
|
+
rawUnits: true
|
|
2171
2213
|
};
|
|
2172
2214
|
}
|
|
2173
2215
|
|
|
@@ -4573,7 +4615,8 @@ function defaultMcpDenied(result, req, res) {
|
|
|
4573
4615
|
guidance: result.guidance,
|
|
4574
4616
|
// Round-10: aggregated per-dimension detail + correlation handle.
|
|
4575
4617
|
failures: result.failures,
|
|
4576
|
-
correlationId: result.correlationId
|
|
4618
|
+
correlationId: result.correlationId,
|
|
4619
|
+
stepUpApproval: result.stepUpApproval
|
|
4577
4620
|
}
|
|
4578
4621
|
}
|
|
4579
4622
|
});
|
|
@@ -5501,7 +5544,7 @@ async function recordDecision2(config, params) {
|
|
|
5501
5544
|
}
|
|
5502
5545
|
|
|
5503
5546
|
// src/index.ts
|
|
5504
|
-
var VERSION = "
|
|
5547
|
+
var VERSION = "3.4.0";
|
|
5505
5548
|
export {
|
|
5506
5549
|
ACCESS_LEVEL_DESCRIPTIONS,
|
|
5507
5550
|
ACCESS_LEVEL_HIERARCHY,
|