@astrasyncai/verification-gateway 5.4.0 → 5.4.2

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.
Files changed (133) hide show
  1. package/dist/adapter-interface/interface.d.mts +2 -3
  2. package/dist/adapter-interface/interface.d.ts +2 -3
  3. package/dist/adapters/express.d.mts +63 -4
  4. package/dist/adapters/express.d.ts +63 -4
  5. package/dist/adapters/express.js +9 -2
  6. package/dist/adapters/express.js.map +1 -1
  7. package/dist/adapters/express.mjs +9 -2
  8. package/dist/adapters/express.mjs.map +1 -1
  9. package/dist/adapters/mcp.d.mts +396 -4
  10. package/dist/adapters/mcp.d.ts +396 -4
  11. package/dist/adapters/mcp.js +9 -2
  12. package/dist/adapters/mcp.js.map +1 -1
  13. package/dist/adapters/mcp.mjs +9 -2
  14. package/dist/adapters/mcp.mjs.map +1 -1
  15. package/dist/adapters/nextjs.d.mts +22 -4
  16. package/dist/adapters/nextjs.d.ts +22 -4
  17. package/dist/adapters/nextjs.js +9 -2
  18. package/dist/adapters/nextjs.js.map +1 -1
  19. package/dist/adapters/nextjs.mjs +9 -2
  20. package/dist/adapters/nextjs.mjs.map +1 -1
  21. package/dist/adapters/sdk.d.mts +157 -3
  22. package/dist/adapters/sdk.d.ts +157 -3
  23. package/dist/adapters/sdk.js +35 -15
  24. package/dist/adapters/sdk.js.map +1 -1
  25. package/dist/adapters/sdk.mjs +35 -15
  26. package/dist/adapters/sdk.mjs.map +1 -1
  27. package/dist/agent/index.d.mts +224 -3
  28. package/dist/agent/index.d.ts +224 -3
  29. package/dist/agent/index.js +1 -1
  30. package/dist/agent/index.js.map +1 -1
  31. package/dist/agent/index.mjs +1 -1
  32. package/dist/agent/index.mjs.map +1 -1
  33. package/dist/bin/astrasync-claude-hook.js +9 -2
  34. package/dist/bin/astrasync-codex-hook.js +9 -2
  35. package/dist/bin/astrasync-guard.js +9 -2
  36. package/dist/bin/astrasync.js +9 -2
  37. package/dist/browser/background.js +9 -2
  38. package/dist/browser/background.js.map +1 -1
  39. package/dist/browser/background.mjs +9 -2
  40. package/dist/browser/background.mjs.map +1 -1
  41. package/dist/browser/browser-adapter.d.mts +1 -5
  42. package/dist/browser/browser-adapter.d.ts +1 -5
  43. package/dist/claude-code/claude-code-adapter.d.mts +1 -5
  44. package/dist/claude-code/claude-code-adapter.d.ts +1 -5
  45. package/dist/cli/index.d.mts +1 -5
  46. package/dist/cli/index.d.ts +1 -5
  47. package/dist/cli/index.js +1 -1
  48. package/dist/cli/index.js.map +1 -1
  49. package/dist/cli/index.mjs +1 -1
  50. package/dist/cli/index.mjs.map +1 -1
  51. package/dist/codex/index.d.mts +1 -5
  52. package/dist/codex/index.d.ts +1 -5
  53. package/dist/codex/index.js +9 -2
  54. package/dist/codex/index.js.map +1 -1
  55. package/dist/codex/index.mjs +9 -2
  56. package/dist/codex/index.mjs.map +1 -1
  57. package/dist/cursor/cursor-adapter.d.mts +1 -5
  58. package/dist/cursor/cursor-adapter.d.ts +1 -5
  59. package/dist/cursor/extension.d.mts +1 -5
  60. package/dist/cursor/extension.d.ts +1 -5
  61. package/dist/cursor/extension.js +9 -2
  62. package/dist/cursor/extension.js.map +1 -1
  63. package/dist/cursor/extension.mjs +9 -2
  64. package/dist/cursor/extension.mjs.map +1 -1
  65. package/dist/edge-config.d.mts +1 -1
  66. package/dist/edge-config.d.ts +1 -1
  67. package/dist/edge-config.js +1 -1
  68. package/dist/edge-config.js.map +1 -1
  69. package/dist/edge-config.mjs +1 -1
  70. package/dist/edge-config.mjs.map +1 -1
  71. package/dist/edge-core/index.d.mts +1 -1
  72. package/dist/edge-core/index.d.ts +1 -1
  73. package/dist/edge-core/index.js +9 -2
  74. package/dist/edge-core/index.js.map +1 -1
  75. package/dist/edge-core/index.mjs +9 -2
  76. package/dist/edge-core/index.mjs.map +1 -1
  77. package/dist/gateway/gateway.d.mts +2 -3
  78. package/dist/gateway/gateway.d.ts +2 -3
  79. package/dist/gateway/gateway.js +9 -2
  80. package/dist/gateway/gateway.js.map +1 -1
  81. package/dist/gateway/gateway.mjs +9 -2
  82. package/dist/gateway/gateway.mjs.map +1 -1
  83. package/dist/git-trigger/git-hooks.d.mts +253 -3
  84. package/dist/git-trigger/git-hooks.d.ts +253 -3
  85. package/dist/index.d.mts +4506 -42
  86. package/dist/index.d.ts +4506 -42
  87. package/dist/index.js +35 -15
  88. package/dist/index.js.map +1 -1
  89. package/dist/index.mjs +35 -15
  90. package/dist/index.mjs.map +1 -1
  91. package/dist/interface-q1WrMsB1.d.mts +365 -0
  92. package/dist/interface-q1WrMsB1.d.ts +365 -0
  93. package/dist/local-evaluator/evaluator.d.mts +2 -3
  94. package/dist/local-evaluator/evaluator.d.ts +2 -3
  95. package/dist/registration/index.js +1 -1
  96. package/dist/registration/index.js.map +1 -1
  97. package/dist/registration/index.mjs +1 -1
  98. package/dist/registration/index.mjs.map +1 -1
  99. package/dist/transport/index.d.mts +1324 -4
  100. package/dist/transport/index.d.ts +1324 -4
  101. package/dist/transport/index.js +1 -1
  102. package/dist/transport/index.js.map +1 -1
  103. package/dist/transport/index.mjs +1 -1
  104. package/dist/transport/index.mjs.map +1 -1
  105. package/dist/{types-DGh2akuh.d.ts → types-BRz2U0Pn.d.ts} +2 -2
  106. package/dist/{types-76TB0fxW.d.ts → types-BU04qAAR.d.mts} +59 -213
  107. package/dist/{types-CD1F9fmp.d.mts → types-BU04qAAR.d.ts} +59 -213
  108. package/dist/types-Bd2O3eX1.d.mts +769 -0
  109. package/dist/types-BfILnheI.d.mts +189 -0
  110. package/dist/types-BfILnheI.d.ts +189 -0
  111. package/dist/{types-z_RNjHWm.d.mts → types-CfBpm3w5.d.mts} +2 -2
  112. package/dist/types-DMChboN_.d.ts +769 -0
  113. package/dist/ui/index.d.mts +1 -2
  114. package/dist/ui/index.d.ts +1 -2
  115. package/dist/verify.d.mts +1 -1
  116. package/dist/verify.d.ts +1 -1
  117. package/dist/verify.js +9 -2
  118. package/dist/verify.js.map +1 -1
  119. package/dist/verify.mjs +9 -2
  120. package/dist/verify.mjs.map +1 -1
  121. package/package.json +1 -1
  122. package/dist/express-BIAT2pe0.d.mts +0 -69
  123. package/dist/express-D3Tf-b23.d.ts +0 -69
  124. package/dist/index-BVJkTyIF.d.mts +0 -248
  125. package/dist/index-By021oSN.d.mts +0 -1469
  126. package/dist/index-DaMXZabg.d.ts +0 -248
  127. package/dist/index-iJ9_DdLk.d.ts +0 -1469
  128. package/dist/mcp-BqfTDZLh.d.mts +0 -397
  129. package/dist/mcp-OrVOrH-s.d.ts +0 -397
  130. package/dist/nextjs-DGJXzWst.d.mts +0 -28
  131. package/dist/nextjs-xM-jdNrX.d.ts +0 -28
  132. package/dist/sdk-C1IOA5LE.d.ts +0 -173
  133. package/dist/sdk-C6_-6D-9.d.mts +0 -173
