@astrasyncai/verification-gateway 3.8.0 → 3.10.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.
Files changed (114) hide show
  1. package/dist/adapter-interface/interface.d.mts +3 -2
  2. package/dist/adapter-interface/interface.d.ts +3 -2
  3. package/dist/adapters/express.d.mts +3 -2
  4. package/dist/adapters/express.d.ts +3 -2
  5. package/dist/adapters/express.js +152 -2
  6. package/dist/adapters/express.js.map +1 -1
  7. package/dist/adapters/express.mjs +152 -2
  8. package/dist/adapters/express.mjs.map +1 -1
  9. package/dist/adapters/http-pdlss.d.mts +81 -0
  10. package/dist/adapters/http-pdlss.d.ts +81 -0
  11. package/dist/adapters/http-pdlss.js +117 -0
  12. package/dist/adapters/http-pdlss.js.map +1 -0
  13. package/dist/adapters/http-pdlss.mjs +87 -0
  14. package/dist/adapters/http-pdlss.mjs.map +1 -0
  15. package/dist/adapters/mcp.d.mts +2 -1
  16. package/dist/adapters/mcp.d.ts +2 -1
  17. package/dist/adapters/mcp.js +2 -1
  18. package/dist/adapters/mcp.js.map +1 -1
  19. package/dist/adapters/mcp.mjs +2 -1
  20. package/dist/adapters/mcp.mjs.map +1 -1
  21. package/dist/adapters/nextjs.d.mts +3 -2
  22. package/dist/adapters/nextjs.d.ts +3 -2
  23. package/dist/adapters/nextjs.js +152 -2
  24. package/dist/adapters/nextjs.js.map +1 -1
  25. package/dist/adapters/nextjs.mjs +152 -2
  26. package/dist/adapters/nextjs.mjs.map +1 -1
  27. package/dist/adapters/sdk.d.mts +3 -2
  28. package/dist/adapters/sdk.d.ts +3 -2
  29. package/dist/adapters/sdk.js +2 -1
  30. package/dist/adapters/sdk.js.map +1 -1
  31. package/dist/adapters/sdk.mjs +2 -1
  32. package/dist/adapters/sdk.mjs.map +1 -1
  33. package/dist/agent/index.d.mts +3 -2
  34. package/dist/agent/index.d.ts +3 -2
  35. package/dist/bin/astrasync-claude-hook.js +17 -1
  36. package/dist/bin/astrasync-guard.js +17 -1
  37. package/dist/bin/astrasync.js +43 -1
  38. package/dist/browser/background.js +17 -1
  39. package/dist/browser/background.js.map +1 -1
  40. package/dist/browser/background.mjs +17 -1
  41. package/dist/browser/background.mjs.map +1 -1
  42. package/dist/browser/browser-adapter.d.mts +3 -2
  43. package/dist/browser/browser-adapter.d.ts +3 -2
  44. package/dist/claude-code/claude-code-adapter.d.mts +3 -2
  45. package/dist/claude-code/claude-code-adapter.d.ts +3 -2
  46. package/dist/cli/index.d.mts +3 -2
  47. package/dist/cli/index.d.ts +3 -2
  48. package/dist/cursor/cursor-adapter.d.mts +3 -2
  49. package/dist/cursor/cursor-adapter.d.ts +3 -2
  50. package/dist/cursor/extension.d.mts +3 -2
  51. package/dist/cursor/extension.d.ts +3 -2
  52. package/dist/cursor/extension.js +17 -1
  53. package/dist/cursor/extension.js.map +1 -1
  54. package/dist/cursor/extension.mjs +17 -1
  55. package/dist/cursor/extension.mjs.map +1 -1
  56. package/dist/edge-config.d.mts +131 -0
  57. package/dist/edge-config.d.ts +131 -0
  58. package/dist/edge-config.js +162 -0
  59. package/dist/edge-config.js.map +1 -0
  60. package/dist/edge-config.mjs +131 -0
  61. package/dist/edge-config.mjs.map +1 -0
  62. package/dist/{express-C8nJGi5P.d.ts → express-ClNtDhhc.d.ts} +1 -1
  63. package/dist/{express-Di_hnZZS.d.mts → express-DCXa1oqj.d.mts} +1 -1
  64. package/dist/gateway/gateway.d.mts +3 -2
  65. package/dist/gateway/gateway.d.ts +3 -2
  66. package/dist/gateway/gateway.js +17 -1
  67. package/dist/gateway/gateway.js.map +1 -1
  68. package/dist/gateway/gateway.mjs +17 -1
  69. package/dist/gateway/gateway.mjs.map +1 -1
  70. package/dist/git-trigger/git-hooks.d.mts +3 -2
  71. package/dist/git-trigger/git-hooks.d.ts +3 -2
  72. package/dist/{index-CXcvO9Au.d.mts → index-BrNKDmiR.d.mts} +1 -1
  73. package/dist/{index-CuCkjT7B.d.ts → index-CfHurO1P.d.ts} +1 -1
  74. package/dist/{index-CBQr4FGs.d.ts → index-D2ztkumS.d.ts} +1 -1
  75. package/dist/{index-DALAqct7.d.mts → index-Dr_XiN65.d.mts} +1 -1
  76. package/dist/index.d.mts +27 -82
  77. package/dist/index.d.ts +27 -82
  78. package/dist/index.js +435 -12
  79. package/dist/index.js.map +1 -1
  80. package/dist/index.mjs +417 -12
  81. package/dist/index.mjs.map +1 -1
  82. package/dist/local-evaluator/evaluator.d.mts +3 -2
  83. package/dist/local-evaluator/evaluator.d.ts +3 -2
  84. package/dist/metadata-capture.d.mts +87 -0
  85. package/dist/metadata-capture.d.ts +87 -0
  86. package/dist/metadata-capture.js +184 -0
  87. package/dist/metadata-capture.js.map +1 -0
  88. package/dist/metadata-capture.mjs +154 -0
  89. package/dist/metadata-capture.mjs.map +1 -0
  90. package/dist/{nextjs-IyXWW2KL.d.ts → nextjs-CEBVBsdi.d.ts} +1 -1
  91. package/dist/{nextjs-BMAe8ode.d.mts → nextjs-DcQIk6Zj.d.mts} +1 -1
  92. package/dist/platform-signatures.d.mts +97 -0
  93. package/dist/platform-signatures.d.ts +97 -0
  94. package/dist/platform-signatures.js +116 -0
  95. package/dist/platform-signatures.js.map +1 -0
  96. package/dist/platform-signatures.mjs +89 -0
  97. package/dist/platform-signatures.mjs.map +1 -0
  98. package/dist/{sdk-Cn4KcZ5G.d.mts → sdk-CZkbSOeO.d.mts} +1 -1
  99. package/dist/{sdk-ThdA_NtL.d.ts → sdk-H0JCLW2y.d.ts} +1 -1
  100. package/dist/transport/index.d.mts +3 -2
  101. package/dist/transport/index.d.ts +3 -2
  102. package/dist/{types-DedAJbNI.d.mts → types-9tns4wyl.d.ts} +88 -1
  103. package/dist/{types-CSFci5zD.d.mts → types-D0lCtFQ7.d.mts} +1 -1
  104. package/dist/{types-D1kyMiml.d.ts → types-YbiXYKx1.d.ts} +1 -1
  105. package/dist/{types-DedAJbNI.d.ts → types-sy3tq8lp.d.mts} +88 -1
  106. package/dist/ui/index.d.mts +2 -1
  107. package/dist/ui/index.d.ts +2 -1
  108. package/dist/verify.d.mts +151 -0
  109. package/dist/verify.d.ts +151 -0
  110. package/dist/verify.js +593 -0
  111. package/dist/verify.js.map +1 -0
  112. package/dist/verify.mjs +557 -0
  113. package/dist/verify.mjs.map +1 -0
  114. package/package.json +26 -1
