@astrasyncai/verification-gateway 3.11.0 → 3.12.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 +22 -3
- package/dist/adapters/express.js.map +1 -1
- package/dist/adapters/express.mjs +22 -3
- 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 +22 -3
- package/dist/adapters/mcp.js.map +1 -1
- package/dist/adapters/mcp.mjs +22 -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 +22 -3
- package/dist/adapters/nextjs.js.map +1 -1
- package/dist/adapters/nextjs.mjs +22 -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 +22 -3
- package/dist/adapters/sdk.js.map +1 -1
- package/dist/adapters/sdk.mjs +22 -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/bin/astrasync-claude-hook.js +84 -21
- package/dist/bin/astrasync-codex-hook.js +84 -21
- package/dist/bin/astrasync-guard.js +84 -21
- package/dist/bin/astrasync.js +85 -21
- package/dist/browser/background.js +84 -21
- package/dist/browser/background.js.map +1 -1
- package/dist/browser/background.mjs +84 -21
- 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/codex/index.d.mts +2 -2
- package/dist/codex/index.d.ts +2 -2
- package/dist/codex/index.js +84 -21
- package/dist/codex/index.js.map +1 -1
- package/dist/codex/index.mjs +84 -21
- 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 +84 -21
- package/dist/cursor/extension.js.map +1 -1
- package/dist/cursor/extension.mjs +84 -21
- 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/{express-DCXa1oqj.d.mts → express-B39o89gf.d.mts} +1 -1
- package/dist/{express-ClNtDhhc.d.ts → express-BuxKNO_q.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 +84 -21
- package/dist/gateway/gateway.js.map +1 -1
- package/dist/gateway/gateway.mjs +84 -21
- 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-CfHurO1P.d.ts → index-BG62SXso.d.ts} +1 -1
- package/dist/{index-D2ztkumS.d.ts → index-CLHdqs2M.d.ts} +1 -1
- package/dist/{index-Dr_XiN65.d.mts → index-CqydB4ks.d.mts} +1 -1
- package/dist/{index-BrNKDmiR.d.mts → index-DME3w3lf.d.mts} +1 -1
- package/dist/index.d.mts +9 -9
- package/dist/index.d.ts +9 -9
- package/dist/index.js +42 -3
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +41 -3
- package/dist/index.mjs.map +1 -1
- package/dist/local-evaluator/evaluator.d.mts +11 -2
- package/dist/local-evaluator/evaluator.d.ts +11 -2
- package/dist/local-evaluator/evaluator.js +20 -9
- package/dist/local-evaluator/evaluator.js.map +1 -1
- package/dist/local-evaluator/evaluator.mjs +20 -9
- package/dist/local-evaluator/evaluator.mjs.map +1 -1
- package/dist/{nextjs-DcQIk6Zj.d.mts → nextjs-D74W7wt-.d.mts} +1 -1
- package/dist/{nextjs-CEBVBsdi.d.ts → nextjs-Ddlw_J1J.d.ts} +1 -1
- package/dist/{sdk-CZkbSOeO.d.mts → sdk-Bn6bj7kt.d.mts} +1 -1
- package/dist/{sdk-H0JCLW2y.d.ts → sdk-CT7gdkfR.d.ts} +1 -1
- package/dist/transport/index.d.mts +2 -2
- package/dist/transport/index.d.ts +2 -2
- package/dist/{types-sy3tq8lp.d.mts → types-BntuzEEn.d.mts} +103 -1
- package/dist/{types-BV6abBnF.d.mts → types-DHu7m9HI.d.ts} +7 -2
- package/dist/{types-C23_uaY8.d.ts → types-Djw4GLtz.d.mts} +7 -2
- package/dist/{types-9tns4wyl.d.ts → types-SDu4Llbe.d.ts} +103 -1
- package/dist/ui/index.d.mts +1 -1
- package/dist/ui/index.d.ts +1 -1
- package/dist/verify.d.mts +13 -2
- package/dist/verify.d.ts +13 -2
- package/dist/verify.js +42 -3
- package/dist/verify.js.map +1 -1
- package/dist/verify.mjs +41 -3
- package/dist/verify.mjs.map +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.12.0";
|
|
130
130
|
|
|
131
131
|
// src/well-known.ts
|
|
132
132
|
var CACHE_TTL_MS = 60 * 60 * 1e3;
|
|
@@ -385,6 +385,7 @@ function createGuidanceResponse(_config, reason, options = {}) {
|
|
|
385
385
|
}
|
|
386
386
|
] : void 0,
|
|
387
387
|
correlationId: options.correlationId,
|
|
388
|
+
attemptId: options.attemptId,
|
|
388
389
|
verifiedAt: /* @__PURE__ */ new Date()
|
|
389
390
|
};
|
|
390
391
|
}
|
|
@@ -414,6 +415,8 @@ async function callVerifyAccessAPI(config, request) {
|
|
|
414
415
|
body.runtimeChallengeOptions = requestData.runtimeChallengeOptions;
|
|
415
416
|
if (requestData.invocationProtocol) body.invocationProtocol = requestData.invocationProtocol;
|
|
416
417
|
if (requestData.commerceArtifacts) body.commerceArtifacts = requestData.commerceArtifacts;
|
|
418
|
+
if (requestData.attemptId) body.attemptId = requestData.attemptId;
|
|
419
|
+
if (requestData.considerationSet) body.considerationSet = requestData.considerationSet;
|
|
417
420
|
body.sdkVersion = SDK_VERSION;
|
|
418
421
|
if (requestData.callerMetadata || requestData.clientIp || requestData.userAgent) {
|
|
419
422
|
const meta = {
|
|
@@ -441,6 +444,9 @@ async function callVerifyAccessAPI(config, request) {
|
|
|
441
444
|
if (response.status === 410) {
|
|
442
445
|
return {
|
|
443
446
|
success: true,
|
|
447
|
+
// 3.12.0 (Trust Record): keep the server-echoed attempt handle even on
|
|
448
|
+
// the synthesised 410 deny shape (echoed on every branch).
|
|
449
|
+
attemptId: typeof data?.attemptId === "string" ? data.attemptId : void 0,
|
|
444
450
|
access: {
|
|
445
451
|
allowed: false,
|
|
446
452
|
accessLevel: "none",
|
|
@@ -459,7 +465,8 @@ async function callVerifyAccessAPI(config, request) {
|
|
|
459
465
|
return {
|
|
460
466
|
success: false,
|
|
461
467
|
error: data.message || data.error || `API returned ${response.status}`,
|
|
462
|
-
correlationId: typeof data?.correlationId === "string" ? data.correlationId : void 0
|
|
468
|
+
correlationId: typeof data?.correlationId === "string" ? data.correlationId : void 0,
|
|
469
|
+
attemptId: typeof data?.attemptId === "string" ? data.attemptId : void 0
|
|
463
470
|
};
|
|
464
471
|
}
|
|
465
472
|
return data;
|
|
@@ -493,7 +500,13 @@ async function verify(config, request, options) {
|
|
|
493
500
|
if (mergedConfig.debug) {
|
|
494
501
|
console.log("[VerificationGateway] Returning cached result");
|
|
495
502
|
}
|
|
496
|
-
|
|
503
|
+
const hit = { ...cached };
|
|
504
|
+
if (request.attemptId) {
|
|
505
|
+
hit.attemptId = request.attemptId;
|
|
506
|
+
} else {
|
|
507
|
+
delete hit.attemptId;
|
|
508
|
+
}
|
|
509
|
+
return hit;
|
|
497
510
|
}
|
|
498
511
|
}
|
|
499
512
|
const enrichedRequest = { ...request };
|
|
@@ -513,6 +526,7 @@ async function verify(config, request, options) {
|
|
|
513
526
|
return createGuidanceResponse(mergedConfig, apiResponse.error, {
|
|
514
527
|
source: "api_error",
|
|
515
528
|
correlationId: apiResponse.correlationId,
|
|
529
|
+
attemptId: apiResponse.attemptId,
|
|
516
530
|
urls
|
|
517
531
|
});
|
|
518
532
|
}
|
|
@@ -548,6 +562,9 @@ async function verify(config, request, options) {
|
|
|
548
562
|
// Anonymous traffic has no session → correlationId is the per-attempt
|
|
549
563
|
// linking key (the sessionId-equivalent for anonymous callers).
|
|
550
564
|
correlationId: apiResponse.correlationId,
|
|
565
|
+
// 3.12.0 (Trust Record): server echoes the attempt-chain handle on
|
|
566
|
+
// every branch — denials included (the funnel outlives one deny).
|
|
567
|
+
attemptId: apiResponse.attemptId,
|
|
551
568
|
recommendation: apiResponse.recommendation,
|
|
552
569
|
recommendationReasons: apiResponse.recommendationReasons,
|
|
553
570
|
stepUpApproval: apiResponse.stepUpApproval,
|
|
@@ -599,6 +616,8 @@ async function verify(config, request, options) {
|
|
|
599
616
|
// v2.3.10 (defect #34, round-4): anonymous responses surface correlationId
|
|
600
617
|
// (no session row exists for unverified callers).
|
|
601
618
|
correlationId: apiResponse.correlationId,
|
|
619
|
+
// 3.12.0 (Trust Record): server-echoed attempt-chain handle.
|
|
620
|
+
attemptId: apiResponse.attemptId,
|
|
602
621
|
runtimeChallenge: apiResponse.runtimeChallenge,
|
|
603
622
|
tokenGuidance: apiResponse.tokenGuidance,
|
|
604
623
|
recommendation: apiResponse.recommendation,
|
|
@@ -643,6 +662,24 @@ async function recordDecision(config, sessionId, decision, reason) {
|
|
|
643
662
|
}).catch(() => {
|
|
644
663
|
});
|
|
645
664
|
}
|
|
665
|
+
async function reportAttempt(config, report) {
|
|
666
|
+
const apiBaseUrl = config.apiBaseUrl || DEFAULT_CONFIG.apiBaseUrl;
|
|
667
|
+
const headers = { "Content-Type": "application/json" };
|
|
668
|
+
if (config.apiKey) {
|
|
669
|
+
headers["Authorization"] = `Bearer ${config.apiKey}`;
|
|
670
|
+
headers["X-API-Key"] = config.apiKey;
|
|
671
|
+
}
|
|
672
|
+
const body = {
|
|
673
|
+
...report,
|
|
674
|
+
...!report.counterpartyId && config.counterpartyId && { counterpartyId: config.counterpartyId }
|
|
675
|
+
};
|
|
676
|
+
await fetch(`${apiBaseUrl}/agents/verify-access/attempt-report`, {
|
|
677
|
+
method: "POST",
|
|
678
|
+
headers,
|
|
679
|
+
body: JSON.stringify(body)
|
|
680
|
+
}).catch(() => {
|
|
681
|
+
});
|
|
682
|
+
}
|
|
646
683
|
async function fetchRoutes(config, counterpartyId) {
|
|
647
684
|
if (!counterpartyId) return null;
|
|
648
685
|
const headers = { "Content-Type": "application/json" };
|
|
@@ -6100,6 +6137,7 @@ export {
|
|
|
6100
6137
|
prefetchWellKnown,
|
|
6101
6138
|
quickVerify,
|
|
6102
6139
|
recordDecision2 as recordDecision,
|
|
6140
|
+
reportAttempt,
|
|
6103
6141
|
reportUnregisteredAttempt,
|
|
6104
6142
|
sanitizeHeaders,
|
|
6105
6143
|
sdk_exports as sdk,
|