@@ -1,4 +1,4 @@
1
- import { i as CounterpartyType, T as TokenGuidance } from './types-76TB0fxW.js';
1
+ import { C as CounterpartyType, T as TokenGuidance } from './types-BfILnheI.js';
2
2
 
3
3
  /**
4
4
  * AstraSync Gateway - Types for gateway modes, local evaluation, and adapter interface.
@@ -172,4 +172,4 @@ interface InterceptResult {
172
172
  skipReason?: string;
173
173
  }
174
174
 
175
- export type { AgentAction as A, InterceptResult as I, LocalPolicy as L, PDLSSContext as P, VerificationDecision as V, AstraSyncGatewayConfig as a, LocalPurposeRule as b, LocalRiskThresholds as c, LocalScope as d };
175
+ export type { AgentAction as A, InterceptResult as I, LocalPolicy as L, PDLSSContext as P, VerificationDecision as V, AstraSyncGatewayConfig as a, LocalPurposeRule as b };
@@ -1,4 +1,54 @@
1
- import { ObservedMetadata } from './metadata-capture.js';
1
+ /**
2
+ * The captured, sanitised view of an inbound agent's request metadata. Attached
3
+ * to verify-access / beacon payloads as `callerMetadata.observedMetadata`.
4
+ */
5
+ interface ObservedMetadata {
6
+ /** Header name → value, secrets removed, verbatim otherwise. */
7
+ headers: Record<string, string>;
8
+ /**
9
+ * Safe key-format prefix of a credential header (e.g. `sk-ant-api03`,
10
+ * `sk-proj`, `AIza`) — a platform signal, NEVER the secret. Absent if no
11
+ * credential header was present or none matched a known format.
12
+ */
13
+ apiKeyFormat?: string;
14
+ /**
15
+ * The subset of `headers` that are known platform-signal headers
16
+ * (`openai-organization`, `x-goog-user-project`, `anthropic-version`, …),
17
+ * pulled out for convenient detection + display. Values are the same
18
+ * sanitised strings as in `headers`.
19
+ */
20
+ platformHeaders?: Record<string, string>;
21
+ /**
22
+ * Connection-layer signals (IP, ASN, country, TLS version, HTTP version,
23
+ * device class, TLS fingerprint). Edge adapters populate this from the
24
+ * platform's native connection surface — the authoritative source. SDK
25
+ * adapters populate it as a fallback via {@link deriveConnectionFromHeaders}
26
+ * when a CDN in front of the merchant injected the equivalent headers;
27
+ * absent when neither source had anything.
28
+ */
29
+ connection?: Record<string, string>;
30
+ /**
31
+ * Number of cookie pairs the caller sent. The `cookie` header VALUE is a
32
+ * secret and is always dropped; the COUNT is a client-shape signal
33
+ * (browsers carry cookies, most automation carries none) that would
34
+ * otherwise be unobservable downstream. Absent when no cookie header
35
+ * arrived.
36
+ */
37
+ cookieCount?: number;
38
+ /**
39
+ * Query-string parameter NAMES (deduped, lowercased) — values are NEVER
40
+ * captured (they routinely carry OAuth codes, tokens, and PII, and no
41
+ * deny-list is complete). Names alone fingerprint client shape. Populated
42
+ * by the edge path, which sees the raw query string.
43
+ */
44
+ queryKeys?: string[];
45
+ /**
46
+ * Version of the capture semantics this object was produced under — see
47
+ * {@link CAPTURE_SCHEMA_VERSION}. Optional for backward compatibility with
48
+ * metadata captured before the field existed.
49
+ */
50
+ schemaVersion?: number;
51
+ }
2
52
 
