@astrasyncai/verification-gateway 5.17.0 → 5.17.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/README.md +94 -18
- package/dist/adapters/express.d.mts +1 -1
- package/dist/adapters/express.d.ts +1 -1
- package/dist/adapters/express.js +33 -5
- package/dist/adapters/express.js.map +1 -1
- package/dist/adapters/express.mjs +33 -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 +24 -5
- package/dist/adapters/mcp.js.map +1 -1
- package/dist/adapters/mcp.mjs +24 -5
- package/dist/adapters/mcp.mjs.map +1 -1
- package/dist/adapters/nextjs.d.mts +1 -1
- package/dist/adapters/nextjs.d.ts +1 -1
- package/dist/adapters/nextjs.js +24 -5
- package/dist/adapters/nextjs.js.map +1 -1
- package/dist/adapters/nextjs.mjs +24 -5
- package/dist/adapters/nextjs.mjs.map +1 -1
- package/dist/adapters/sdk.d.mts +1 -1
- package/dist/adapters/sdk.d.ts +1 -1
- package/dist/adapters/sdk.js +5 -1
- package/dist/adapters/sdk.js.map +1 -1
- package/dist/adapters/sdk.mjs +5 -1
- 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 +5 -1
- package/dist/bin/astrasync-codex-hook.js +5 -1
- package/dist/bin/astrasync-guard.js +32 -7
- package/dist/bin/astrasync.js +32 -7
- package/dist/browser/background.js +5 -1
- package/dist/browser/background.js.map +1 -1
- package/dist/browser/background.mjs +5 -1
- 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 +5 -1
- package/dist/codex/index.js.map +1 -1
- package/dist/codex/index.mjs +5 -1
- package/dist/codex/index.mjs.map +1 -1
- package/dist/cursor/extension.js +5 -1
- package/dist/cursor/extension.js.map +1 -1
- package/dist/cursor/extension.mjs +5 -1
- 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 +1 -1
- package/dist/edge-core/index.d.ts +1 -1
- package/dist/edge-core/index.js +5 -1
- package/dist/edge-core/index.js.map +1 -1
- package/dist/edge-core/index.mjs +5 -1
- package/dist/edge-core/index.mjs.map +1 -1
- package/dist/gateway/gateway.js +5 -1
- package/dist/gateway/gateway.js.map +1 -1
- package/dist/gateway/gateway.mjs +5 -1
- package/dist/gateway/gateway.mjs.map +1 -1
- package/dist/git-trigger/git-hooks.d.mts +1 -1
- package/dist/git-trigger/git-hooks.d.ts +1 -1
- package/dist/index.d.mts +16 -2
- package/dist/index.d.ts +16 -2
- package/dist/index.js +33 -5
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +33 -5
- 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/{types-Bm1QvGqI.d.ts → types-DA8LzAOB.d.ts} +6 -0
- package/dist/{types-Blz520bR.d.mts → types-DRb_plOh.d.mts} +14 -0
- package/dist/{types-Blz520bR.d.ts → types-DRb_plOh.d.ts} +14 -0
- package/dist/{types-DBe4hgfT.d.mts → types-vNBvYD7Z.d.mts} +6 -0
- 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 +5 -1
- package/dist/verify.js.map +1 -1
- package/dist/verify.mjs +5 -1
- package/dist/verify.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -963,6 +963,12 @@ interface VerificationRequest {
|
|
|
963
963
|
enableRuntimeChallenge?: boolean;
|
|
964
964
|
/** 5.16.0: the matched route's policy for verify-access to enforce. */
|
|
965
965
|
routePolicy?: RoutePolicy;
|
|
966
|
+
/**
|
|
967
|
+
* 5.17.1: the route itself holds a request that needs the owner's approval
|
|
968
|
+
* (see ExpressMiddlewareOptions.approvalHeldByRoute), so verify-access
|
|
969
|
+
* reports the hold but creates no approval of its own.
|
|
970
|
+
*/
|
|
971
|
+
approvalHeldByRoute?: boolean;
|
|
966
972
|
/** Create a verification session (returns sessionId) */
|
|
967
973
|
createSession?: boolean;
|
|
968
974
|
/** Counterparty type */
|
|
@@ -1281,6 +1287,14 @@ interface ExpressMiddlewareOptions extends GatewayConfig {
|
|
|
1281
1287
|
recordDecisions?: boolean;
|
|
1282
1288
|
/** Ask for a runtime challenge on every verify-access call (default: false — opt-in, round 27.8) */
|
|
1283
1289
|
enableRuntimeChallenge?: boolean;
|
|
1290
|
+
/**
|
|
1291
|
+
* 5.17.1: return true for requests whose route asks the owner for approval
|
|
1292
|
+
* itself (it creates its own hold and answers 202 while it waits). For those
|
|
1293
|
+
* requests a result that only needs the owner's approval is passed to the
|
|
1294
|
+
* route instead of refused, and verify-access creates no approval, so the
|
|
1295
|
+
* owner approves once. Any deny is still refused. Default: none.
|
|
1296
|
+
*/
|
|
1297
|
+
approvalHeldByRoute?: (req: unknown) => boolean;
|
|
1284
1298
|
/**
|
|
1285
1299
|
* Refresh interval (ms) for the remote-fetched route policy. Default:
|
|
1286
1300
|
* 5 minutes. Operators can shorten this to test policy edits faster, or
|
|
@@ -5134,7 +5148,7 @@ declare function detectRuntime(userAgent: string | undefined | null): string | u
|
|
|
5134
5148
|
* silently (never throwing), so this is a no-op there — which is correct:
|
|
5135
5149
|
* in a browser the page's real UA is the honest identity.
|
|
5136
5150
|
*/
|
|
5137
|
-
declare const SDK_USER_AGENT = "astrasync-sdk/5.17.
|
|
5151
|
+
declare const SDK_USER_AGENT = "astrasync-sdk/5.17.1";
|
|
5138
5152
|
declare const sdkFetch: typeof fetch;
|
|
5139
5153
|
|
|
5140
5154
|
interface LocalPolicy {
|
|
@@ -5252,7 +5266,7 @@ declare function parseYaml(yamlContent: string): ParseResult;
|
|
|
5252
5266
|
* is fine — bumping both in the release-ceremony commit keeps them
|
|
5253
5267
|
* lockstep.
|
|
5254
5268
|
*/
|
|
5255
|
-
declare const SDK_VERSION = "5.17.
|
|
5269
|
+
declare const SDK_VERSION = "5.17.1";
|
|
5256
5270
|
|
|
5257
5271
|
/**
|
|
5258
5272
|
* 5.15.0 — the `UCP-Agent` request header (UCP 2026-08-25): an RFC 8941
|
package/dist/index.d.ts
CHANGED
|
@@ -963,6 +963,12 @@ interface VerificationRequest {
|
|
|
963
963
|
enableRuntimeChallenge?: boolean;
|
|
964
964
|
/** 5.16.0: the matched route's policy for verify-access to enforce. */
|
|
965
965
|
routePolicy?: RoutePolicy;
|
|
966
|
+
/**
|
|
967
|
+
* 5.17.1: the route itself holds a request that needs the owner's approval
|
|
968
|
+
* (see ExpressMiddlewareOptions.approvalHeldByRoute), so verify-access
|
|
969
|
+
* reports the hold but creates no approval of its own.
|
|
970
|
+
*/
|
|
971
|
+
approvalHeldByRoute?: boolean;
|
|
966
972
|
/** Create a verification session (returns sessionId) */
|
|
967
973
|
createSession?: boolean;
|
|
968
974
|
/** Counterparty type */
|
|
@@ -1281,6 +1287,14 @@ interface ExpressMiddlewareOptions extends GatewayConfig {
|
|
|
1281
1287
|
recordDecisions?: boolean;
|
|
1282
1288
|
/** Ask for a runtime challenge on every verify-access call (default: false — opt-in, round 27.8) */
|
|
1283
1289
|
enableRuntimeChallenge?: boolean;
|
|
1290
|
+
/**
|
|
1291
|
+
* 5.17.1: return true for requests whose route asks the owner for approval
|
|
1292
|
+
* itself (it creates its own hold and answers 202 while it waits). For those
|
|
1293
|
+
* requests a result that only needs the owner's approval is passed to the
|
|
1294
|
+
* route instead of refused, and verify-access creates no approval, so the
|
|
1295
|
+
* owner approves once. Any deny is still refused. Default: none.
|
|
1296
|
+
*/
|
|
1297
|
+
approvalHeldByRoute?: (req: unknown) => boolean;
|
|
1284
1298
|
/**
|
|
1285
1299
|
* Refresh interval (ms) for the remote-fetched route policy. Default:
|
|
1286
1300
|
* 5 minutes. Operators can shorten this to test policy edits faster, or
|
|
@@ -5134,7 +5148,7 @@ declare function detectRuntime(userAgent: string | undefined | null): string | u
|
|
|
5134
5148
|
* silently (never throwing), so this is a no-op there — which is correct:
|
|
5135
5149
|
* in a browser the page's real UA is the honest identity.
|
|
5136
5150
|
*/
|
|
5137
|
-
declare const SDK_USER_AGENT = "astrasync-sdk/5.17.
|
|
5151
|
+
declare const SDK_USER_AGENT = "astrasync-sdk/5.17.1";
|
|
5138
5152
|
declare const sdkFetch: typeof fetch;
|
|
5139
5153
|
|
|
5140
5154
|
interface LocalPolicy {
|
|
@@ -5252,7 +5266,7 @@ declare function parseYaml(yamlContent: string): ParseResult;
|
|
|
5252
5266
|
* is fine — bumping both in the release-ceremony commit keeps them
|
|
5253
5267
|
* lockstep.
|
|
5254
5268
|
*/
|
|
5255
|
-
declare const SDK_VERSION = "5.17.
|
|
5269
|
+
declare const SDK_VERSION = "5.17.1";
|
|
5256
5270
|
|
|
5257
5271
|
/**
|
|
5258
5272
|
* 5.15.0 — the `UCP-Agent` request header (UCP 2026-08-25): an RFC 8941
|
package/dist/index.js
CHANGED
|
@@ -205,7 +205,7 @@ function getTrustLevel(score) {
|
|
|
205
205
|
}
|
|
206
206
|
|
|
207
207
|
// src/version.ts
|
|
208
|
-
var SDK_VERSION = "5.17.
|
|
208
|
+
var SDK_VERSION = "5.17.1";
|
|
209
209
|
|
|
210
210
|
// src/http.ts
|
|
211
211
|
var SDK_USER_AGENT = `astrasync-sdk/${SDK_VERSION}`;
|
|
@@ -441,6 +441,7 @@ function getCacheKey(request, counterpartyId) {
|
|
|
441
441
|
request.enableRuntimeChallenge ? "1" : "0",
|
|
442
442
|
// 5.16.0: route policy changes the verdict (owners / challenge).
|
|
443
443
|
request.routePolicy ? JSON.stringify(request.routePolicy) : "",
|
|
444
|
+
request.approvalHeldByRoute ? "1" : "0",
|
|
444
445
|
// callerMetadata fields contribute to risk model; include the ones
|
|
445
446
|
// backend reads. sourceIp/userAgent/forwardedFor change per-request
|
|
446
447
|
// so their inclusion effectively forces a re-check for any varying
|
|
@@ -654,6 +655,7 @@ async function callVerifyAccessAPI(config, request) {
|
|
|
654
655
|
if (requestData.enableRuntimeChallenge)
|
|
655
656
|
body.enableRuntimeChallenge = requestData.enableRuntimeChallenge;
|
|
656
657
|
if (requestData.routePolicy) body.routePolicy = requestData.routePolicy;
|
|
658
|
+
if (requestData.approvalHeldByRoute) body.approvalHeldByRoute = true;
|
|
657
659
|
if (requestData.createSession) body.createSession = requestData.createSession;
|
|
658
660
|
if (requestData.durationRequired) body.durationRequired = requestData.durationRequired;
|
|
659
661
|
if (requestData.counterpartyType) body.counterpartyType = requestData.counterpartyType;
|
|
@@ -985,6 +987,8 @@ async function verify(config, request, options) {
|
|
|
985
987
|
} else if (result.recommendation === "step_up_required" && result.identityVerified) {
|
|
986
988
|
result.requiresStepUp = true;
|
|
987
989
|
result.denialReasons = serverDenialReasons ?? result.recommendationReasons ?? ["Step-up verification required"];
|
|
990
|
+
const stepUpFailures = apiResponse.access?.failures;
|
|
991
|
+
if (stepUpFailures?.length) result.failures = stepUpFailures;
|
|
988
992
|
}
|
|
989
993
|
const escalates = result.requiresStepUp === true || result.requiresApproval === true || result.recommendation === "step_up_required";
|
|
990
994
|
if (mergedConfig.cacheTtl !== 0 && result.recommendation !== "deny" && !escalates) {
|
|
@@ -1184,12 +1188,31 @@ function requiresHumanApproval(result) {
|
|
|
1184
1188
|
return result.requiresStepUp === true || result.requiresApproval === true;
|
|
1185
1189
|
}
|
|
1186
1190
|
function annotateApprovalRequired(result) {
|
|
1187
|
-
result
|
|
1188
|
-
...result.
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
+
if (isDimensionApproval(result)) {
|
|
1192
|
+
result.denialReasons = [DIMENSION_APPROVAL_REASON, ...result.denialReasons ?? []];
|
|
1193
|
+
return;
|
|
1194
|
+
}
|
|
1195
|
+
const named = (result.failures ?? []).some(
|
|
1196
|
+
(f) => f.dimension === "commerce.intent.approval_required"
|
|
1197
|
+
);
|
|
1198
|
+
if (!named) {
|
|
1199
|
+
result.failures = [
|
|
1200
|
+
...result.failures ?? [],
|
|
1201
|
+
{ dimension: "commerce.intent.approval_required", message: APPROVAL_REASON }
|
|
1202
|
+
];
|
|
1203
|
+
}
|
|
1191
1204
|
result.denialReasons = [APPROVAL_REASON, ...result.denialReasons ?? []];
|
|
1192
1205
|
}
|
|
1206
|
+
var DIMENSION_APPROVAL_REASON = "The agent's owner asked to approve this kind of request. The owner can approve or deny it in the AstraSync dashboard.";
|
|
1207
|
+
var DIMENSION_APPROVAL = /^pdlss\.[a-z_]+\.approval_required$/;
|
|
1208
|
+
function isDimensionApproval(result) {
|
|
1209
|
+
const f = result.failures ?? [];
|
|
1210
|
+
return f.some((x) => DIMENSION_APPROVAL.test(x.dimension)) && !f.some((x) => x.dimension === "commerce.intent.approval_required");
|
|
1211
|
+
}
|
|
1212
|
+
function onlyNeedsApproval(result) {
|
|
1213
|
+
if (!result.policyAllowed || !requiresHumanApproval(result)) return false;
|
|
1214
|
+
return (result.failures ?? []).every((f) => /\.approval_required$/.test(f.dimension));
|
|
1215
|
+
}
|
|
1193
1216
|
|
|
1194
1217
|
// src/settlement.ts
|
|
1195
1218
|
async function authorizeSettlement(config, req) {
|
|
@@ -2865,6 +2888,7 @@ function createMiddleware(options) {
|
|
|
2865
2888
|
const attemptHeader = req.headers["x-astra-attempt-id"];
|
|
2866
2889
|
const inboundAttemptId = typeof attemptHeader === "string" && /^att_[0-9a-f]{32}$/.test(attemptHeader) ? attemptHeader : void 0;
|
|
2867
2890
|
const commerceArtifacts = detectExpressCommerce(req);
|
|
2891
|
+
const heldByRoute = options.approvalHeldByRoute?.(req) === true;
|
|
2868
2892
|
const verificationRequest = {
|
|
2869
2893
|
credentials,
|
|
2870
2894
|
...commerceArtifacts && { commerceArtifacts },
|
|
@@ -2876,6 +2900,7 @@ function createMiddleware(options) {
|
|
|
2876
2900
|
counterpartyType: config.counterpartyType || "api",
|
|
2877
2901
|
enableRuntimeChallenge,
|
|
2878
2902
|
...routePolicyOf(routeConfig) && { routePolicy: routePolicyOf(routeConfig) },
|
|
2903
|
+
...heldByRoute && { approvalHeldByRoute: true },
|
|
2879
2904
|
durationRequired: astraCreds?.pdlss?.duration?.maxSessionDuration,
|
|
2880
2905
|
...txValue !== void 0 && { transactionValue: txValue },
|
|
2881
2906
|
...txCurrency && { currency: txCurrency },
|
|
@@ -2932,6 +2957,9 @@ function createMiddleware(options) {
|
|
|
2932
2957
|
onDenied(result, req, res);
|
|
2933
2958
|
return;
|
|
2934
2959
|
}
|
|
2960
|
+
if (heldByRoute && !result.stepUpApproval && onlyNeedsApproval(result)) {
|
|
2961
|
+
return next();
|
|
2962
|
+
}
|
|
2935
2963
|
if (requiresHumanApproval(result)) {
|
|
2936
2964
|
annotateApprovalRequired(result);
|
|
2937
2965
|
if (shouldRecordDecisions && sessionId) {
|