@@ -1,8 +1,11 @@
1
+ import { ObservedMetadata } from './metadata-capture.mjs';
2
+
1
3
  /**
2
4
  * AstraSync Universal Verification Gateway Types
3
5
  *
4
6
  * TypeScript type definitions for agent verification across all counterparty types.
5
7
  */
8
+
6
9
  /**
7
10
  * Trust levels assigned to agents based on their composite trust score
8
11
  */
@@ -498,6 +501,15 @@ interface CallerMetadata {
498
501
  forwardedFor?: string;
499
502
  /** Published agent card URL, if the agent advertised one (future: from agent headers). */
500
503
  agentCardUrl?: string;
504
+ /**
505
+ * The full sanitised view of the agent's inbound request headers + connection
506
+ * signals (Workstream D — maximal metadata capture). Produced by
507
+ * `sanitizeHeaders` (genuine secrets removed, credential headers reduced to a
508
+ * safe format prefix). Forwarded so the endpoint owner sees every wire signal
509
+ * about the agent, not just IP/UA. Local string work only — kept OUT of the
510
+ * verify cache key so per-request maps don't defeat verdict caching.
511
+ */
512
+ observedMetadata?: ObservedMetadata;
501
513
  }
502
514
  interface VerificationRequest {
503
515
  /** Agent credentials */
@@ -560,6 +572,81 @@ interface VerificationRequest {
560
572
  * visibility into transport-vs-intent.
561
573
  */
562
574
  invocationProtocol?: 'rest' | 'mcp' | 'a2a' | 'acp' | 'ap2' | 'mpp' | 'ucp';
575
+ /**
576
+ * 3.9.0 (§33.5 #1) — raw commerce-protocol artifacts forwarded verbatim
577
+ * to verify-access, whose Step 0.5 commerce pipeline runs the full
578
+ * cryptographic verification SERVER-side and persists commerce_context on
579
+ * the session. Adapters forward artifacts, they never verify them locally
580
+ * (bridge-is-transport: verify-access is the sole verification sink, so
581
+ * every decision is recorded once, with events). Shape mirrors the
582
+ * backend's `commerceArtifacts` schema 1:1.
583
+ */
584
+ commerceArtifacts?: CommerceArtifactsPayload;
585
+ }
586
+ /**
587
+ * Raw commerce-protocol artifacts as verify-access accepts them (backend
588
+ * `validation.ts` → `commerceArtifacts`). All optional; send what was
589
+ * detected on the wire.
590
+ */
591
+ interface CommerceArtifactsPayload {
592
+ /** Compact VI SD-JWT. */
593
+ viSdJwt?: string;
594
+ /** AP2 mandate triple as compact SD-JWTs. */
595
+ ap2Mandates?: {
596
+ intent?: string;
597
+ cart?: string;
598
+ payment?: string;
599
+ };
600
+ /** RFC 9421 signed request (Agent Pay / TAP / Web Bot Auth). */
601
+ rfc9421?: {
602
+ headers: Record<string, string | string[]>;
603
+ method: string;
604
+ url: string;
605
+ body?: string;
606
+ tag?: string;
607
+ };
608
+ /** UCP checkout session request. */
609
+ ucpRequest?: {
610
+ method: string;
611
+ url: string;
612
+ body?: unknown;
613
+ };
614
+ /** ACP request (HMAC-signed webhook or checkout body). */
615
+ acpRequest?: {
616
+ method: string;
617
+ url: string;
618
+ headers?: Record<string, string | string[]>;
619
+ body?: unknown;
620
+ rawBody?: string;
621
+ };
622
+ mppRequest?: {
623
+ method: string;
624
+ url: string;
625
+ headers: Record<string, string | string[]>;
626
+ body?: unknown;
627
+ rawBody?: string;
628
+ };
629
+ mppResponse?: {
630
+ status: number;
631
+ headers: Record<string, string | string[]>;
632
+ body?: unknown;
633
+ };
634
+ x402Request?: {
635
+ method?: string;
636
+ url?: string;
637
+ headers?: Record<string, string | string[]>;
638
+ body?: unknown;
639
+ };
640
+ x402Response?: {
641
+ status?: number;
642
+ headers?: Record<string, string | string[]>;
643
+ body?: unknown;
644
+ };
645
+ stripeWebhook?: {
646
+ payload: string;
647
+ signatureHeader: string;
648
+ secret: string;
649
+ };
563
650
  }
564
651
  /**
565
652
  * Route-specific access configuration
@@ -842,4 +929,4 @@ interface CommerceShieldProps {
842
929
  className?: string;
843
930
  }
844
931
 
845
- export type { AccessFailure as A, CommerceShieldProps 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, VerificationRequest as V, AccessLevel as a, AgentCredentials as b, AstraSyncCredentials as c, CounterpartyType as d, ExpressMiddlewareOptions as e, GuidanceInfo as f, ProtocolTransport as g, RuntimeChallengeResult as h, SettlementArtifact as i, SettlementArtifactBinding as j, SettlementArtifactBindingBase as k, StablecoinSettlementBinding as l, StepUpApprovalInfo as m, StepUpApprovalStatus as n, StepUpOutcome as o, TrustLevel as p, VerificationResult as q, VerifiedAgent as r, VerifiedDeveloper as s, VerifiedOrganization as t };
932
+ export type { AccessFailure as A, CommerceArtifactsPayload 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, VerificationRequest as V, AccessLevel as a, AgentCredentials as b, AstraSyncCredentials as c, CommerceShieldProps as d, CounterpartyType as e, ExpressMiddlewareOptions as f, GuidanceInfo as g, ProtocolTransport as h, RuntimeChallengeResult as i, SettlementArtifact as j, SettlementArtifactBinding as k, SettlementArtifactBindingBase as l, StablecoinSettlementBinding as m, StepUpApprovalInfo as n, StepUpApprovalStatus as o, StepUpOutcome as p, TrustLevel as q, VerificationResult as r, VerifiedAgent as s, VerifiedDeveloper as t, VerifiedOrganization as u };
@@ -1,4 +1,5 @@
1
- import { C as CommerceShieldProps, q as VerificationResult, b as AgentCredentials, f as GuidanceInfo, p as TrustLevel } from '../types-DedAJbNI.mjs';
1
+ import { d as CommerceShieldProps, r as VerificationResult, b as AgentCredentials, g as GuidanceInfo, q as TrustLevel } from '../types-sy3tq8lp.mjs';
2
+ import '../metadata-capture.mjs';
2
3
 
3
4
  /**
4
5
  * AstraSync Commerce Shield Component
@@ -1,4 +1,5 @@
1
- import { C as CommerceShieldProps, q as VerificationResult, b as AgentCredentials, f as GuidanceInfo, p as TrustLevel } from '../types-DedAJbNI.js';
1
+ import { d as CommerceShieldProps, r as VerificationResult, b as AgentCredentials, g as GuidanceInfo, q as TrustLevel } from '../types-9tns4wyl.js';
2
+ import '../metadata-capture.js';
2
3
 
3
4
  /**
4
5
  * AstraSync Commerce Shield Component
@@ -0,0 +1,151 @@
1
+ import { b as AgentCredentials, G as GatewayConfig, a as AccessLevel, V as VerificationRequest, r as VerificationResult } from './types-sy3tq8lp.mjs';
2
+ import { ObservedMetadata } from './metadata-capture.mjs';
3
+
4
+ /**
5
+ * AstraSync Universal Verification Gateway - Core Verification Logic
6
+ *
7
+ * This module handles the core verification logic, calling the AstraSync API
8
+ * and processing the response into a standardized VerificationResult.
9
+ */
10
+
11
+ /**
12
+ * Clear the verification cache
13
+ */
14
+ declare function clearCache(): void;
15
+ /**
16
+ * Extract agent credentials from various sources
17
+ */
18
+ declare function extractCredentials(headers: Record<string, string | string[] | undefined>, query?: Record<string, string | undefined>): AgentCredentials;
19
+ /**
20
+ * Check if credentials are present
21
+ */
22
+ declare function hasCredentials(credentials: AgentCredentials): boolean;
23
+ /**
24
+ * Options for a single verify() call (as opposed to GatewayConfig, which is
25
+ * per-gateway). Mirrors the Java SDK's `verify(request, bypassCache)`.
26
+ */
27
+ interface VerifyOptions {
28
+ /**
29
+ * Skip the cache READ for this call so the request is guaranteed to reach
30
+ * the backend (the result is still written to the cache if cacheable).
31
+ * Used by the step-up hold-and-poll retry: the re-verify after an approval
32
+ * must hit the server to redeem the single-use approval.
33
+ */
34
+ bypassCache?: boolean;
35
+ }
36
+ /**
37
+ * Main verification function
38
+ */
39
+ declare function verify(config: GatewayConfig, request: VerificationRequest, options?: VerifyOptions): Promise<VerificationResult>;
40
+ /**
41
+ * Record a counterparty's grant/deny decision for a verification session.
42
+ * Fire-and-forget — errors are silently swallowed.
43
+ */
44
+ declare function recordDecision(config: GatewayConfig, sessionId: string, decision: 'granted' | 'denied', reason?: string): Promise<void>;
45
+ /**
46
+ * Fetch the per-route policy for an endpoint from the AstraSync backend.
47
+ * v2.9.7 moved policy authority into the dashboard — the SDK no longer
48
+ * accepts `routes` from merchant-side source code, it fetches them from
49
+ * here on init (and refreshes periodically).
50
+ *
51
+ * Returns `null` when the request fails for any reason — the caller decides
52
+ * how to fall back (the middleware allows-all when no policy is loaded so
53
+ * a misconfigured init doesn't take down the merchant's API).
54
+ */
55
+ declare function fetchRoutes(config: GatewayConfig, counterpartyId: string): Promise<RouteAccessConfigShape[] | null>;
56
+ /**
57
+ * Minimal shape of an EndpointRoute as the SDK consumes it. Mirrors the
58
+ * server's `EndpointRoute` type and the SDK's `RouteAccessConfig` — same
59
+ * JSON moves between server and SDK unchanged.
60
+ */
61
+ interface RouteAccessConfigShape {
62
+ pattern: string;
63
+ method: string;
64
+ /** @deprecated 3.2.0 — band no longer gates; optional, ignored. Use minTrustScore. */
65
+ minAccessLevel?: 'none' | 'restricted' | 'read-only' | 'standard' | 'full' | 'internal';
66
+ minTrustScore?: number;
67
+ requiredPurposes?: string[];
68
+ allowedPurposes?: string[];
69
+ allowedJurisdictions?: string[];
70
+ maxDuration?: number;
71
+ maxTransactionValue?: number;
72
+ requirePurpose?: boolean;
73
+ /** Send-mapping (Bug 14, §4.6) — see RouteAccessConfig in types.ts. */
74
+ purpose?: string;
75
+ action?: string;
76
+ }
77
+ /**
78
+ * Verify an agent AND automatically record the grant/deny decision.
79
+ *
80
+ * This is the recommended entry point for counterparties that call verify()
81
+ * directly (e.g. MCP servers) rather than using createMiddleware().
82
+ * It adds createSession: true, then fire-and-forgets the decision.
83
+ */
84
+ declare function verifyAndRecord(config: GatewayConfig, request: VerificationRequest, options?: VerifyOptions): Promise<VerificationResult>;
85
+ /**
86
+ * Report an unregistered agent attempt (no AstraSync credentials).
87
+ * Called by SDK adapters when an agent is redirected to /docs/agent-access.
88
+ * Fire-and-forget — errors are silently swallowed.
89
+ */
90
+ declare function reportUnregisteredAttempt(config: GatewayConfig, data: {
91
+ /**
92
+ * 3.6.0: optional — the backend attributes by counterpartyId first (sent
93
+ * from config below) and requires at least ONE of counterpartyId/URL.
94
+ * A null/undefined URL is omitted from the body, not sent as null.
95
+ */
96
+ counterpartyUrl?: string;
97
+ counterpartyType?: string;
98
+ sourceIp?: string;
99
+ userAgent?: string;
100
+ requestPath?: string;
101
+ requestMethod?: string;
102
+ /**
103
+ * 3.9.0 (§33.5 #1) — edge-adapter evidence fields, persisted into the
104
+ * event's eventData by the backend: `protocol` = detected transport/
105
+ * credential protocol; `evidence` = light crypto-free detection detail.
106
+ */
107
+ protocol?: string;
108
+ evidence?: Record<string, unknown>;
109
+ /**
110
+ * Workstream D — the full sanitised metadata capture for an unregistered
111
+ * caller. Persisted into eventData; feeds platform attribution and (via
112
+ * correlationId) registration auto-fill. Fire-and-forget, so free.
113
+ */
114
+ observedMetadata?: ObservedMetadata;
115
+ }): Promise<void>;
116
+ /**
117
+ * Report a counterparty-side PDLSS pre-check failure.
118
+ * Called by SDK adapters when the agent's requested PDLSS exceeds
119
+ * counterparty-defined maximums BEFORE calling verify-access.
120
+ * Fire-and-forget — errors are silently swallowed.
121
+ */
122
+ declare function reportCounterpartyPreCheckFailure(config: GatewayConfig, data: {
123
+ agentId: string;
124
+ counterpartyUrl: string;
125
+ counterpartyType?: string;
126
+ failures: Array<{
127
+ field: string;
128
+ requested: string | number;
129
+ limit: string | number | string[];
130
+ message: string;
131
+ }>;
132
+ requestPath?: string;
133
+ requestMethod?: string;
134
+ }): Promise<void>;
135
+ /**
136
+ * Quick verification — checks credentials and policy in one call.
137
+ *
138
+ * Round-18 G4: return shape mirrors `VerificationResult`'s split — partners
139
+ * writing custom handlers around `quickVerify` get the same identity/policy
140
+ * distinction as those calling `verify()` directly. Map to HTTP status the
141
+ * same way: `!identityVerified` → 401; `identityVerified && !policyAllowed`
142
+ * → 403.
143
+ */
144
+ declare function quickVerify(config: GatewayConfig, credentials: AgentCredentials): Promise<{
145
+ identityVerified: boolean;
146
+ policyAllowed: boolean;
147
+ accessLevel: AccessLevel;
148
+ reason?: string;
149
+ }>;
150
+
151
+ export { type RouteAccessConfigShape, type VerifyOptions, clearCache, extractCredentials, fetchRoutes, hasCredentials, quickVerify, recordDecision, reportCounterpartyPreCheckFailure, reportUnregisteredAttempt, verify, verifyAndRecord };
@@ -0,0 +1,151 @@
1
+ import { b as AgentCredentials, G as GatewayConfig, a as AccessLevel, V as VerificationRequest, r as VerificationResult } from './types-9tns4wyl.js';
2
+ import { ObservedMetadata } from './metadata-capture.js';
3
+
4
+ /**
5
+ * AstraSync Universal Verification Gateway - Core Verification Logic
6
+ *
7
+ * This module handles the core verification logic, calling the AstraSync API
8
+ * and processing the response into a standardized VerificationResult.
9
+ */
10
+
11
+ /**
12
+ * Clear the verification cache
13
+ */
14
+ declare function clearCache(): void;
15
+ /**
16
+ * Extract agent credentials from various sources
17
+ */
18
+ declare function extractCredentials(headers: Record<string, string | string[] | undefined>, query?: Record<string, string | undefined>): AgentCredentials;
19
+ /**
20
+ * Check if credentials are present
21
+ */
22
+ declare function hasCredentials(credentials: AgentCredentials): boolean;
23
+ /**
24
+ * Options for a single verify() call (as opposed to GatewayConfig, which is
25
+ * per-gateway). Mirrors the Java SDK's `verify(request, bypassCache)`.
26
+ */
27
+ interface VerifyOptions {
28
+ /**
29
+ * Skip the cache READ for this call so the request is guaranteed to reach
30
+ * the backend (the result is still written to the cache if cacheable).
31
+ * Used by the step-up hold-and-poll retry: the re-verify after an approval
32
+ * must hit the server to redeem the single-use approval.
33
+ */
34
+ bypassCache?: boolean;
35
+ }
36
+ /**
37
+ * Main verification function
38
+ */
39
+ declare function verify(config: GatewayConfig, request: VerificationRequest, options?: VerifyOptions): Promise<VerificationResult>;
40
+ /**
41
+ * Record a counterparty's grant/deny decision for a verification session.
42
+ * Fire-and-forget — errors are silently swallowed.
43
+ */
44
+ declare function recordDecision(config: GatewayConfig, sessionId: string, decision: 'granted' | 'denied', reason?: string): Promise<void>;
45
+ /**
46
+ * Fetch the per-route policy for an endpoint from the AstraSync backend.
47
+ * v2.9.7 moved policy authority into the dashboard — the SDK no longer
48
+ * accepts `routes` from merchant-side source code, it fetches them from
49
+ * here on init (and refreshes periodically).
50
+ *
51
+ * Returns `null` when the request fails for any reason — the caller decides
52
+ * how to fall back (the middleware allows-all when no policy is loaded so
53
+ * a misconfigured init doesn't take down the merchant's API).
54
+ */
55
+ declare function fetchRoutes(config: GatewayConfig, counterpartyId: string): Promise<RouteAccessConfigShape[] | null>;
56
+ /**
57
+ * Minimal shape of an EndpointRoute as the SDK consumes it. Mirrors the
58
+ * server's `EndpointRoute` type and the SDK's `RouteAccessConfig` — same
59
+ * JSON moves between server and SDK unchanged.
60
+ */
61
+ interface RouteAccessConfigShape {
62
+ pattern: string;
63
+ method: string;
64
+ /** @deprecated 3.2.0 — band no longer gates; optional, ignored. Use minTrustScore. */
65
+ minAccessLevel?: 'none' | 'restricted' | 'read-only' | 'standard' | 'full' | 'internal';
66
+ minTrustScore?: number;
67
+ requiredPurposes?: string[];
68
+ allowedPurposes?: string[];
69
+ allowedJurisdictions?: string[];
70
+ maxDuration?: number;
71
+ maxTransactionValue?: number;
72
+ requirePurpose?: boolean;
73
+ /** Send-mapping (Bug 14, §4.6) — see RouteAccessConfig in types.ts. */
74
+ purpose?: string;
75
+ action?: string;
76
+ }
77
+ /**
78
+ * Verify an agent AND automatically record the grant/deny decision.
79
+ *
80
+ * This is the recommended entry point for counterparties that call verify()
81
+ * directly (e.g. MCP servers) rather than using createMiddleware().
82
+ * It adds createSession: true, then fire-and-forgets the decision.
83
+ */
84
+ declare function verifyAndRecord(config: GatewayConfig, request: VerificationRequest, options?: VerifyOptions): Promise<VerificationResult>;
85
+ /**
86
+ * Report an unregistered agent attempt (no AstraSync credentials).
87
+ * Called by SDK adapters when an agent is redirected to /docs/agent-access.
88
+ * Fire-and-forget — errors are silently swallowed.
89
+ */
90
+ declare function reportUnregisteredAttempt(config: GatewayConfig, data: {
91
+ /**
92
+ * 3.6.0: optional — the backend attributes by counterpartyId first (sent
93
+ * from config below) and requires at least ONE of counterpartyId/URL.
94
+ * A null/undefined URL is omitted from the body, not sent as null.
95
+ */
96
+ counterpartyUrl?: string;
97
+ counterpartyType?: string;
98
+ sourceIp?: string;
99
+ userAgent?: string;
100
+ requestPath?: string;
101
+ requestMethod?: string;
102
+ /**
103
+ * 3.9.0 (§33.5 #1) — edge-adapter evidence fields, persisted into the
104
+ * event's eventData by the backend: `protocol` = detected transport/
105
+ * credential protocol; `evidence` = light crypto-free detection detail.
106
+ */
107
+ protocol?: string;
108
+ evidence?: Record<string, unknown>;
109
+ /**
110
+ * Workstream D — the full sanitised metadata capture for an unregistered
111
+ * caller. Persisted into eventData; feeds platform attribution and (via
112
+ * correlationId) registration auto-fill. Fire-and-forget, so free.
113
+ */
114
+ observedMetadata?: ObservedMetadata;
115
+ }): Promise<void>;
116
+ /**
117
+ * Report a counterparty-side PDLSS pre-check failure.
118
+ * Called by SDK adapters when the agent's requested PDLSS exceeds
119
+ * counterparty-defined maximums BEFORE calling verify-access.
120
+ * Fire-and-forget — errors are silently swallowed.
121
+ */
122
+ declare function reportCounterpartyPreCheckFailure(config: GatewayConfig, data: {
123
+ agentId: string;
124
+ counterpartyUrl: string;
125
+ counterpartyType?: string;
126
+ failures: Array<{
127
+ field: string;
128
+ requested: string | number;
129
+ limit: string | number | string[];
130
+ message: string;
131
+ }>;
132
+ requestPath?: string;
133
+ requestMethod?: string;
134
+ }): Promise<void>;
135
+ /**
136
+ * Quick verification — checks credentials and policy in one call.
137
+ *
138
+ * Round-18 G4: return shape mirrors `VerificationResult`'s split — partners
139
+ * writing custom handlers around `quickVerify` get the same identity/policy
140
+ * distinction as those calling `verify()` directly. Map to HTTP status the
141
+ * same way: `!identityVerified` → 401; `identityVerified && !policyAllowed`
142
+ * → 403.
143
+ */
144
+ declare function quickVerify(config: GatewayConfig, credentials: AgentCredentials): Promise<{
145
+ identityVerified: boolean;
146
+ policyAllowed: boolean;
147
+ accessLevel: AccessLevel;
148
+ reason?: string;
149
+ }>;
150
+
151
+ export { type RouteAccessConfigShape, type VerifyOptions, clearCache, extractCredentials, fetchRoutes, hasCredentials, quickVerify, recordDecision, reportCounterpartyPreCheckFailure, reportUnregisteredAttempt, verify, verifyAndRecord };