3
53
  /**
4
54
  * AstraSync Universal Verification Gateway Types
@@ -228,62 +278,6 @@ interface AppliedPolicy {
228
278
  boundaryName: string;
229
279
  policyVersion: string;
230
280
  }
231
- /**
232
- * Structured "why" of a verification decision the merchant receives.
233
- *
234
- * Tells the merchant whether the agent ID was verified, whether the runtime
235
- * challenge succeeded, whether the request was within PDLSS, and the agent's
236
- * actual dynamic trust score — without exposing thresholds, scope lists, or
237
- * other-tenant counterparty membership.
238
- *
239
- * `attestations` is empty unless the calling endpoint's access policy
240
- * declared `required_attestations`. Each attestation carries a blockchain
241
- * proof reference (or, in the future, a full ZKP) so the merchant can verify
242
- * the underlying claim without seeing the raw underlying data (e.g. the
243
- * Persona/ConnectID transaction).
244
- */
245
- interface VerificationContext {
246
- idVerified: boolean;
247
- runtimeChallenge: {
248
- status: 'passed' | 'skipped' | 'failed' | 'timeout' | 'not_supported';
249
- checkedAt: string | null;
250
- };
251
- pdlssCheck: {
252
- /** Outcome only — no thresholds disclosed. */
253
- result: 'within' | 'exceeded' | 'denied' | 'not_evaluated';
254
- /** Category-level only. */
255
- purpose: 'approved' | 'denied';
256
- scope: 'approved' | 'denied';
257
- };
258
- /** Live composite score at decision time (not the stale snapshot column). */
259
- dynamicTrustScore: number;
260
- attestations: Attestation[];
261
- }
262
- /**
263
- * Attestation returned in `VerificationContext.attestations`.
264
- *
265
- * `proofType: 'reference'` (interim) means `proof` is a blockchain txn hash
266
- * the merchant CAN verify against on-chain records but doesn't HAVE to.
267
- * `proofType: 'zkp'` (future) means `proof` is a zero-knowledge proof.
268
- * Wire shape is forward-compatible — clients reading 'reference' today won't
269
- * break when it becomes 'zkp'.
270
- */
271
- interface Attestation {
272
- /** Attestation kind (e.g. `verified_human_party`). */
273
- type: string;
274
- status: 'passed' | 'failed';
275
- /**
276
- * ISO-8601 timestamp of the underlying check (when KYC/IDV/AML actually ran).
277
- * Merchants compare this against their `maxAgeDays` requirement on the
278
- * endpoint to enforce per-attestation freshness. Distinct from `validUntil`:
279
- * `checkedAt` is when the data was sourced; `validUntil` is when the issuer
280
- * stops vouching for it.
281
- */
282
- checkedAt: string;
283
- validUntil?: string;
284
- proofType: 'reference' | 'zkp';
285
- proof: string;
286
- }
287
281
  /**
288
282
  * Guidance information for unverified agents
289
283
  */
