@astrasyncai/verification-gateway 5.4.2 → 5.6.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 +74 -21
- package/dist/adapters/express.d.mts +1 -1
- package/dist/adapters/express.d.ts +1 -1
- package/dist/adapters/express.js +12 -3
- package/dist/adapters/express.js.map +1 -1
- package/dist/adapters/express.mjs +12 -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 +12 -3
- package/dist/adapters/mcp.js.map +1 -1
- package/dist/adapters/mcp.mjs +12 -3
- 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 +12 -3
- package/dist/adapters/nextjs.js.map +1 -1
- package/dist/adapters/nextjs.mjs +12 -3
- package/dist/adapters/nextjs.mjs.map +1 -1
- package/dist/adapters/sdk.d.mts +41 -1
- package/dist/adapters/sdk.d.ts +41 -1
- package/dist/adapters/sdk.js +54 -3
- package/dist/adapters/sdk.js.map +1 -1
- package/dist/adapters/sdk.mjs +54 -3
- 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 +12 -3
- package/dist/bin/astrasync-codex-hook.js +12 -3
- package/dist/bin/astrasync-guard.js +12 -3
- package/dist/bin/astrasync.js +13 -3
- package/dist/browser/background.js +12 -3
- package/dist/browser/background.js.map +1 -1
- package/dist/browser/background.mjs +12 -3
- 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 +12 -3
- package/dist/codex/index.js.map +1 -1
- package/dist/codex/index.mjs +12 -3
- package/dist/codex/index.mjs.map +1 -1
- package/dist/cursor/extension.js +12 -3
- package/dist/cursor/extension.js.map +1 -1
- package/dist/cursor/extension.mjs +12 -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 +1 -1
- package/dist/edge-core/index.d.ts +1 -1
- package/dist/edge-core/index.js +12 -3
- package/dist/edge-core/index.js.map +1 -1
- package/dist/edge-core/index.mjs +12 -3
- package/dist/edge-core/index.mjs.map +1 -1
- package/dist/gateway/gateway.js +12 -3
- package/dist/gateway/gateway.js.map +1 -1
- package/dist/gateway/gateway.mjs +12 -3
- 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 +121 -4
- package/dist/index.d.ts +121 -4
- package/dist/index.js +54 -3
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +54 -3
- 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-Bd2O3eX1.d.mts → types-BCmHFdkJ.d.mts} +78 -1
- package/dist/{types-BU04qAAR.d.mts → types-BK_pRNSs.d.mts} +78 -1
- package/dist/{types-BU04qAAR.d.ts → types-BK_pRNSs.d.ts} +78 -1
- package/dist/{types-DMChboN_.d.ts → types-CwY5IY-0.d.ts} +78 -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 +12 -3
- package/dist/verify.js.map +1 -1
- package/dist/verify.mjs +12 -3
- package/dist/verify.mjs.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -99,7 +99,8 @@ const result = await gateway.verify({
|
|
|
99
99
|
purpose: 'data-exchange',
|
|
100
100
|
});
|
|
101
101
|
|
|
102
|
-
|
|
102
|
+
// 5.0.0: the accessLevel band is gone — the decision is the two axes.
|
|
103
|
+
if (result.identityVerified && result.policyAllowed) {
|
|
103
104
|
// Safe to interact with this agent
|
|
104
105
|
console.log(`Trust score: ${result.agent?.trustScore}`);
|
|
105
106
|
}
|
|
@@ -330,16 +331,19 @@ rest.use(
|
|
|
330
331
|
with `X-Astra-Id` so the inner middleware can verify the marker matches
|
|
331
332
|
the claimed agent. The marker only gates the dedupe-skip decision.
|
|
332
333
|
|
|
333
|
-
## Access
|
|
334
|
+
## Access Decision (5.0.0 — two axes, no bands)
|
|
334
335
|
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
|
339
|
-
|
|
|
340
|
-
| `
|
|
341
|
-
| `
|
|
342
|
-
|
|
336
|
+
The graded `accessLevel` band was removed in 5.0.0. A verification is now two
|
|
337
|
+
explicit booleans:
|
|
338
|
+
|
|
339
|
+
| Axis | Question it answers |
|
|
340
|
+
| ------------------ | -------------------------------------------------------- |
|
|
341
|
+
| `identityVerified` | WHO — did the caller resolve to a registered agent? |
|
|
342
|
+
| `policyAllowed` | WHAT — does this request fit the agent's declared PDLSS? |
|
|
343
|
+
|
|
344
|
+
Both true → proceed. Either false → `failures[]` says exactly which dimension
|
|
345
|
+
failed and what fixes it. Value-gating (autonomous limit / hard limit) rides
|
|
346
|
+
`recommendation` + `stepUpApproval`, not an access band.
|
|
343
347
|
|
|
344
348
|
## Trust Levels
|
|
345
349
|
|
|
@@ -394,8 +398,9 @@ Agents can provide credentials via:
|
|
|
394
398
|
|
|
395
399
|
```typescript
|
|
396
400
|
interface VerificationResult {
|
|
397
|
-
|
|
398
|
-
|
|
401
|
+
// 5.0.0: two explicit axes replaced the old verified/accessLevel band.
|
|
402
|
+
identityVerified: boolean; // WHO: the caller resolved to a registered agent
|
|
403
|
+
policyAllowed: boolean; // WHAT: the request fits the agent's PDLSS boundary
|
|
399
404
|
|
|
400
405
|
agent?: {
|
|
401
406
|
astraId: string;
|
|
@@ -463,12 +468,62 @@ When a transaction value is between the agent's Autonomous Limit and Hard Limit,
|
|
|
463
468
|
interface StepUpApprovalInfo {
|
|
464
469
|
approvalId: string; // Capability token (UUID)
|
|
465
470
|
pollUrl: string; // GET /api/step-up-approvals/poll/:approvalId
|
|
466
|
-
expiresAt: string; // ISO-8601,
|
|
471
|
+
expiresAt: string; // ISO-8601 (decision window: 30 min, aligned to the intent mandate)
|
|
467
472
|
}
|
|
468
473
|
```
|
|
469
474
|
|
|
470
475
|
Poll the `pollUrl` (unauthenticated, rate-limited 60 req/min) to check if the owner approved. The `getApprovalPollingInfo(result)` helper extracts it from a `VerificationResult`.
|
|
471
476
|
|
|
477
|
+
## Checkout & settlement (astra-pay)
|
|
478
|
+
|
|
479
|
+
The first-party commerce rail: an agent shops under its ASTRA-id, holds NO
|
|
480
|
+
payment credential, and the platform settles from the owner's saved
|
|
481
|
+
instrument. Two phases discriminate quote from money movement:
|
|
482
|
+
|
|
483
|
+
- `commercePhase: 'quote'` (or unphased) — verification only, never settles.
|
|
484
|
+
- `commercePhase: 'confirm'` — the ONLY leg that can settle. Use
|
|
485
|
+
`client.confirmCheckout({ astraId, transactionValue, currency,
|
|
486
|
+
checkoutSessionId, checkoutItems, counterpartyUrl })`; `checkoutSessionId`
|
|
487
|
+
is the per-cart idempotency key (one order row per session, normative).
|
|
488
|
+
|
|
489
|
+
Read `result.settlementOutcome.status` — never `success` alone:
|
|
490
|
+
|
|
491
|
+
| status | Meaning | Your action |
|
|
492
|
+
| ------------------- | ----------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------- |
|
|
493
|
+
| `settled` | Charged; `orderId` present | Fulfil / mark paid |
|
|
494
|
+
| `requires_approval` | Held for human step-up — not a failure | Record as pending; a re-drive follows approval |
|
|
495
|
+
| `pending_merchant` | 5.5.0 self-settle: YOU charge (see below) | Charge with the `settlementToken`, then report |
|
|
496
|
+
| `failed` | Charge declined (`failureCode`) | Mark failed |
|
|
497
|
+
| `requires_action` | 3DS/SCA needed on the saved card | Per your policy |
|
|
498
|
+
| `no_instrument` | Policy passed, no chargeable card on file | Terminal on autonomous; NON-terminal after approval — the human's approval survives; re-drive the same session once a card exists |
|
|
499
|
+
| _anything else_ | A status newer than your SDK | Treat as PENDING, never failed (open union, 5.5.0) |
|
|
500
|
+
|
|
501
|
+
**Self-settling merchants (5.5.0, `settlement_mode='self_settle'`):** the
|
|
502
|
+
confirm result carries `settlementToken` (agent-blind
|
|
503
|
+
`{ stripeCustomerId, stripePaymentMethodId, amountMinor, currency, sessionId,
|
|
504
|
+
orderId, jti, statementSuffix, expiresAt }`) instead of a completed charge.
|
|
505
|
+
Charge on your own integration with Stripe idempotency key
|
|
506
|
+
`voucher:<token.jti>` and `metadata: { jti, sessionId }`, then call
|
|
507
|
+
`client.reportSettlement({ sessionId, status, amountMinor, currency,
|
|
508
|
+
processorRef })` so the buyer's dashboard and the agent's poll surface
|
|
509
|
+
reconcile. Amounts must match the order exactly; replays are safe. Never
|
|
510
|
+
expose the token to the agent plane or logs.
|
|
511
|
+
|
|
512
|
+
**Fulfilment PII (5.6.0):** first-party confirm results carry a
|
|
513
|
+
`fulfilment: { email, emailSource }` block — you ALWAYS get a fulfilment
|
|
514
|
+
email for a first-party order. `emailSource: 'agent_provided'` means the
|
|
515
|
+
agent passed a `buyerEmail` (on the bridge handoff body, the verify-access
|
|
516
|
+
request, or your `confirmCheckout({ buyerEmail })` call);
|
|
517
|
+
`emailSource: 'account'` means the platform defaulted to the buyer's account
|
|
518
|
+
email. Emails arrive canonicalized (trimmed, lower-cased). Precedence: an
|
|
519
|
+
explicit handoff-body `buyerEmail` wins over `fulfilment.email`'s account
|
|
520
|
+
default. Store the email with the pending order and fulfil against it only
|
|
521
|
+
once the order reaches `settled` / `pending_merchant`. All of it is
|
|
522
|
+
transit-only — AstraSync stores nothing; treat `fulfilment` as merchant-only
|
|
523
|
+
material (the bridge strips it from the agent plane). Shipping addresses
|
|
524
|
+
never transit AstraSync: take them agent → your fulfilment endpoint
|
|
525
|
+
directly, joined by `sessionId`.
|
|
526
|
+
|
|
472
527
|
## Settlement Artifacts
|
|
473
528
|
|
|
474
529
|
On a clean merchant-mediated grant where the owner has a verified payment instrument, verify-access returns a `settlement` object (wire format **v2**, versioned via the `ver: 2` claim — verify/redeem reject other versions):
|
|
@@ -543,7 +598,6 @@ interface GatewayConfig {
|
|
|
543
598
|
|
|
544
599
|
// Optional
|
|
545
600
|
apiKey?: string; // For authenticated requests
|
|
546
|
-
defaultAccessLevel?: string; // Default: 'guidance'
|
|
547
601
|
cacheTtl?: number; // Cache duration in seconds (default: 300)
|
|
548
602
|
debug?: boolean; // Enable debug logging
|
|
549
603
|
|
|
@@ -575,12 +629,11 @@ interface GatewayConfig {
|
|
|
575
629
|
// 404 case). Set true for tests where the extra request is undesirable.
|
|
576
630
|
disableInitChecks?: boolean;
|
|
577
631
|
|
|
578
|
-
// @deprecated — removed as functional config in v2.3.0
|
|
579
|
-
//
|
|
580
|
-
//
|
|
581
|
-
//
|
|
582
|
-
//
|
|
583
|
-
// /api/endpoints registration.
|
|
632
|
+
// @deprecated — removed as functional config in v2.3.0; the accessLevel
|
|
633
|
+
// band itself was removed in 5.0.0 (identityVerified + policyAllowed are
|
|
634
|
+
// the decision axes). Setting these has no effect (a one-shot
|
|
635
|
+
// console.warn fires). To gate access to your endpoint, configure
|
|
636
|
+
// trust_score_requirement server-side via the /api/endpoints registration.
|
|
584
637
|
minTrustScore?: number;
|
|
585
638
|
minTrustScoreForFull?: number;
|
|
586
639
|
}
|
|
@@ -948,7 +1001,7 @@ use the upgrade flow (coming soon) or retire-and-re-register.
|
|
|
948
1001
|
### v2.4.4 — Round-12 partner integration testing
|
|
949
1002
|
|
|
950
1003
|
- **F9** — `ExpressMiddlewareOptions.evaluateAlwaysIfCredentialed`: when true + credentials present + route-none, the middleware calls verify-access for the audit trail + `req.agentVerification` population, then proceeds without enforcement. Default false preserves existing behaviour. Use for tiered-response rendering on routes that grant public access but want caller identity visible to the handler.
|
|
951
|
-
- **F12** — `defaultOnDenied` / `defaultMcpDenied` synthesise `access_level.insufficient` failure entry on accessLevel-below-route + trust-score-below-route denials. Guidance text references the step-up verification flow ("coming soon — ships this month") only. Prior denials carried `INSUFFICIENT_ACCESS` with empty `failures[]` / `denialReasons[]` arrays.
|
|
1004
|
+
- **F12** — `defaultOnDenied` / `defaultMcpDenied` synthesise `access_level.insufficient` failure entry on accessLevel-below-route + trust-score-below-route denials. _(Historical note: the accessLevel band was removed in 5.0.0 — current denials carry the two-axis `identityVerified`/`policyAllowed` shape.)_ Guidance text references the step-up verification flow ("coming soon — ships this month") only. Prior denials carried `INSUFFICIENT_ACCESS` with empty `failures[]` / `denialReasons[]` arrays.
|
|
952
1005
|
- **F16** — `register()` now passes the API response's `warnings[]` through verbatim on both 201 (sync) and 202 (pending-approval) paths. Pre-fix the SDK silently dropped backend advisories like `no_callback_endpoint`. `RegisterResult` + `PendingRegistrationResponse` + `RegistrationResponse` types extended.
|
|
953
1006
|
- **F19** — MCP middleware purpose pass-through. The hardcoded `purpose: 'mcp_invoke'` is now a fallback; resolution precedence is `X-Astra-Purpose` header → `params._meta.astrasync.purpose` → `'mcp_invoke'` default. Adds `invocationProtocol: 'mcp'` to the verify-access body so transport is marked separately from intent. Debug-level `purpose_source` log line per call for adoption tracking + support triage.
|
|
954
1007
|
- **`mcpToPdlss`** signature extended to accept optional `headerPurpose` + `toolArgumentPurpose` args; return type gains `purposeSource: 'header' | 'tool_argument' | 'default_mcp_invoke'`.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { RequestHandler, Request } from 'express';
|
|
2
|
-
import { d as VerificationResult, E as ExpressMiddlewareOptions, a as AstraSyncCredentials } from '../types-
|
|
2
|
+
import { d as VerificationResult, E as ExpressMiddlewareOptions, a as AstraSyncCredentials } from '../types-BK_pRNSs.mjs';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* AstraSync Universal Verification Gateway - Express Middleware
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { RequestHandler, Request } from 'express';
|
|
2
|
-
import { d as VerificationResult, E as ExpressMiddlewareOptions, a as AstraSyncCredentials } from '../types-
|
|
2
|
+
import { d as VerificationResult, E as ExpressMiddlewareOptions, a as AstraSyncCredentials } from '../types-BK_pRNSs.js';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* AstraSync Universal Verification Gateway - Express Middleware
|
package/dist/adapters/express.js
CHANGED
|
@@ -26,7 +26,7 @@ __export(express_exports, {
|
|
|
26
26
|
module.exports = __toCommonJS(express_exports);
|
|
27
27
|
|
|
28
28
|
// src/version.ts
|
|
29
|
-
var SDK_VERSION = "5.
|
|
29
|
+
var SDK_VERSION = "5.6.0";
|
|
30
30
|
|
|
31
31
|
// src/http.ts
|
|
32
32
|
var SDK_USER_AGENT = `astrasync-sdk/${SDK_VERSION}`;
|
|
@@ -449,6 +449,7 @@ async function callVerifyAccessAPI(config, request) {
|
|
|
449
449
|
if (requestData.commercePhase) body.commercePhase = requestData.commercePhase;
|
|
450
450
|
if (requestData.checkoutSessionId) body.checkoutSessionId = requestData.checkoutSessionId;
|
|
451
451
|
if (requestData.checkoutItems) body.checkoutItems = requestData.checkoutItems;
|
|
452
|
+
if (requestData.buyerEmail) body.buyerEmail = requestData.buyerEmail;
|
|
452
453
|
if (requestData.commerceArtifacts) body.commerceArtifacts = requestData.commerceArtifacts;
|
|
453
454
|
if (requestData.attemptId) body.attemptId = requestData.attemptId;
|
|
454
455
|
if (requestData.considerationSet) body.considerationSet = requestData.considerationSet;
|
|
@@ -621,7 +622,12 @@ async function verify(config, request, options) {
|
|
|
621
622
|
recommendationReasons: apiResponse.recommendationReasons,
|
|
622
623
|
stepUpApproval: apiResponse.stepUpApproval,
|
|
623
624
|
settlement: apiResponse.settlement,
|
|
624
|
-
settlementOutcome: apiResponse.settlementOutcome
|
|
625
|
+
settlementOutcome: apiResponse.settlementOutcome,
|
|
626
|
+
// 5.5.0 self-settlement: merchant-only material — passes through to the
|
|
627
|
+
// MERCHANT caller only (bridge callers strip it before the agent plane).
|
|
628
|
+
settlementToken: apiResponse.settlementToken,
|
|
629
|
+
// 5.6.0: fulfilment contact — merchant-only lane, same strip rule.
|
|
630
|
+
fulfilment: apiResponse.fulfilment
|
|
625
631
|
};
|
|
626
632
|
return result2;
|
|
627
633
|
}
|
|
@@ -679,7 +685,10 @@ async function verify(config, request, options) {
|
|
|
679
685
|
warningHeader: apiResponse.warningHeader,
|
|
680
686
|
stepUpApproval: apiResponse.stepUpApproval,
|
|
681
687
|
settlement: apiResponse.settlement,
|
|
682
|
-
settlementOutcome: apiResponse.settlementOutcome
|
|
688
|
+
settlementOutcome: apiResponse.settlementOutcome,
|
|
689
|
+
settlementToken: apiResponse.settlementToken,
|
|
690
|
+
// 5.6.0: fulfilment contact — merchant-only lane, same strip rule.
|
|
691
|
+
fulfilment: apiResponse.fulfilment
|
|
683
692
|
};
|
|
684
693
|
if (result.recommendation === "deny") {
|
|
685
694
|
result.policyAllowed = false;
|