@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.
- package/dist/adapter-interface/interface.d.mts +2 -3
- package/dist/adapter-interface/interface.d.ts +2 -3
- package/dist/adapters/express.d.mts +63 -4
- package/dist/adapters/express.d.ts +63 -4
- package/dist/adapters/express.js +9 -2
- package/dist/adapters/express.js.map +1 -1
- package/dist/adapters/express.mjs +9 -2
- package/dist/adapters/express.mjs.map +1 -1
- package/dist/adapters/mcp.d.mts +396 -4
- package/dist/adapters/mcp.d.ts +396 -4
- package/dist/adapters/mcp.js +9 -2
- package/dist/adapters/mcp.js.map +1 -1
- package/dist/adapters/mcp.mjs +9 -2
- package/dist/adapters/mcp.mjs.map +1 -1
- package/dist/adapters/nextjs.d.mts +22 -4
- package/dist/adapters/nextjs.d.ts +22 -4
- package/dist/adapters/nextjs.js +9 -2
- package/dist/adapters/nextjs.js.map +1 -1
- package/dist/adapters/nextjs.mjs +9 -2
- package/dist/adapters/nextjs.mjs.map +1 -1
- package/dist/adapters/sdk.d.mts +157 -3
- package/dist/adapters/sdk.d.ts +157 -3
- package/dist/adapters/sdk.js +35 -15
- package/dist/adapters/sdk.js.map +1 -1
- package/dist/adapters/sdk.mjs +35 -15
- package/dist/adapters/sdk.mjs.map +1 -1
- package/dist/agent/index.d.mts +224 -3
- package/dist/agent/index.d.ts +224 -3
- 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 +9 -2
- package/dist/bin/astrasync-codex-hook.js +9 -2
- package/dist/bin/astrasync-guard.js +9 -2
- package/dist/bin/astrasync.js +9 -2
- package/dist/browser/background.js +9 -2
- package/dist/browser/background.js.map +1 -1
- package/dist/browser/background.mjs +9 -2
- package/dist/browser/background.mjs.map +1 -1
- package/dist/browser/browser-adapter.d.mts +1 -5
- package/dist/browser/browser-adapter.d.ts +1 -5
- package/dist/claude-code/claude-code-adapter.d.mts +1 -5
- package/dist/claude-code/claude-code-adapter.d.ts +1 -5
- package/dist/cli/index.d.mts +1 -5
- package/dist/cli/index.d.ts +1 -5
- 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.d.mts +1 -5
- package/dist/codex/index.d.ts +1 -5
- package/dist/codex/index.js +9 -2
- package/dist/codex/index.js.map +1 -1
- package/dist/codex/index.mjs +9 -2
- package/dist/codex/index.mjs.map +1 -1
- package/dist/cursor/cursor-adapter.d.mts +1 -5
- package/dist/cursor/cursor-adapter.d.ts +1 -5
- package/dist/cursor/extension.d.mts +1 -5
- package/dist/cursor/extension.d.ts +1 -5
- package/dist/cursor/extension.js +9 -2
- package/dist/cursor/extension.js.map +1 -1
- package/dist/cursor/extension.mjs +9 -2
- 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 +9 -2
- package/dist/edge-core/index.js.map +1 -1
- package/dist/edge-core/index.mjs +9 -2
- package/dist/edge-core/index.mjs.map +1 -1
- package/dist/gateway/gateway.d.mts +2 -3
- package/dist/gateway/gateway.d.ts +2 -3
- package/dist/gateway/gateway.js +9 -2
- package/dist/gateway/gateway.js.map +1 -1
- package/dist/gateway/gateway.mjs +9 -2
- package/dist/gateway/gateway.mjs.map +1 -1
- package/dist/git-trigger/git-hooks.d.mts +253 -3
- package/dist/git-trigger/git-hooks.d.ts +253 -3
- package/dist/index.d.mts +4506 -42
- package/dist/index.d.ts +4506 -42
- package/dist/index.js +35 -15
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +35 -15
- package/dist/index.mjs.map +1 -1
- package/dist/interface-q1WrMsB1.d.mts +365 -0
- package/dist/interface-q1WrMsB1.d.ts +365 -0
- package/dist/local-evaluator/evaluator.d.mts +2 -3
- package/dist/local-evaluator/evaluator.d.ts +2 -3
- 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.d.mts +1324 -4
- package/dist/transport/index.d.ts +1324 -4
- 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-DGh2akuh.d.ts → types-BRz2U0Pn.d.ts} +2 -2
- package/dist/{types-76TB0fxW.d.ts → types-BU04qAAR.d.mts} +59 -213
- package/dist/{types-CD1F9fmp.d.mts → types-BU04qAAR.d.ts} +59 -213
- package/dist/types-Bd2O3eX1.d.mts +769 -0
- package/dist/types-BfILnheI.d.mts +189 -0
- package/dist/types-BfILnheI.d.ts +189 -0
- package/dist/{types-z_RNjHWm.d.mts → types-CfBpm3w5.d.mts} +2 -2
- package/dist/types-DMChboN_.d.ts +769 -0
- package/dist/ui/index.d.mts +1 -2
- package/dist/ui/index.d.ts +1 -2
- package/dist/verify.d.mts +1 -1
- package/dist/verify.d.ts +1 -1
- package/dist/verify.js +9 -2
- package/dist/verify.js.map +1 -1
- package/dist/verify.mjs +9 -2
- package/dist/verify.mjs.map +1 -1
- package/package.json +1 -1
- package/dist/express-BIAT2pe0.d.mts +0 -69
- package/dist/express-D3Tf-b23.d.ts +0 -69
- package/dist/index-BVJkTyIF.d.mts +0 -248
- package/dist/index-By021oSN.d.mts +0 -1469
- package/dist/index-DaMXZabg.d.ts +0 -248
- package/dist/index-iJ9_DdLk.d.ts +0 -1469
- package/dist/mcp-BqfTDZLh.d.mts +0 -397
- package/dist/mcp-OrVOrH-s.d.ts +0 -397
- package/dist/nextjs-DGJXzWst.d.mts +0 -28
- package/dist/nextjs-xM-jdNrX.d.ts +0 -28
- package/dist/sdk-C1IOA5LE.d.ts +0 -173
- package/dist/sdk-C6_-6D-9.d.mts +0 -173
|
@@ -0,0 +1,769 @@
|
|
|
1
|
+
import { ObservedMetadata } from './metadata-capture.mjs';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* AstraSync Universal Verification Gateway Types
|
|
5
|
+
*
|
|
6
|
+
* TypeScript type definitions for agent verification across all counterparty types.
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Trust levels assigned to agents based on their composite trust score
|
|
11
|
+
*/
|
|
12
|
+
type TrustLevel = 'BRONZE' | 'SILVER' | 'GOLD' | 'PLATINUM';
|
|
13
|
+
/**
|
|
14
|
+
* Types of counterparties that can integrate the gateway
|
|
15
|
+
*/
|
|
16
|
+
type CounterpartyType = 'agent' | 'api' | 'mcp_server' | 'website' | 'other' | 'unknown';
|
|
17
|
+
/**
|
|
18
|
+
* Agent credentials extracted from request
|
|
19
|
+
*/
|
|
20
|
+
interface AgentCredentials {
|
|
21
|
+
/** ASTRA-xxx identifier */
|
|
22
|
+
astraId?: string;
|
|
23
|
+
/** API key for authentication */
|
|
24
|
+
apiKey?: string;
|
|
25
|
+
/** JWT token */
|
|
26
|
+
jwt?: string;
|
|
27
|
+
/** Raw authorization header */
|
|
28
|
+
authorizationHeader?: string;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Configuration options for the verification gateway
|
|
32
|
+
*/
|
|
33
|
+
interface GatewayConfig {
|
|
34
|
+
/** AstraSync API base URL */
|
|
35
|
+
apiBaseUrl: string;
|
|
36
|
+
/** API key for authenticating with AstraSync. */
|
|
37
|
+
apiKey?: string;
|
|
38
|
+
/**
|
|
39
|
+
* @deprecated Removed in v2.3.0 — server is the single source of truth for
|
|
40
|
+
* access decisions (verified ID + runtime challenge + PDLSS + trust score).
|
|
41
|
+
* Setting this no longer affects access decisions. If you need a higher gate
|
|
42
|
+
* for an endpoint, configure it server-side via the endpoint's
|
|
43
|
+
* `trust_score_requirement`.
|
|
44
|
+
*/
|
|
45
|
+
minTrustScore?: number;
|
|
46
|
+
/**
|
|
47
|
+
* @deprecated Removed in v2.3.0 — see `minTrustScore` above.
|
|
48
|
+
*/
|
|
49
|
+
minTrustScoreForFull?: number;
|
|
50
|
+
/** Cache verification results (TTL in seconds) */
|
|
51
|
+
cacheTtl?: number;
|
|
52
|
+
/** Enable debug logging */
|
|
53
|
+
debug?: boolean;
|
|
54
|
+
/** Custom headers to send with verification requests */
|
|
55
|
+
customHeaders?: Record<string, string>;
|
|
56
|
+
/** This counterparty's URL (sent with verify-access requests for analytics) */
|
|
57
|
+
counterpartyUrl?: string;
|
|
58
|
+
/** This counterparty's type (sent with verify-access requests for analytics) */
|
|
59
|
+
counterpartyType?: CounterpartyType;
|
|
60
|
+
/**
|
|
61
|
+
* This counterparty's ASTRAE-id (issued at endpoint registration). When set,
|
|
62
|
+
* the SDK forwards it on verify-access calls so the server attributes traffic
|
|
63
|
+
* directly to this endpoint rather than resolving by URL. Useful when:
|
|
64
|
+
* - The merchant has multiple endpoints under the same origin (each running
|
|
65
|
+
* its own SDK instance with its own counterpartyId)
|
|
66
|
+
* - The endpoint URL might be served behind a proxy / different host than
|
|
67
|
+
* the registered origin
|
|
68
|
+
*/
|
|
69
|
+
counterpartyId?: string;
|
|
70
|
+
/**
|
|
71
|
+
* Step-up hold-and-poll (3.6.0, opt-in). When set, adapters HOLD a request
|
|
72
|
+
* whose verify() came back step_up_required, poll the approval status, and
|
|
73
|
+
* on 'approved' re-verify the same request once (cache-bypassed) so the
|
|
74
|
+
* backend redeems the single-use approval — the MFA model the Java SDK
|
|
75
|
+
* ships default-on. Values:
|
|
76
|
+
* - undefined (default): feature OFF — adapters fail closed immediately,
|
|
77
|
+
* exactly as 3.5.0 (a minor release must not silently convert instant
|
|
78
|
+
* 403s into multi-minute holds).
|
|
79
|
+
* - 0: hold until the approval's expiresAt (+5s grace); 5-min fallback
|
|
80
|
+
* when expiresAt is missing/unparsable (Java parity).
|
|
81
|
+
* - >0: hold at most this many milliseconds.
|
|
82
|
+
* Next.js edge runtimes enforce ~25s wall-clock budgets — set a small value
|
|
83
|
+
* there (≤20000) or gate in a Node route handler instead.
|
|
84
|
+
*/
|
|
85
|
+
stepUpMaxWaitMs?: number;
|
|
86
|
+
/**
|
|
87
|
+
* Poll interval for the step-up hold (3.6.0). Default 3000ms, clamped to a
|
|
88
|
+
* 250ms floor. At the default the backend's 60/min/IP poll rate limit
|
|
89
|
+
* tolerates ~3 concurrent holds per merchant IP; poll errors are treated as
|
|
90
|
+
* transient, so limiter hits degrade the hold to 'timeout', never an error.
|
|
91
|
+
*/
|
|
92
|
+
stepUpPollIntervalMs?: number;
|
|
93
|
+
/**
|
|
94
|
+
* Disable the one-time init self-test. The SDK normally fires a HEAD/OPTIONS
|
|
95
|
+
* to `${apiBaseUrl}/agents/verify-access` on first verify() call and warns
|
|
96
|
+
* if the response is HTML (indicating apiBaseUrl is pointing at a marketing
|
|
97
|
+
* site rather than the API). Set true for tests or environments where the
|
|
98
|
+
* extra request is undesirable.
|
|
99
|
+
*/
|
|
100
|
+
disableInitChecks?: boolean;
|
|
101
|
+
/**
|
|
102
|
+
* When true, the init self-test runs synchronously on the first verify()
|
|
103
|
+
* call and THROWS on misconfig (apiBaseUrl returning HTML, unreachable,
|
|
104
|
+
* etc.) instead of warning + continuing. Recommended for production
|
|
105
|
+
* deploys where you want a fast-fail startup signal rather than silent
|
|
106
|
+
* verify-access call failures. Default false for backward compatibility.
|
|
107
|
+
*/
|
|
108
|
+
strictInit?: boolean;
|
|
109
|
+
/**
|
|
110
|
+
* 4.0.0: hard timeout (ms) on the outbound verify-access call. Without it
|
|
111
|
+
* a hanging backend hangs the merchant's middleware — and every inbound
|
|
112
|
+
* agent request behind it — indefinitely. Timeouts surface as the
|
|
113
|
+
* fail-closed `verify_access.api_error` result. Default 10_000.
|
|
114
|
+
*/
|
|
115
|
+
verifyTimeoutMs?: number;
|
|
116
|
+
/**
|
|
117
|
+
* v2.3.8: emit `X-Astra-Gateway-Mode: unenforced` (with
|
|
118
|
+
* `X-Astra-Gateway-Reason: no-policy | no-match`) on responses where the
|
|
119
|
+
* middleware fell through without consulting verify-access. Lets integration
|
|
120
|
+
* tests assert "this endpoint should be gated; if it falls through, fail
|
|
121
|
+
* loudly". Default off; opt-in.
|
|
122
|
+
*
|
|
123
|
+
* The header value was renamed from the ambiguous `pass-through` to
|
|
124
|
+
* `unenforced` so it describes the GATE state only — not whether the
|
|
125
|
+
* request succeeded end-to-end. The config FLAG name
|
|
126
|
+
* (`setPassThroughHeader`) is unchanged for backwards compatibility.
|
|
127
|
+
*/
|
|
128
|
+
setPassThroughHeader?: boolean;
|
|
129
|
+
/**
|
|
130
|
+
* v2.3.8: dashboard origin used to construct configuration links in
|
|
131
|
+
* boot-time warnings (e.g. when no per-route policy is configured).
|
|
132
|
+
* Defaults to `https://astrasync.ai/dashboard` (the `app.astrasync.ai`
|
|
133
|
+
* subdomain referenced in older docs does not resolve).
|
|
134
|
+
*/
|
|
135
|
+
dashboardUrl?: string;
|
|
136
|
+
/**
|
|
137
|
+
* When true, the middleware calls verify-access for any request that presents
|
|
138
|
+
* AstraSync credentials, even on `observe`-marked routes / tools that would
|
|
139
|
+
* otherwise pass through unevaluated. Populates `req.agentVerification` and
|
|
140
|
+
* records the verification event for the audit trail. Enforcement still
|
|
141
|
+
* respects the gate — an `observe` marker still passes through regardless of
|
|
142
|
+
* the server decision. Default false to preserve existing behaviour.
|
|
143
|
+
*
|
|
144
|
+
* Use this when a single endpoint serves both anonymous and verified
|
|
145
|
+
* traffic with different response shapes (e.g. anonymous catalog vs
|
|
146
|
+
* verified catalog with agent-only SKUs; anonymous MCP tool listing
|
|
147
|
+
* vs verified tool-listing with restricted tools surfaced). Without
|
|
148
|
+
* the flag, anonymous-with-credentials passes are invisible to the
|
|
149
|
+
* merchant handler and to the AstraSync activity feed.
|
|
150
|
+
*
|
|
151
|
+
* Lives on `GatewayConfig` (not adapter-specific) so both express and
|
|
152
|
+
* MCP middlewares inherit it via their `extends GatewayConfig` chain.
|
|
153
|
+
*/
|
|
154
|
+
evaluateAlwaysIfCredentialed?: boolean;
|
|
155
|
+
}
|
|
156
|
+
/**
|
|
157
|
+
* Verified agent information
|
|
158
|
+
*/
|
|
159
|
+
interface VerifiedAgent {
|
|
160
|
+
/** ASTRA-xxx identifier */
|
|
161
|
+
astraId: string;
|
|
162
|
+
/** Agent display name */
|
|
163
|
+
name: string;
|
|
164
|
+
/** Composite trust score (0-100) */
|
|
165
|
+
trustScore: number;
|
|
166
|
+
/** Trust level tier */
|
|
167
|
+
trustLevel: TrustLevel;
|
|
168
|
+
/** Whether agent is blockchain-verified */
|
|
169
|
+
blockchainVerified: boolean;
|
|
170
|
+
/** Agent status */
|
|
171
|
+
status: 'active' | 'inactive' | 'suspended' | 'migrating' | 'terminated' | 'retired';
|
|
172
|
+
}
|
|
173
|
+
/**
|
|
174
|
+
* Verified developer (KYD) information
|
|
175
|
+
*/
|
|
176
|
+
interface VerifiedDeveloper {
|
|
177
|
+
/** ASTRAD-xxx identifier */
|
|
178
|
+
astradId: string;
|
|
179
|
+
/** Developer name */
|
|
180
|
+
name?: string;
|
|
181
|
+
/** Developer trust score */
|
|
182
|
+
trustScore: number;
|
|
183
|
+
/** Whether developer identity is verified */
|
|
184
|
+
verified: boolean;
|
|
185
|
+
}
|
|
186
|
+
/**
|
|
187
|
+
* Verified organization (KYO) information
|
|
188
|
+
*/
|
|
189
|
+
interface VerifiedOrganization {
|
|
190
|
+
/** Organization name */
|
|
191
|
+
name: string;
|
|
192
|
+
/** Whether organization is verified */
|
|
193
|
+
verified: boolean;
|
|
194
|
+
/** Organization trust score */
|
|
195
|
+
trustScore: number;
|
|
196
|
+
}
|
|
197
|
+
/**
|
|
198
|
+
* PDLSS policy information returned with verification.
|
|
199
|
+
*
|
|
200
|
+
* @deprecated v2.2.4 — verify-access no longer returns the full PDLSS to the
|
|
201
|
+
* merchant. Read `EnhancedVerificationResult.verificationContext.pdlssCheck`
|
|
202
|
+
* instead for the merchant-facing summary, and `appliedPolicy` (top-level on
|
|
203
|
+
* the verification result) for the boundary name + policy version. The full
|
|
204
|
+
* PDLSS is owner-side only (queryable via `/api/agents/:id` when
|
|
205
|
+
* authenticated as the agent owner).
|
|
206
|
+
*/
|
|
207
|
+
interface PDLSSInfo {
|
|
208
|
+
purposeAllowed: boolean;
|
|
209
|
+
withinDuration: boolean;
|
|
210
|
+
withinLimits: boolean;
|
|
211
|
+
scopeAllowed: boolean;
|
|
212
|
+
selfInstantiationAllowed: boolean;
|
|
213
|
+
allowedPurposes?: string[];
|
|
214
|
+
limits?: Record<string, number>;
|
|
215
|
+
scope?: string[];
|
|
216
|
+
/** Applied policy details. Boundary/policy UUIDs deliberately not included. */
|
|
217
|
+
appliedPolicy?: AppliedPolicy;
|
|
218
|
+
}
|
|
219
|
+
/**
|
|
220
|
+
* Applied policy — merchant-facing identifiers only.
|
|
221
|
+
*
|
|
222
|
+
* Boundary and policy UUIDs are deliberately not surfaced; merchants and
|
|
223
|
+
* agent owners are different tenants and internal join keys are a
|
|
224
|
+
* cross-tenant correlation primitive. Internal callers that need UUIDs
|
|
225
|
+
* query the boundary/policy tables directly.
|
|
226
|
+
*/
|
|
227
|
+
interface AppliedPolicy {
|
|
228
|
+
boundaryName: string;
|
|
229
|
+
policyVersion: string;
|
|
230
|
+
}
|
|
231
|
+
/**
|
|
232
|
+
* Guidance information for unverified agents
|
|
233
|
+
*/
|
|
234
|
+
interface GuidanceInfo {
|
|
235
|
+
/** Human-readable guidance message */
|
|
236
|
+
message: string;
|
|
237
|
+
/** URL to register for AstraSync */
|
|
238
|
+
registrationUrl: string;
|
|
239
|
+
/** URL to documentation */
|
|
240
|
+
documentationUrl: string;
|
|
241
|
+
/** Steps to get verified */
|
|
242
|
+
steps?: string[];
|
|
243
|
+
/**
|
|
244
|
+
* 5.1.0: hosted AstraSync MCP connector — the keyless, human-approved
|
|
245
|
+
* registration path for agents already operating inside an MCP host.
|
|
246
|
+
*/
|
|
247
|
+
mcp?: {
|
|
248
|
+
endpoint: string;
|
|
249
|
+
discoveryUrl?: string;
|
|
250
|
+
message?: string;
|
|
251
|
+
};
|
|
252
|
+
}
|
|
253
|
+
interface StepUpApprovalInfo {
|
|
254
|
+
approvalId: string;
|
|
255
|
+
pollUrl: string;
|
|
256
|
+
expiresAt: string;
|
|
257
|
+
}
|
|
258
|
+
/**
|
|
259
|
+
* Lifecycle states of a step-up approval row (mirrors the backend's
|
|
260
|
+
* step_up_approval_status_check constraint).
|
|
261
|
+
*/
|
|
262
|
+
type StepUpApprovalStatus = 'pending' | 'approved' | 'denied' | 'expired' | 'consumed';
|
|
263
|
+
/**
|
|
264
|
+
* Terminal outcome of a hold-and-poll wait: any non-pending status, or
|
|
265
|
+
* 'timeout' when the hold budget ran out while the approval was still pending.
|
|
266
|
+
*/
|
|
267
|
+
type StepUpOutcome = Exclude<StepUpApprovalStatus, 'pending'> | 'timeout';
|
|
268
|
+
/** Fields common to every settlement-artifact binding. */
|
|
269
|
+
interface SettlementArtifactBindingBase {
|
|
270
|
+
merchantId: string;
|
|
271
|
+
sessionId: string;
|
|
272
|
+
singleUse: true;
|
|
273
|
+
expiresAt: string;
|
|
274
|
+
}
|
|
275
|
+
/**
|
|
276
|
+
* Fiat/processor artifact binding (Stripe, Skyfire, PayPal) — the processor
|
|
277
|
+
* is the unit authority, so the binding carries the major-unit pricing amount.
|
|
278
|
+
*/
|
|
279
|
+
interface FiatSettlementBinding extends SettlementArtifactBindingBase {
|
|
280
|
+
amount: number;
|
|
281
|
+
currency: string;
|
|
282
|
+
}
|
|
283
|
+
/**
|
|
284
|
+
* Stablecoin voucher binding — wire format v2. Money is integer minor units
|
|
285
|
+
* (`amountMinor` scaled by `assetDecimals`, no floats), and the settlement
|
|
286
|
+
* asset is pinned to a chain + token contract (CAIP-19 `asset`).
|
|
287
|
+
*/
|
|
288
|
+
interface StablecoinSettlementBinding extends SettlementArtifactBindingBase {
|
|
289
|
+
amountMinor: number;
|
|
290
|
+
assetDecimals: number;
|
|
291
|
+
currency: string;
|
|
292
|
+
chainId: number;
|
|
293
|
+
tokenContract: string;
|
|
294
|
+
asset: string;
|
|
295
|
+
}
|
|
296
|
+
type SettlementArtifactBinding = FiatSettlementBinding | StablecoinSettlementBinding;
|
|
297
|
+
/**
|
|
298
|
+
* Settlement artifact returned on a clean merchant-mediated grant. The JWS
|
|
299
|
+
* `artifact` is the authoritative, signed object — `binding` mirrors its
|
|
300
|
+
* claims for display convenience only. Never settle from `binding`; decide
|
|
301
|
+
* from the server-verified payload at redeem time.
|
|
302
|
+
*/
|
|
303
|
+
interface SettlementArtifact {
|
|
304
|
+
type: string;
|
|
305
|
+
artifact: string;
|
|
306
|
+
binding: SettlementArtifactBinding;
|
|
307
|
+
}
|
|
308
|
+
/**
|
|
309
|
+
* Complete verification result
|
|
310
|
+
*/
|
|
311
|
+
/**
|
|
312
|
+
* Single failed gate on a verify-access denial. Aggregated into
|
|
313
|
+
* `VerificationResult.failures[]` so partners can see every blocker in one
|
|
314
|
+
* response (v2.9.8+) — previously the response was fail-fast on the
|
|
315
|
+
* first failed gate, forcing a fix-and-retry cascade through PDLSS
|
|
316
|
+
* dimensions, counterparty allowlist, trust score, and attestations.
|
|
317
|
+
*
|
|
318
|
+
* `dimension` is namespaced so receivers can group by gate family:
|
|
319
|
+
* - `agent.<lookup|status>` (hard prereqs)
|
|
320
|
+
* - `pdlss.<purpose|duration|limits|scope|selfInstantiation>`
|
|
321
|
+
* - `counterparty.<allowlist|trust>`
|
|
322
|
+
* - `attestation.<type>` (e.g. `attestation.verified_human_party`)
|
|
323
|
+
* - `endpoint.<deactivated|trust|policy>`
|
|
324
|
+
*/
|
|
325
|
+
interface AccessFailure {
|
|
326
|
+
dimension: string;
|
|
327
|
+
message: string;
|
|
328
|
+
guidance?: string;
|
|
329
|
+
}
|
|
330
|
+
interface VerificationResult {
|
|
331
|
+
/**
|
|
332
|
+
* Identity-verification status — was the caller successfully
|
|
333
|
+
* resolved to a registered agent (signature/credential check passed)?
|
|
334
|
+
* Maps to backend `verificationContext.idVerified`. Drives HTTP 401 vs 403
|
|
335
|
+
* mapping in default adapters: `!identityVerified` → 401 (re-authenticate);
|
|
336
|
+
* `identityVerified && !policyAllowed` → 403 (re-auth won't help — update
|
|
337
|
+
* PDLSS scope or step up). Replaces the pre-4.x `verified` field, which
|
|
338
|
+
* collapsed identity and policy into a single boolean and forced merchants
|
|
339
|
+
* writing `verified ? 200 : 401` into the wrong HTTP-status recovery path
|
|
340
|
+
* on PDLSS denials of authenticated agents.
|
|
341
|
+
*/
|
|
342
|
+
identityVerified: boolean;
|
|
343
|
+
/**
|
|
344
|
+
* Does the endpoint's PDLSS / access policy permit this
|
|
345
|
+
* specific action? Maps to backend `access.allowed`. Distinct from
|
|
346
|
+
* `identityVerified`: a verified agent can be policy-denied (403); an
|
|
347
|
+
* unverified caller's policy field is `false` by definition.
|
|
348
|
+
*/
|
|
349
|
+
policyAllowed: boolean;
|
|
350
|
+
/** Verified agent info (if verified) */
|
|
351
|
+
agent?: VerifiedAgent;
|
|
352
|
+
/** Developer info (if available) */
|
|
353
|
+
developer?: VerifiedDeveloper;
|
|
354
|
+
/** Organization info (if available) */
|
|
355
|
+
organization?: VerifiedOrganization;
|
|
356
|
+
/** PDLSS policy info (if verified) */
|
|
357
|
+
pdlss?: PDLSSInfo;
|
|
358
|
+
/** Guidance for unverified agents */
|
|
359
|
+
guidance?: GuidanceInfo;
|
|
360
|
+
/** Reasons for denial (if not allowed) */
|
|
361
|
+
denialReasons?: string[];
|
|
362
|
+
/**
|
|
363
|
+
* All policy / gate failures detected on this verify-access call.
|
|
364
|
+
* v2.9.8+ — empty when allowed. Iterate this for the full debug picture
|
|
365
|
+
* instead of consuming `denialReasons` (which only carries the headline
|
|
366
|
+
* message of each failure).
|
|
367
|
+
*/
|
|
368
|
+
failures?: AccessFailure[];
|
|
369
|
+
/**
|
|
370
|
+
* Correlation handle for tying a partner-visible denial to a server-side
|
|
371
|
+
* log line, surfaced so adapter onDenied handlers can include it on the
|
|
372
|
+
* merchant's response body. Present on anonymous server responses, on
|
|
373
|
+
* synthesised stubs for API-error fallbacks (`createGuidanceResponse`),
|
|
374
|
+
* and on the `verify_access.internal_error` 200-shaped failure shape.
|
|
375
|
+
*/
|
|
376
|
+
correlationId?: string;
|
|
377
|
+
/**
|
|
378
|
+
* 3.12.0: attempt-chain handle, server-echoed on
|
|
379
|
+
* every response branch (caller-supplied or server-minted). Disjoint from
|
|
380
|
+
* `correlationId`/`sessionId` — those identify one verification EVENT; an
|
|
381
|
+
* attempt CONTAINS events (the whole catalog → intent → settlement funnel
|
|
382
|
+
* for one shopping attempt). On a cache hit the SDK overwrites this with
|
|
383
|
+
* the current request's own attemptId (or drops it) so a cached verdict
|
|
384
|
+
* never leaks a prior attempt's id.
|
|
385
|
+
*/
|
|
386
|
+
attemptId?: string;
|
|
387
|
+
/**
|
|
388
|
+
* 4.0.0: the backend rejected THIS INTEGRATION'S own API key (revoked /
|
|
389
|
+
* expired / rotated) — a deterministic merchant-side misconfig, distinct
|
|
390
|
+
* from both an agent denial and a transient `verify_access.api_error`.
|
|
391
|
+
* Adapters branch on it to answer inbound agents with 503 +
|
|
392
|
+
* `MERCHANT_VERIFICATION_MISCONFIGURED` instead of a misleading 401.
|
|
393
|
+
*/
|
|
394
|
+
misconfigured?: boolean;
|
|
395
|
+
/**
|
|
396
|
+
* 4.6.0: a TRANSIENT infrastructure failure (`verify_access.api_error` — a
|
|
397
|
+
* 5xx / timeout / CSRF-403 reaching the verify-access backend), NOT a policy
|
|
398
|
+
* deny and NOT a deterministic misconfig. Consumers should surface it as an
|
|
399
|
+
* error-and-retry (recommendation `'error'`), never as a policy denial. Unset
|
|
400
|
+
* on misconfig (deterministic — retrying will not help) and on real denials.
|
|
401
|
+
*/
|
|
402
|
+
retryable?: boolean;
|
|
403
|
+
/** Whether step-up authentication is required */
|
|
404
|
+
requiresStepUp?: boolean;
|
|
405
|
+
/** Whether approval is required */
|
|
406
|
+
requiresApproval?: boolean;
|
|
407
|
+
/** Step-up approval info (present when transaction is in the human-approval band). */
|
|
408
|
+
stepUpApproval?: StepUpApprovalInfo;
|
|
409
|
+
/**
|
|
410
|
+
* Terminal outcome of an opt-in hold-and-poll wait (3.6.0). Set by adapters
|
|
411
|
+
* on the result they deny with when the hold ended in denied / expired /
|
|
412
|
+
* consumed / timeout. Absent when the feature is off or the hold succeeded
|
|
413
|
+
* (an approved hold re-verifies and the fresh grant result replaces this one).
|
|
414
|
+
*/
|
|
415
|
+
stepUpOutcome?: StepUpOutcome;
|
|
416
|
+
/** Settlement voucher (present on clean merchant-mediated grants with a verified wallet). */
|
|
417
|
+
settlement?: SettlementArtifact;
|
|
418
|
+
/**
|
|
419
|
+
* 5.3.0 (astra-pay): sanitized first-party settlement outcome. Present
|
|
420
|
+
* INSTEAD of `settlement` when the counterparty is an AstraSync-operated
|
|
421
|
+
* storefront and the request carried `commercePhase: 'confirm'` — the
|
|
422
|
+
* backend redeemed the voucher and executed the charge server-side
|
|
423
|
+
* (charge-at-redeem), so there is no artifact to deliver, only the result.
|
|
424
|
+
* `no_instrument` = policy passed but the owner has no chargeable
|
|
425
|
+
* instrument on file (steer the user to add one via onboarding).
|
|
426
|
+
*/
|
|
427
|
+
settlementOutcome?: SettlementOutcomeInfo;
|
|
428
|
+
/** Timestamp of verification */
|
|
429
|
+
verifiedAt: Date;
|
|
430
|
+
/** TTL for this result (seconds) */
|
|
431
|
+
cacheTtl?: number;
|
|
432
|
+
}
|
|
433
|
+
/**
|
|
434
|
+
* 5.3.0 (astra-pay): sanitized outcome of first-party charge-at-redeem
|
|
435
|
+
* settlement. Carries NO voucher/instrument material — the settlement channel
|
|
436
|
+
* stays merchant-only; this is the result the agent plane is allowed to see.
|
|
437
|
+
*
|
|
438
|
+
* 5.4.2: `requires_approval` — the transaction is HELD for human step-up
|
|
439
|
+
* approval. Not a failure: record the order as pending; after the human
|
|
440
|
+
* approves, the platform re-drives the confirm with the SAME
|
|
441
|
+
* checkoutSessionId and that re-drive carries the settling outcome
|
|
442
|
+
* (one order row per session — the re-drive claims the same row).
|
|
443
|
+
*/
|
|
444
|
+
interface SettlementOutcomeInfo {
|
|
445
|
+
status: 'settled' | 'failed' | 'requires_action' | 'no_instrument' | 'requires_approval';
|
|
446
|
+
/** First-party order id — the buyer sees the purchase in their AstraSync
|
|
447
|
+
* dashboard orders view (no public receipt page). */
|
|
448
|
+
orderId?: string;
|
|
449
|
+
/** Decline/failure taxonomy code (card_declined, insufficient_funds, …). */
|
|
450
|
+
failureCode?: string;
|
|
451
|
+
}
|
|
452
|
+
/**
|
|
453
|
+
* Request context for verification
|
|
454
|
+
*/
|
|
455
|
+
/**
|
|
456
|
+
* Caller metadata forwarded from the agent's original HTTP request so the
|
|
457
|
+
* endpoint owner can see the real agent-side fingerprint in activity views.
|
|
458
|
+
* Without this, IP/UA recorded on platform_events would be the counterparty
|
|
459
|
+
* server's (useless for endpoint-side forensics).
|
|
460
|
+
*/
|
|
461
|
+
interface CallerMetadata {
|
|
462
|
+
/** Agent-side source IP (honours X-Forwarded-For if set). */
|
|
463
|
+
sourceIp?: string;
|
|
464
|
+
/** Agent's User-Agent header. */
|
|
465
|
+
userAgent?: string;
|
|
466
|
+
/** Referer header (where the agent navigated from, if applicable). */
|
|
467
|
+
referer?: string;
|
|
468
|
+
/** Host the agent called (this counterparty's public hostname). */
|
|
469
|
+
host?: string;
|
|
470
|
+
/** Raw X-Forwarded-For chain for audit. */
|
|
471
|
+
forwardedFor?: string;
|
|
472
|
+
/** Published agent card URL, if the agent advertised one (future: from agent headers). */
|
|
473
|
+
agentCardUrl?: string;
|
|
474
|
+
/**
|
|
475
|
+
* The full sanitised view of the agent's inbound request headers + connection
|
|
476
|
+
* signals (maximal metadata capture: every signal legitimately visible on
|
|
477
|
+
* the wire is captured). Produced by `sanitizeHeaders` (genuine secrets
|
|
478
|
+
* removed, credential headers reduced to a safe format prefix). Forwarded so
|
|
479
|
+
* the endpoint owner sees every wire signal about the agent, not just IP/UA.
|
|
480
|
+
* Local string work only — kept OUT of the verify cache key so per-request
|
|
481
|
+
* maps don't defeat verdict caching.
|
|
482
|
+
*/
|
|
483
|
+
observedMetadata?: ObservedMetadata;
|
|
484
|
+
}
|
|
485
|
+
interface VerificationRequest {
|
|
486
|
+
/** Agent credentials */
|
|
487
|
+
credentials: AgentCredentials;
|
|
488
|
+
/** Purpose of the access request */
|
|
489
|
+
purpose?: string;
|
|
490
|
+
/** Specific action being performed */
|
|
491
|
+
action?: string;
|
|
492
|
+
/** Type of resource being accessed */
|
|
493
|
+
resourceType?: string;
|
|
494
|
+
/** Specific resource identifier */
|
|
495
|
+
resource?: string;
|
|
496
|
+
/** Jurisdiction for the request */
|
|
497
|
+
jurisdiction?: string;
|
|
498
|
+
/**
|
|
499
|
+
* Transaction value in MAJOR units (dollars, euros, native token units —
|
|
500
|
+
* NOT cents/minor units). Diverges from Stripe (minor units). UCP/ACP
|
|
501
|
+
* extractors auto-convert from cents (÷100). x402 uses per-token decimals.
|
|
502
|
+
* See `transport/transaction-value.ts` for per-protocol normalization.
|
|
503
|
+
*/
|
|
504
|
+
transactionValue?: number;
|
|
505
|
+
/** ISO-4217 currency code for transactionValue (e.g. 'USD', 'AUD', 'ETH'). Falls back to 'USD' server-side when unset. */
|
|
506
|
+
currency?: string;
|
|
507
|
+
/**
|
|
508
|
+
* 5.3.0 (astra-pay): checkout-leg discriminator. `'confirm'` marks the
|
|
509
|
+
* completing call of a checkout; first-party settlement (charge-at-redeem
|
|
510
|
+
* on the owner's saved instrument) fires ONLY on this leg. Quote/browse
|
|
511
|
+
* legs omit it (or send `'quote'`) — they must never move money.
|
|
512
|
+
*/
|
|
513
|
+
commercePhase?: 'quote' | 'confirm';
|
|
514
|
+
/**
|
|
515
|
+
* 5.3.0 (astra-pay): per-cart idempotency key (the checkout session id),
|
|
516
|
+
* forwarded on the confirm leg. Two concurrent confirms carrying the same
|
|
517
|
+
* key charge the owner's card at most once. Omit for raw one-shot confirms.
|
|
518
|
+
*/
|
|
519
|
+
checkoutSessionId?: string;
|
|
520
|
+
/**
|
|
521
|
+
* 5.3.0 (astra-pay): the checkout's authoritative line items, forwarded on
|
|
522
|
+
* the confirm leg for the ORDER plane (receipts + digital-goods fulfillment
|
|
523
|
+
* email). Informational — never the money authority (that remains
|
|
524
|
+
* `transactionValue` bound into the settlement voucher).
|
|
525
|
+
*/
|
|
526
|
+
checkoutItems?: Array<{
|
|
527
|
+
sku: string;
|
|
528
|
+
quantity: number;
|
|
529
|
+
title?: string;
|
|
530
|
+
unitPrice?: {
|
|
531
|
+
amount: string;
|
|
532
|
+
currency: string;
|
|
533
|
+
};
|
|
534
|
+
}>;
|
|
535
|
+
/** Whether this is a sub-agent request */
|
|
536
|
+
isSubAgentRequest?: boolean;
|
|
537
|
+
/** Parent agent ID for sub-agent requests */
|
|
538
|
+
parentAgentId?: string;
|
|
539
|
+
/** Depth of sub-agent chain */
|
|
540
|
+
subAgentDepth?: number;
|
|
541
|
+
/** Client IP address (deprecated — use callerMetadata.sourceIp) */
|
|
542
|
+
clientIp?: string;
|
|
543
|
+
/** User agent string (deprecated — use callerMetadata.userAgent) */
|
|
544
|
+
userAgent?: string;
|
|
545
|
+
/**
|
|
546
|
+
* Forwarded request metadata from the agent's original call.
|
|
547
|
+
* When the SDK is embedded in a counterparty server, these describe
|
|
548
|
+
* the agent-side fingerprint — not the counterparty server itself.
|
|
549
|
+
* The express/nextjs adapters auto-populate these from `req`.
|
|
550
|
+
*/
|
|
551
|
+
callerMetadata?: CallerMetadata;
|
|
552
|
+
/** Enable runtime challenge for this request */
|
|
553
|
+
enableRuntimeChallenge?: boolean;
|
|
554
|
+
/** Create a verification session (returns sessionId) */
|
|
555
|
+
createSession?: boolean;
|
|
556
|
+
/** Counterparty type */
|
|
557
|
+
counterpartyType?: CounterpartyType;
|
|
558
|
+
/** Counterparty URL */
|
|
559
|
+
counterpartyUrl?: string;
|
|
560
|
+
/** Requested session duration in seconds (from agent's X-Astra-Duration header) */
|
|
561
|
+
durationRequired?: number;
|
|
562
|
+
/** Runtime challenge options */
|
|
563
|
+
runtimeChallengeOptions?: {
|
|
564
|
+
timeoutOverride?: number;
|
|
565
|
+
};
|
|
566
|
+
/**
|
|
567
|
+
* Transport protocol marker. Set by the MCP middleware
|
|
568
|
+
* to `'mcp'`; non-MCP callers leave it unset (server treats as `'rest'`).
|
|
569
|
+
* Separates "how did the call arrive" from "what does the agent want"
|
|
570
|
+
* (`purpose`). Stored on platform_events.eventData for activity-feed
|
|
571
|
+
* visibility into transport-vs-intent.
|
|
572
|
+
*/
|
|
573
|
+
invocationProtocol?: 'rest' | 'mcp' | 'a2a' | 'acp' | 'ap2' | 'mpp' | 'ucp';
|
|
574
|
+
/**
|
|
575
|
+
* 3.9.0 — raw commerce-protocol artifacts forwarded verbatim
|
|
576
|
+
* to verify-access, whose commerce pipeline runs the full
|
|
577
|
+
* cryptographic verification SERVER-side and persists commerce_context on
|
|
578
|
+
* the session. Adapters forward artifacts, they never verify them locally
|
|
579
|
+
* (verify-access is the sole verification sink, so every decision is
|
|
580
|
+
* recorded once, with events). Shape mirrors the backend's
|
|
581
|
+
* `commerceArtifacts` schema 1:1.
|
|
582
|
+
*/
|
|
583
|
+
commerceArtifacts?: CommerceArtifactsPayload;
|
|
584
|
+
/**
|
|
585
|
+
* 3.12.0 — attempt-chain handle correlating the
|
|
586
|
+
* multi-call commerce funnel (catalog → intent → settlement) into ONE
|
|
587
|
+
* attempt. Format `att_` + 32 lowercase hex. Optional: the server mints one
|
|
588
|
+
* when absent and echoes it top-level on every response branch either way.
|
|
589
|
+
* Observational pass-through — never affects the verdict, so it's excluded
|
|
590
|
+
* from the verify cache key.
|
|
591
|
+
*/
|
|
592
|
+
attemptId?: string;
|
|
593
|
+
/**
|
|
594
|
+
* 3.12.0 — first-party observational data: the
|
|
595
|
+
* offers the agent evaluated at this checkpoint (catalog browse / intent
|
|
596
|
+
* selection). Forwarded verbatim to verify-access; never affects the
|
|
597
|
+
* verdict (also excluded from the cache key).
|
|
598
|
+
*/
|
|
599
|
+
considerationSet?: ConsiderationSet;
|
|
600
|
+
}
|
|
601
|
+
/**
|
|
602
|
+
* One offer the agent evaluated. Mirrors the
|
|
603
|
+
* backend's `considerationItemSchema` 1:1 — first-party observational data
|
|
604
|
+
* reported by the transport (bridge / adapters), never verified locally.
|
|
605
|
+
*/
|
|
606
|
+
interface ConsiderationItem {
|
|
607
|
+
/** SKU identifier as the merchant catalog publishes it (1–128 chars). */
|
|
608
|
+
sku: string;
|
|
609
|
+
/** Display title (≤256 chars). */
|
|
610
|
+
name?: string;
|
|
611
|
+
/** Price in MAJOR units (same convention as `transactionValue`), non-negative. */
|
|
612
|
+
price?: number;
|
|
613
|
+
/** ISO-4217 or settlement-asset code (3–6 alphanumeric chars). */
|
|
614
|
+
currency?: string;
|
|
615
|
+
/** Stock state as the catalog declared it; omit when the catalog didn't say. */
|
|
616
|
+
availability?: 'in_stock' | 'out_of_stock' | 'preorder' | 'unknown';
|
|
617
|
+
/** True when the agent selected this offer (intent/settlement checkpoints). */
|
|
618
|
+
chosen?: boolean;
|
|
619
|
+
/** Why an evaluated-but-unchosen offer lost, when the agent can say. */
|
|
620
|
+
notChosenReason?: 'price' | 'policy' | 'trust_threshold' | 'stock' | 'other';
|
|
621
|
+
}
|
|
622
|
+
/**
|
|
623
|
+
* The set of offers evaluated at one funnel checkpoint.
|
|
624
|
+
* Mirrors the backend's `considerationSetSchema` 1:1.
|
|
625
|
+
*
|
|
626
|
+
* `items` is capped at 50 server-side — reporters MUST order chosen items
|
|
627
|
+
* FIRST so purchased counts survive truncation; `totalEvaluated` carries the
|
|
628
|
+
* true pre-cap count and `truncated` flags that the cap was applied.
|
|
629
|
+
*/
|
|
630
|
+
interface ConsiderationSet {
|
|
631
|
+
/** Funnel checkpoint this set was observed at. */
|
|
632
|
+
checkpoint?: 'catalog' | 'intent' | 'settlement';
|
|
633
|
+
/** Offers evaluated (max 50; chosen-first ordering under the cap). */
|
|
634
|
+
items: ConsiderationItem[];
|
|
635
|
+
/** True evaluated count — survives the 50-item cap. */
|
|
636
|
+
totalEvaluated?: number;
|
|
637
|
+
/** True when `items` was truncated to the cap. */
|
|
638
|
+
truncated?: boolean;
|
|
639
|
+
}
|
|
640
|
+
/**
|
|
641
|
+
* Terminal (or notable) outcome of an attempt chain, reported post-hoc via
|
|
642
|
+
* `reportAttempt`. Mirrors the backend's `attemptReportSchema.outcome` 1:1.
|
|
643
|
+
*/
|
|
644
|
+
interface AttemptOutcome {
|
|
645
|
+
kind: 'settled' | 'blocked_step_up' | 'failed' | 'high_value_action';
|
|
646
|
+
/** Dotted ACTION-axis token for the failure class, e.g. `commerce.catalog.sku_not_found` (≤128 chars). */
|
|
647
|
+
dimension?: string;
|
|
648
|
+
/** Human-readable detail (≤512 chars). */
|
|
649
|
+
reason?: string;
|
|
650
|
+
/** For `high_value_action`: the non-payment conversion type. */
|
|
651
|
+
actionType?: 'lead' | 'signup' | 'application' | 'enquiry';
|
|
652
|
+
/** Value in MAJOR units (settled amount / estimated action value), non-negative. */
|
|
653
|
+
value?: number;
|
|
654
|
+
/** ISO-4217 or settlement-asset code (3–6 alphanumeric chars). */
|
|
655
|
+
currency?: string;
|
|
656
|
+
/** Settlement rail / mandate type, e.g. `ap2.payment_mandate` (≤64 chars). */
|
|
657
|
+
rail?: string;
|
|
658
|
+
}
|
|
659
|
+
/**
|
|
660
|
+
* Body for `POST /agents/verify-access/attempt-report`:
|
|
661
|
+
* post-hoc consideration/outcome data for an attempt chain that a
|
|
662
|
+
* verify-access call couldn't carry (e.g. the catalog was served from a local
|
|
663
|
+
* cache, or the deny happened transport-side). Must carry `considerationSet`
|
|
664
|
+
* and/or `outcome`.
|
|
665
|
+
*/
|
|
666
|
+
interface AttemptReport {
|
|
667
|
+
/** Attempt-chain handle — `att_` + 32 lowercase hex. */
|
|
668
|
+
attemptId: string;
|
|
669
|
+
/** Merchant/endpoint the attempt targeted; falls back to `config.counterpartyId`. */
|
|
670
|
+
counterpartyId?: string;
|
|
671
|
+
/** Canonical ASTRA-* id of the acting agent, when known. */
|
|
672
|
+
agentId?: string;
|
|
673
|
+
considerationSet?: ConsiderationSet;
|
|
674
|
+
outcome?: AttemptOutcome;
|
|
675
|
+
}
|
|
676
|
+
/**
|
|
677
|
+
* Raw commerce-protocol artifacts as verify-access accepts them (backend
|
|
678
|
+
* `validation.ts` → `commerceArtifacts`). All optional; send what was
|
|
679
|
+
* detected on the wire.
|
|
680
|
+
*/
|
|
681
|
+
interface CommerceArtifactsPayload {
|
|
682
|
+
/** Compact VI SD-JWT. */
|
|
683
|
+
viSdJwt?: string;
|
|
684
|
+
/** AP2 mandate triple as compact SD-JWTs. */
|
|
685
|
+
ap2Mandates?: {
|
|
686
|
+
intent?: string;
|
|
687
|
+
cart?: string;
|
|
688
|
+
payment?: string;
|
|
689
|
+
};
|
|
690
|
+
/** RFC 9421 signed request (Agent Pay / TAP / Web Bot Auth). */
|
|
691
|
+
rfc9421?: {
|
|
692
|
+
headers: Record<string, string | string[]>;
|
|
693
|
+
method: string;
|
|
694
|
+
url: string;
|
|
695
|
+
body?: string;
|
|
696
|
+
tag?: string;
|
|
697
|
+
};
|
|
698
|
+
/** UCP checkout session request. */
|
|
699
|
+
ucpRequest?: {
|
|
700
|
+
method: string;
|
|
701
|
+
url: string;
|
|
702
|
+
body?: unknown;
|
|
703
|
+
};
|
|
704
|
+
/** ACP request (HMAC-signed webhook or checkout body). */
|
|
705
|
+
acpRequest?: {
|
|
706
|
+
method: string;
|
|
707
|
+
url: string;
|
|
708
|
+
headers?: Record<string, string | string[]>;
|
|
709
|
+
body?: unknown;
|
|
710
|
+
rawBody?: string;
|
|
711
|
+
};
|
|
712
|
+
mppRequest?: {
|
|
713
|
+
method: string;
|
|
714
|
+
url: string;
|
|
715
|
+
headers: Record<string, string | string[]>;
|
|
716
|
+
body?: unknown;
|
|
717
|
+
rawBody?: string;
|
|
718
|
+
};
|
|
719
|
+
mppResponse?: {
|
|
720
|
+
status: number;
|
|
721
|
+
headers: Record<string, string | string[]>;
|
|
722
|
+
body?: unknown;
|
|
723
|
+
};
|
|
724
|
+
x402Request?: {
|
|
725
|
+
method?: string;
|
|
726
|
+
url?: string;
|
|
727
|
+
headers?: Record<string, string | string[]>;
|
|
728
|
+
body?: unknown;
|
|
729
|
+
};
|
|
730
|
+
x402Response?: {
|
|
731
|
+
status?: number;
|
|
732
|
+
headers?: Record<string, string | string[]>;
|
|
733
|
+
body?: unknown;
|
|
734
|
+
};
|
|
735
|
+
stripeWebhook?: {
|
|
736
|
+
payload: string;
|
|
737
|
+
signatureHeader: string;
|
|
738
|
+
secret: string;
|
|
739
|
+
};
|
|
740
|
+
}
|
|
741
|
+
/**
|
|
742
|
+
* Token guidance returned from verify-access.
|
|
743
|
+
*
|
|
744
|
+
* `recommendedRateLimit` carries `requestsPerMinute` and `currency` only.
|
|
745
|
+
* `maxTransactionValue` was removed in v2.2.4 — it leaked the agent's
|
|
746
|
+
* spending headroom to the merchant, which is a price-discrimination signal
|
|
747
|
+
* (a merchant could see the agent's autonomous threshold and price the
|
|
748
|
+
* transaction just under it to capture surplus). The agent's SDK receives
|
|
749
|
+
* its own limits separately for client-side budgeting; the merchant's
|
|
750
|
+
* decision doesn't need amount info.
|
|
751
|
+
*/
|
|
752
|
+
interface TokenGuidance {
|
|
753
|
+
recommendedScopes: string[];
|
|
754
|
+
recommendedTtlSeconds: number;
|
|
755
|
+
recommendedRateLimit?: {
|
|
756
|
+
requestsPerMinute: number;
|
|
757
|
+
currency?: string;
|
|
758
|
+
};
|
|
759
|
+
jurisdictionConstraints?: string[];
|
|
760
|
+
delegationAllowed: boolean;
|
|
761
|
+
maxDelegationDepth?: number;
|
|
762
|
+
safetyDefaults: {
|
|
763
|
+
writePrivilegesRequested: boolean;
|
|
764
|
+
shortLivedTokenRecommended: boolean;
|
|
765
|
+
scopeConvention: 'astrasync-canonical';
|
|
766
|
+
};
|
|
767
|
+
}
|
|
768
|
+
|
|
769
|
+
export type { AgentCredentials as A, CommerceArtifactsPayload as C, GatewayConfig as G, TokenGuidance as T, VerificationRequest as V, AttemptReport as a, CounterpartyType as b, VerificationResult as c };
|