@@ -490,9 +484,15 @@ interface VerificationResult {
490
484
  * 5.3.0 (astra-pay): sanitized outcome of first-party charge-at-redeem
491
485
  * settlement. Carries NO voucher/instrument material — the settlement channel
492
486
  * stays merchant-only; this is the result the agent plane is allowed to see.
487
+ *
488
+ * 5.4.2: `requires_approval` — the transaction is HELD for human step-up
489
+ * approval. Not a failure: record the order as pending; after the human
490
+ * approves, the platform re-drives the confirm with the SAME
491
+ * checkoutSessionId and that re-drive carries the settling outcome
492
+ * (one order row per session — the re-drive claims the same row).
493
493
  */
494
494
  interface SettlementOutcomeInfo {
495
- status: 'settled' | 'failed' | 'requires_action' | 'no_instrument';
495
+ status: 'settled' | 'failed' | 'requires_action' | 'no_instrument' | 'requires_approval';
496
496
  /** First-party order id — the buyer sees the purchase in their AstraSync
497
497
  * dashboard orders view (no public receipt page). */
498
498
  orderId?: string;
@@ -687,42 +687,6 @@ interface ConsiderationSet {
687
687
  /** True when `items` was truncated to the cap. */
688
688
  truncated?: boolean;
689
689
  }
690
- /**
691
- * Terminal (or notable) outcome of an attempt chain, reported post-hoc via
692
- * `reportAttempt`. Mirrors the backend's `attemptReportSchema.outcome` 1:1.
693
- */
694
- interface AttemptOutcome {
695
- kind: 'settled' | 'blocked_step_up' | 'failed' | 'high_value_action';
696
- /** Dotted ACTION-axis token for the failure class, e.g. `commerce.catalog.sku_not_found` (≤128 chars). */
697
- dimension?: string;
698
- /** Human-readable detail (≤512 chars). */
699
- reason?: string;
700
- /** For `high_value_action`: the non-payment conversion type. */
701
- actionType?: 'lead' | 'signup' | 'application' | 'enquiry';
702
- /** Value in MAJOR units (settled amount / estimated action value), non-negative. */
703
- value?: number;
704
- /** ISO-4217 or settlement-asset code (3–6 alphanumeric chars). */
705
- currency?: string;
706
- /** Settlement rail / mandate type, e.g. `ap2.payment_mandate` (≤64 chars). */
707
- rail?: string;
708
- }
709
- /**
710
- * Body for `POST /agents/verify-access/attempt-report`:
711
- * post-hoc consideration/outcome data for an attempt chain that a
712
- * verify-access call couldn't carry (e.g. the catalog was served from a local
713
- * cache, or the deny happened transport-side). Must carry `considerationSet`
714
- * and/or `outcome`.
715
- */
716
- interface AttemptReport {
717
- /** Attempt-chain handle — `att_` + 32 lowercase hex. */
718
- attemptId: string;
719
- /** Merchant/endpoint the attempt targeted; falls back to `config.counterpartyId`. */
720
- counterpartyId?: string;
721
- /** Canonical ASTRA-* id of the acting agent, when known. */
722
- agentId?: string;
723
- considerationSet?: ConsiderationSet;
724
- outcome?: AttemptOutcome;
725
- }
726
690
  /**
727
691
  * Raw commerce-protocol artifacts as verify-access accepts them (backend
728
692
  * `validation.ts` → `commerceArtifacts`). All optional; send what was
@@ -788,51 +752,6 @@ interface CommerceArtifactsPayload {
788
752
  secret: string;
789
753
  };
790
754
  }
791
- /**
792
- * Route-specific access configuration
793
- */
794
- interface RouteAccessConfig {
795
- /** Route pattern (supports wildcards) */
796
- pattern: string;
797
- /** HTTP method (or * for all) */
798
- method: string | '*';
799
- /**
800
- * Pass this route through unenforced (observe). The middleware skips gating
801
- * on the server decision; with `evaluateAlwaysIfCredentialed` set it still
802
- * calls verify-access for the audit trail and populates `req.agentVerification`.
803
- * Replaces the old `minAccessLevel: 'none'` sentinel (SDK 5.0.0).
804
- */
805
- observe?: boolean;
806
- /** Minimum trust score required (optional) */
807
- minTrustScore?: number;
808
- /** Required purposes (optional, agent must declare one of these) */
809
- requiredPurposes?: string[];
810
- /** Counterparty-defined PDLSS maximums — agent requests exceeding these are rejected before calling AstraSync */
811
- /** Maximum session duration in seconds the counterparty will allow */
812
- maxDuration?: number;
813
- /** Whitelist of allowed purposes — agent's declared purpose must be in this list */
814
- allowedPurposes?: string[];
815
- /** Whitelist of allowed jurisdictions */
816
- allowedJurisdictions?: string[];
817
- /** Maximum transaction value for this route */
818
- maxTransactionValue?: number;
819
- /**
820
- * Backend-evaluator strict mode: when true AND
821
- * `allowedPurposes` is non-empty, verify-access denies requests arriving
822
- * WITHOUT a purpose. Configured in the dashboard; passed through here.
823
- */
824
- requirePurpose?: boolean;
825
- /**
826
- * SEND-mapping — not an allow-list: the PDLSS tokens the
827
- * middleware STAMPS on verify-access calls matching this route, replacing
828
- * the generic `data`/`data.*` method-table fallback. `purpose` = bare
829
- * category noun (`shopping`, `trading`); `action` = dotted verb
830
- * (`shopping.search`, `trading.execute`). Authoritative over agent-supplied
831
- * headers — the dashboard is merchant policy, the way MCP toolGates are.
832
- */
833
- purpose?: string;
834
- action?: string;
835
- }
836
755
  /**
837
756
  * Express middleware options.
838
757
  *
@@ -1001,73 +920,6 @@ interface SDKOptions extends GatewayConfig {
1001
920
  backoffMs: number;
1002
921
  };
1003
922
  }
1004
- /**
1005
- * Token guidance returned from verify-access.
1006
- *
1007
- * `recommendedRateLimit` carries `requestsPerMinute` and `currency` only.
1008
- * `maxTransactionValue` was removed in v2.2.4 — it leaked the agent's
1009
- * spending headroom to the merchant, which is a price-discrimination signal
1010
- * (a merchant could see the agent's autonomous threshold and price the
1011
- * transaction just under it to capture surplus). The agent's SDK receives
1012
- * its own limits separately for client-side budgeting; the merchant's
1013
- * decision doesn't need amount info.
1014
- */
1015
- interface TokenGuidance {
1016
- recommendedScopes: string[];
1017
- recommendedTtlSeconds: number;
1018
- recommendedRateLimit?: {
1019
- requestsPerMinute: number;
1020
- currency?: string;
1021
- };
1022
- jurisdictionConstraints?: string[];
1023
- delegationAllowed: boolean;
1024
- maxDelegationDepth?: number;
1025
- safetyDefaults: {
1026
- writePrivilegesRequested: boolean;
1027
- shortLivedTokenRecommended: boolean;
1028
- scopeConvention: 'astrasync-canonical';
1029
- };
1030
- }
1031
- /**
1032
- * Runtime challenge result
1033
- */
1034
- interface RuntimeChallengeResult {
1035
- status: 'passed' | 'failed' | 'skipped' | 'timeout' | 'not_supported';
1036
- challengeId?: string;
1037
- challengeSentAt?: string;
1038
- responseReceivedAt?: string;
1039
- latencyMs?: number;
1040
- reason?: string;
1041
- }
1042
- /**
1043
- * Enhanced verification result (extends existing VerificationResult).
1044
- *
1045
- * - `appliedPolicy`: surfaces the boundary name + policy version that drove
1046
- * the decision (no UUIDs).
1047
- * - `verificationContext`: structured "why" for the merchant — see
1048
- * `VerificationContext` for the full shape.
1049
- */
1050
- interface EnhancedVerificationResult extends VerificationResult {
1051
- sessionId?: string;
1052
- runtimeChallenge?: RuntimeChallengeResult;
1053
- tokenGuidance?: TokenGuidance;
1054
- appliedPolicy?: AppliedPolicy;
1055
- verificationContext?: VerificationContext;
1056
- recommendation?: 'grant' | 'deny' | 'step_up_required' | 'audit';
1057
- recommendationReasons?: string[];
1058
- /**
1059
- * v2.3.8: when an endpoint's `unverifiedAgentPolicy` is `'audit'`, the
1060
- * server returns the warning header to relay to the merchant's response.
1061
- * The Express + MCP middleware lift this into `res.setHeader(name, value)`
1062
- * before calling `next()`. Distinct vocabulary from the PDLSS-scope
1063
- * outbound `unverifiedCounterpartyPolicy: 'warn'` so raw JSON config can't
1064
- * conflate the two.
1065
- */
1066
- warningHeader?: {
1067
- name: string;
1068
- value: string;
1069
- };
1070
- }
1071
923
  /**
1072
924
  * Cross-protocol credential config
1073
925
  */
@@ -1088,10 +940,6 @@ interface AstraSyncCredentials {
1088
940
  };
1089
941
  };
1090
942
  }
1091
- /**
1092
- * Protocol transport type
1093
- */
1094
- type ProtocolTransport = 'http' | 'a2a' | 'mcp';
1095
943
  /**
1096
944
  * Verification interstitial UI props (the React overlay shown to unverified
1097
945
  * agents; user-visible title stays "AstraSync Agent Verification").
@@ -1116,7 +964,5 @@ interface VerificationInterstitialProps {
1116
964
  /** Custom styles */
1117
965
  className?: string;
1118
966
  }
1119
- /** @deprecated Renamed VerificationInterstitialProps in 4.1.0; alias removed next major. */
1120
- type CommerceShieldProps = VerificationInterstitialProps;
1121
967
 
1122
- export type { AccessFailure as A, VerifiedOrganization as B, CallerMetadata as C, EnhancedVerificationResult as E, FiatSettlementBinding as F, GatewayConfig as G, NextJsMiddlewareOptions as N, PDLSSInfo as P, RouteAccessConfig as R, SDKOptions as S, TokenGuidance as T, VerificationInterstitialProps as V, AgentCredentials as a, AstraSyncCredentials as b, AttemptOutcome as c, AttemptReport as d, CommerceArtifactsPayload as e, CommerceShieldProps as f, ConsiderationItem as g, ConsiderationSet as h, CounterpartyType as i, ExpressMiddlewareOptions as j, GuidanceInfo as k, ProtocolTransport as l, RuntimeChallengeResult as m, SettlementArtifact as n, SettlementArtifactBinding as o, SettlementArtifactBindingBase as p, SettlementOutcomeInfo as q, StablecoinSettlementBinding as r, StepUpApprovalInfo as s, StepUpApprovalStatus as t, StepUpOutcome as u, TrustLevel as v, VerificationRequest as w, VerificationResult as x, VerifiedAgent as y, VerifiedDeveloper as z };
968
+ export type { AgentCredentials as A, ExpressMiddlewareOptions as E, GatewayConfig as G, NextJsMiddlewareOptions as N, SDKOptions as S, TrustLevel as T, VerificationInterstitialProps as V, AstraSyncCredentials as a, GuidanceInfo as b, VerificationRequest as c, VerificationResult as d };
@@ -1,4 +1,54 @@
1
- import { ObservedMetadata } from './metadata-capture.mjs';
1
+ /**
2
+ * The captured, sanitised view of an inbound agent's request metadata. Attached
3
+ * to verify-access / beacon payloads as `callerMetadata.observedMetadata`.
4
+ */
5
+ interface ObservedMetadata {
6
+ /** Header name → value, secrets removed, verbatim otherwise. */
7
+ headers: Record<string, string>;
8
+ /**
9
+ * Safe key-format prefix of a credential header (e.g. `sk-ant-api03`,
10
+ * `sk-proj`, `AIza`) — a platform signal, NEVER the secret. Absent if no
11
+ * credential header was present or none matched a known format.
12
+ */
13
+ apiKeyFormat?: string;
14
+ /**
15
+ * The subset of `headers` that are known platform-signal headers
16
+ * (`openai-organization`, `x-goog-user-project`, `anthropic-version`, …),
17
+ * pulled out for convenient detection + display. Values are the same
18
+ * sanitised strings as in `headers`.
19
+ */
20
+ platformHeaders?: Record<string, string>;
21
+ /**
22
+ * Connection-layer signals (IP, ASN, country, TLS version, HTTP version,
23
+ * device class, TLS fingerprint). Edge adapters populate this from the
24
+ * platform's native connection surface — the authoritative source. SDK
25
+ * adapters populate it as a fallback via {@link deriveConnectionFromHeaders}
26
+ * when a CDN in front of the merchant injected the equivalent headers;
27
+ * absent when neither source had anything.
28
+ */
29
+ connection?: Record<string, string>;
30
+ /**
31
+ * Number of cookie pairs the caller sent. The `cookie` header VALUE is a
32
+ * secret and is always dropped; the COUNT is a client-shape signal
33
+ * (browsers carry cookies, most automation carries none) that would
34
+ * otherwise be unobservable downstream. Absent when no cookie header
35
+ * arrived.
36
+ */
37
+ cookieCount?: number;
38
+ /**
39
+ * Query-string parameter NAMES (deduped, lowercased) — values are NEVER
40
+ * captured (they routinely carry OAuth codes, tokens, and PII, and no
41
+ * deny-list is complete). Names alone fingerprint client shape. Populated
42
+ * by the edge path, which sees the raw query string.
43
+ */
44
+ queryKeys?: string[];
45
+ /**
46
+ * Version of the capture semantics this object was produced under — see
47
+ * {@link CAPTURE_SCHEMA_VERSION}. Optional for backward compatibility with
48
+ * metadata captured before the field existed.
49
+ */
50
+ schemaVersion?: number;
51
+ }
2
52
 
3
53
  /**
4
54
  * AstraSync Universal Verification Gateway Types
@@ -228,62 +278,6 @@ interface AppliedPolicy {
228
278
  boundaryName: string;
229
279
  policyVersion: string;
230
280
  }
231
- /**
232
- * Structured "why" of a verification decision the merchant receives.
233
- *
234
- * Tells the merchant whether the agent ID was verified, whether the runtime
235
- * challenge succeeded, whether the request was within PDLSS, and the agent's
236
- * actual dynamic trust score — without exposing thresholds, scope lists, or
237
- * other-tenant counterparty membership.
238
- *
239
- * `attestations` is empty unless the calling endpoint's access policy
240
- * declared `required_attestations`. Each attestation carries a blockchain
241
- * proof reference (or, in the future, a full ZKP) so the merchant can verify
242
- * the underlying claim without seeing the raw underlying data (e.g. the
243
- * Persona/ConnectID transaction).
244
- */
245
- interface VerificationContext {
246
- idVerified: boolean;
247
- runtimeChallenge: {
248
- status: 'passed' | 'skipped' | 'failed' | 'timeout' | 'not_supported';
249
- checkedAt: string | null;
250
- };
251
- pdlssCheck: {
252
- /** Outcome only — no thresholds disclosed. */
253
- result: 'within' | 'exceeded' | 'denied' | 'not_evaluated';
254
- /** Category-level only. */
255
- purpose: 'approved' | 'denied';
256
- scope: 'approved' | 'denied';
257
- };
258
- /** Live composite score at decision time (not the stale snapshot column). */
259
- dynamicTrustScore: number;
260
- attestations: Attestation[];
261
- }
262
- /**
263
- * Attestation returned in `VerificationContext.attestations`.
264
- *
265
- * `proofType: 'reference'` (interim) means `proof` is a blockchain txn hash
266
- * the merchant CAN verify against on-chain records but doesn't HAVE to.
267
- * `proofType: 'zkp'` (future) means `proof` is a zero-knowledge proof.
268
- * Wire shape is forward-compatible — clients reading 'reference' today won't
269
- * break when it becomes 'zkp'.
270
- */
271
- interface Attestation {
272
- /** Attestation kind (e.g. `verified_human_party`). */
273
- type: string;
274
- status: 'passed' | 'failed';
275
- /**
276
- * ISO-8601 timestamp of the underlying check (when KYC/IDV/AML actually ran).
277
- * Merchants compare this against their `maxAgeDays` requirement on the
278
- * endpoint to enforce per-attestation freshness. Distinct from `validUntil`:
279
- * `checkedAt` is when the data was sourced; `validUntil` is when the issuer
280
- * stops vouching for it.
281
- */
282
- checkedAt: string;
283
- validUntil?: string;
284
- proofType: 'reference' | 'zkp';
285
- proof: string;
286
- }
287
281
  /**
288
282
  * Guidance information for unverified agents
289
283
  */
@@ -490,9 +484,15 @@ interface VerificationResult {
490
484
  * 5.3.0 (astra-pay): sanitized outcome of first-party charge-at-redeem
491
485
  * settlement. Carries NO voucher/instrument material — the settlement channel
492
486
  * stays merchant-only; this is the result the agent plane is allowed to see.
487
+ *
488
+ * 5.4.2: `requires_approval` — the transaction is HELD for human step-up
489
+ * approval. Not a failure: record the order as pending; after the human
490
+ * approves, the platform re-drives the confirm with the SAME
491
+ * checkoutSessionId and that re-drive carries the settling outcome
492
+ * (one order row per session — the re-drive claims the same row).
493
493
  */
494
494
  interface SettlementOutcomeInfo {
495
- status: 'settled' | 'failed' | 'requires_action' | 'no_instrument';
495
+ status: 'settled' | 'failed' | 'requires_action' | 'no_instrument' | 'requires_approval';
496
496
  /** First-party order id — the buyer sees the purchase in their AstraSync
497
497
  * dashboard orders view (no public receipt page). */
498
498
  orderId?: string;
@@ -687,42 +687,6 @@ interface ConsiderationSet {
687
687
  /** True when `items` was truncated to the cap. */
688
688
  truncated?: boolean;
689
689
  }
690
- /**
691
- * Terminal (or notable) outcome of an attempt chain, reported post-hoc via
692
- * `reportAttempt`. Mirrors the backend's `attemptReportSchema.outcome` 1:1.
693
- */
694
- interface AttemptOutcome {
695
- kind: 'settled' | 'blocked_step_up' | 'failed' | 'high_value_action';
696
- /** Dotted ACTION-axis token for the failure class, e.g. `commerce.catalog.sku_not_found` (≤128 chars). */
697
- dimension?: string;
698
- /** Human-readable detail (≤512 chars). */
699
- reason?: string;
700
- /** For `high_value_action`: the non-payment conversion type. */
701
- actionType?: 'lead' | 'signup' | 'application' | 'enquiry';
702
- /** Value in MAJOR units (settled amount / estimated action value), non-negative. */
703
- value?: number;
704
- /** ISO-4217 or settlement-asset code (3–6 alphanumeric chars). */
705
- currency?: string;
706
- /** Settlement rail / mandate type, e.g. `ap2.payment_mandate` (≤64 chars). */
707
- rail?: string;
708
- }
709
- /**
710
- * Body for `POST /agents/verify-access/attempt-report`:
711
- * post-hoc consideration/outcome data for an attempt chain that a
712
- * verify-access call couldn't carry (e.g. the catalog was served from a local
713
- * cache, or the deny happened transport-side). Must carry `considerationSet`
714
- * and/or `outcome`.
715
- */
716
- interface AttemptReport {
717
- /** Attempt-chain handle — `att_` + 32 lowercase hex. */
718
- attemptId: string;
719
- /** Merchant/endpoint the attempt targeted; falls back to `config.counterpartyId`. */
720
- counterpartyId?: string;
721
- /** Canonical ASTRA-* id of the acting agent, when known. */
722
- agentId?: string;
723
- considerationSet?: ConsiderationSet;
724
- outcome?: AttemptOutcome;
725
- }
726
690
  /**
727
691
  * Raw commerce-protocol artifacts as verify-access accepts them (backend
728
692
  * `validation.ts` → `commerceArtifacts`). All optional; send what was
@@ -788,51 +752,6 @@ interface CommerceArtifactsPayload {
788
752
  secret: string;
789
753
  };
790
754
  }
791
- /**
792
- * Route-specific access configuration
793
- */
794
- interface RouteAccessConfig {
795
- /** Route pattern (supports wildcards) */
796
- pattern: string;
797
- /** HTTP method (or * for all) */
798
- method: string | '*';
799
- /**
800
- * Pass this route through unenforced (observe). The middleware skips gating
801
- * on the server decision; with `evaluateAlwaysIfCredentialed` set it still
802
- * calls verify-access for the audit trail and populates `req.agentVerification`.
803
- * Replaces the old `minAccessLevel: 'none'` sentinel (SDK 5.0.0).
804
- */
805
- observe?: boolean;
806
- /** Minimum trust score required (optional) */
807
- minTrustScore?: number;
808
- /** Required purposes (optional, agent must declare one of these) */
809
- requiredPurposes?: string[];
810
- /** Counterparty-defined PDLSS maximums — agent requests exceeding these are rejected before calling AstraSync */
811
- /** Maximum session duration in seconds the counterparty will allow */
812
- maxDuration?: number;
813
- /** Whitelist of allowed purposes — agent's declared purpose must be in this list */
814
- allowedPurposes?: string[];
815
- /** Whitelist of allowed jurisdictions */
816
- allowedJurisdictions?: string[];
817
- /** Maximum transaction value for this route */
818
- maxTransactionValue?: number;
819
- /**
820
- * Backend-evaluator strict mode: when true AND
821
- * `allowedPurposes` is non-empty, verify-access denies requests arriving
822
- * WITHOUT a purpose. Configured in the dashboard; passed through here.
823
- */
824
- requirePurpose?: boolean;
825
- /**
826
- * SEND-mapping — not an allow-list: the PDLSS tokens the
827
- * middleware STAMPS on verify-access calls matching this route, replacing
828
- * the generic `data`/`data.*` method-table fallback. `purpose` = bare
829
- * category noun (`shopping`, `trading`); `action` = dotted verb
830
- * (`shopping.search`, `trading.execute`). Authoritative over agent-supplied
831
- * headers — the dashboard is merchant policy, the way MCP toolGates are.
832
- */
833
- purpose?: string;
834
- action?: string;
835
- }
836
755
  /**
837
756
  * Express middleware options.
838
757
  *
@@ -1001,73 +920,6 @@ interface SDKOptions extends GatewayConfig {
1001
920
  backoffMs: number;
1002
921
  };
1003
922
  }
1004
- /**
1005
- * Token guidance returned from verify-access.
1006
- *
1007
- * `recommendedRateLimit` carries `requestsPerMinute` and `currency` only.
1008
- * `maxTransactionValue` was removed in v2.2.4 — it leaked the agent's
1009
- * spending headroom to the merchant, which is a price-discrimination signal
1010
- * (a merchant could see the agent's autonomous threshold and price the
1011
- * transaction just under it to capture surplus). The agent's SDK receives
1012
- * its own limits separately for client-side budgeting; the merchant's
1013
- * decision doesn't need amount info.
1014
- */
1015
- interface TokenGuidance {
1016
- recommendedScopes: string[];
1017
- recommendedTtlSeconds: number;
1018
- recommendedRateLimit?: {
1019
- requestsPerMinute: number;
1020
- currency?: string;
1021
- };
1022
- jurisdictionConstraints?: string[];
1023
- delegationAllowed: boolean;
1024
- maxDelegationDepth?: number;
1025
- safetyDefaults: {
1026
- writePrivilegesRequested: boolean;
1027
- shortLivedTokenRecommended: boolean;
1028
- scopeConvention: 'astrasync-canonical';
1029
- };
1030
- }
1031
- /**
1032
- * Runtime challenge result
1033
- */
1034
- interface RuntimeChallengeResult {
1035
- status: 'passed' | 'failed' | 'skipped' | 'timeout' | 'not_supported';
1036
- challengeId?: string;
1037
- challengeSentAt?: string;
1038
- responseReceivedAt?: string;
1039
- latencyMs?: number;
1040
- reason?: string;
1041
- }
1042
- /**
1043
- * Enhanced verification result (extends existing VerificationResult).
1044
- *
1045
- * - `appliedPolicy`: surfaces the boundary name + policy version that drove
1046
- * the decision (no UUIDs).
1047
- * - `verificationContext`: structured "why" for the merchant — see
1048
- * `VerificationContext` for the full shape.
1049
- */
1050
- interface EnhancedVerificationResult extends VerificationResult {
1051
- sessionId?: string;
1052
- runtimeChallenge?: RuntimeChallengeResult;
1053
- tokenGuidance?: TokenGuidance;
1054
- appliedPolicy?: AppliedPolicy;
1055
- verificationContext?: VerificationContext;
1056
- recommendation?: 'grant' | 'deny' | 'step_up_required' | 'audit';
1057
- recommendationReasons?: string[];
1058
- /**
1059
- * v2.3.8: when an endpoint's `unverifiedAgentPolicy` is `'audit'`, the
1060
- * server returns the warning header to relay to the merchant's response.
1061
- * The Express + MCP middleware lift this into `res.setHeader(name, value)`
1062
- * before calling `next()`. Distinct vocabulary from the PDLSS-scope
1063
- * outbound `unverifiedCounterpartyPolicy: 'warn'` so raw JSON config can't
1064
- * conflate the two.
1065
- */
1066
- warningHeader?: {
1067
- name: string;
1068
- value: string;
1069
- };
1070
- }
1071
923
  /**
1072
924
  * Cross-protocol credential config
1073
925
  */
@@ -1088,10 +940,6 @@ interface AstraSyncCredentials {
1088
940
  };
1089
941
  };
1090
942
  }
1091
- /**
1092
- * Protocol transport type
1093
- */
1094
- type ProtocolTransport = 'http' | 'a2a' | 'mcp';
1095
943
  /**
1096
944
  * Verification interstitial UI props (the React overlay shown to unverified
1097
945
  * agents; user-visible title stays "AstraSync Agent Verification").
@@ -1116,7 +964,5 @@ interface VerificationInterstitialProps {
1116
964
  /** Custom styles */
1117
965
  className?: string;
1118
966
  }
1119
- /** @deprecated Renamed VerificationInterstitialProps in 4.1.0; alias removed next major. */
1120
- type CommerceShieldProps = VerificationInterstitialProps;
1121
967
 
1122
- export type { AccessFailure as A, VerifiedOrganization as B, CallerMetadata as C, EnhancedVerificationResult as E, FiatSettlementBinding as F, GatewayConfig as G, NextJsMiddlewareOptions as N, PDLSSInfo as P, RouteAccessConfig as R, SDKOptions as S, TokenGuidance as T, VerificationInterstitialProps as V, AgentCredentials as a, AstraSyncCredentials as b, AttemptOutcome as c, AttemptReport as d, CommerceArtifactsPayload as e, CommerceShieldProps as f, ConsiderationItem as g, ConsiderationSet as h, CounterpartyType as i, ExpressMiddlewareOptions as j, GuidanceInfo as k, ProtocolTransport as l, RuntimeChallengeResult as m, SettlementArtifact as n, SettlementArtifactBinding as o, SettlementArtifactBindingBase as p, SettlementOutcomeInfo as q, StablecoinSettlementBinding as r, StepUpApprovalInfo as s, StepUpApprovalStatus as t, StepUpOutcome as u, TrustLevel as v, VerificationRequest as w, VerificationResult as x, VerifiedAgent as y, VerifiedDeveloper as z };
968
+ export type { AgentCredentials as A, ExpressMiddlewareOptions as E, GatewayConfig as G, NextJsMiddlewareOptions as N, SDKOptions as S, TrustLevel as T, VerificationInterstitialProps as V, AstraSyncCredentials as a, GuidanceInfo as b, VerificationRequest as c, VerificationResult as d };