@ampersend_ai/ampersend-sdk 0.0.19 → 0.0.22

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 (153) hide show
  1. package/dist/ampersend/client.d.ts +4 -9
  2. package/dist/ampersend/client.d.ts.map +1 -1
  3. package/dist/ampersend/client.js +25 -21
  4. package/dist/ampersend/client.js.map +1 -1
  5. package/dist/ampersend/curated-agent.d.ts +117 -0
  6. package/dist/ampersend/curated-agent.d.ts.map +1 -0
  7. package/dist/ampersend/curated-agent.js +149 -0
  8. package/dist/ampersend/curated-agent.js.map +1 -0
  9. package/dist/ampersend/env.d.ts +0 -15
  10. package/dist/ampersend/env.d.ts.map +1 -1
  11. package/dist/ampersend/env.js +0 -4
  12. package/dist/ampersend/env.js.map +1 -1
  13. package/dist/ampersend/index.d.ts +2 -0
  14. package/dist/ampersend/index.d.ts.map +1 -1
  15. package/dist/ampersend/index.js +2 -0
  16. package/dist/ampersend/index.js.map +1 -1
  17. package/dist/ampersend/marketplace.d.ts +47 -0
  18. package/dist/ampersend/marketplace.d.ts.map +1 -0
  19. package/dist/ampersend/marketplace.js +91 -0
  20. package/dist/ampersend/marketplace.js.map +1 -0
  21. package/dist/ampersend/treasurer.d.ts +14 -79
  22. package/dist/ampersend/treasurer.d.ts.map +1 -1
  23. package/dist/ampersend/treasurer.js +34 -102
  24. package/dist/ampersend/treasurer.js.map +1 -1
  25. package/dist/ampersend/types.d.ts +346 -336
  26. package/dist/ampersend/types.d.ts.map +1 -1
  27. package/dist/ampersend/types.js +112 -149
  28. package/dist/ampersend/types.js.map +1 -1
  29. package/dist/ampersend/zod-bridge.d.ts +15 -0
  30. package/dist/ampersend/zod-bridge.d.ts.map +1 -0
  31. package/dist/ampersend/zod-bridge.js +29 -0
  32. package/dist/ampersend/zod-bridge.js.map +1 -0
  33. package/dist/cli/ampersend.js +2 -0
  34. package/dist/cli/ampersend.js.map +1 -1
  35. package/dist/cli/commands/config.d.ts.map +1 -1
  36. package/dist/cli/commands/config.js +2 -21
  37. package/dist/cli/commands/config.js.map +1 -1
  38. package/dist/cli/commands/fetch.d.ts.map +1 -1
  39. package/dist/cli/commands/fetch.js +1 -6
  40. package/dist/cli/commands/fetch.js.map +1 -1
  41. package/dist/cli/commands/marketplace.d.ts +19 -0
  42. package/dist/cli/commands/marketplace.d.ts.map +1 -0
  43. package/dist/cli/commands/marketplace.js +117 -0
  44. package/dist/cli/commands/marketplace.js.map +1 -0
  45. package/dist/cli/commands/setup.d.ts.map +1 -1
  46. package/dist/cli/commands/setup.js +6 -1
  47. package/dist/cli/commands/setup.js.map +1 -1
  48. package/dist/cli/config.d.ts +0 -10
  49. package/dist/cli/config.d.ts.map +1 -1
  50. package/dist/cli/config.js +5 -30
  51. package/dist/cli/config.js.map +1 -1
  52. package/dist/index.d.ts +2 -1
  53. package/dist/index.d.ts.map +1 -1
  54. package/dist/index.js +1 -1
  55. package/dist/index.js.map +1 -1
  56. package/dist/mcp/client/client.d.ts +0 -3
  57. package/dist/mcp/client/client.d.ts.map +1 -1
  58. package/dist/mcp/client/client.js +10 -14
  59. package/dist/mcp/client/client.js.map +1 -1
  60. package/dist/mcp/client/factory.d.ts +0 -2
  61. package/dist/mcp/client/factory.d.ts.map +1 -1
  62. package/dist/mcp/client/factory.js +0 -3
  63. package/dist/mcp/client/factory.js.map +1 -1
  64. package/dist/mcp/client/middleware.d.ts +0 -3
  65. package/dist/mcp/client/middleware.d.ts.map +1 -1
  66. package/dist/mcp/client/middleware.js +9 -12
  67. package/dist/mcp/client/middleware.js.map +1 -1
  68. package/dist/mcp/client/protocol.d.ts +81 -85
  69. package/dist/mcp/client/protocol.d.ts.map +1 -1
  70. package/dist/mcp/client/protocol.js +17 -15
  71. package/dist/mcp/client/protocol.js.map +1 -1
  72. package/dist/mcp/client/types.d.ts +6 -19
  73. package/dist/mcp/client/types.d.ts.map +1 -1
  74. package/dist/mcp/proxy/cli.d.ts.map +1 -1
  75. package/dist/mcp/proxy/cli.js +0 -1
  76. package/dist/mcp/proxy/cli.js.map +1 -1
  77. package/dist/mcp/proxy/env.d.ts +0 -9
  78. package/dist/mcp/proxy/env.d.ts.map +1 -1
  79. package/dist/mcp/proxy/env.js +0 -2
  80. package/dist/mcp/proxy/env.js.map +1 -1
  81. package/dist/mcp/proxy/factory.d.ts +0 -2
  82. package/dist/mcp/proxy/factory.d.ts.map +1 -1
  83. package/dist/mcp/proxy/factory.js +0 -3
  84. package/dist/mcp/proxy/factory.js.map +1 -1
  85. package/dist/mcp/server/fastmcp/middleware.d.ts +9 -29
  86. package/dist/mcp/server/fastmcp/middleware.d.ts.map +1 -1
  87. package/dist/mcp/server/fastmcp/middleware.js +10 -42
  88. package/dist/mcp/server/fastmcp/middleware.js.map +1 -1
  89. package/dist/version.d.ts +1 -1
  90. package/dist/version.js +1 -1
  91. package/dist/x402/envelopes.d.ts +62 -0
  92. package/dist/x402/envelopes.d.ts.map +1 -0
  93. package/dist/x402/envelopes.js +73 -0
  94. package/dist/x402/envelopes.js.map +1 -0
  95. package/dist/x402/http/client.d.ts +37 -0
  96. package/dist/x402/http/client.d.ts.map +1 -0
  97. package/dist/x402/http/client.js +159 -0
  98. package/dist/x402/http/client.js.map +1 -0
  99. package/dist/x402/http/factory.d.ts +9 -25
  100. package/dist/x402/http/factory.d.ts.map +1 -1
  101. package/dist/x402/http/factory.js +21 -27
  102. package/dist/x402/http/factory.js.map +1 -1
  103. package/dist/x402/http/index.d.ts +4 -1
  104. package/dist/x402/http/index.d.ts.map +1 -1
  105. package/dist/x402/http/index.js +2 -1
  106. package/dist/x402/http/index.js.map +1 -1
  107. package/dist/x402/index.d.ts +4 -1
  108. package/dist/x402/index.d.ts.map +1 -1
  109. package/dist/x402/index.js +3 -2
  110. package/dist/x402/index.js.map +1 -1
  111. package/dist/x402/treasurer.d.ts +22 -47
  112. package/dist/x402/treasurer.d.ts.map +1 -1
  113. package/dist/x402/treasurers/naive.d.ts +4 -40
  114. package/dist/x402/treasurers/naive.d.ts.map +1 -1
  115. package/dist/x402/treasurers/naive.js +7 -44
  116. package/dist/x402/treasurers/naive.js.map +1 -1
  117. package/dist/x402/wallet.d.ts +7 -32
  118. package/dist/x402/wallet.d.ts.map +1 -1
  119. package/dist/x402/wallet.js +0 -3
  120. package/dist/x402/wallet.js.map +1 -1
  121. package/dist/x402/wallets/account/wallet.d.ts +9 -30
  122. package/dist/x402/wallets/account/wallet.d.ts.map +1 -1
  123. package/dist/x402/wallets/account/wallet.js +30 -37
  124. package/dist/x402/wallets/account/wallet.js.map +1 -1
  125. package/dist/x402/wallets/index.d.ts +0 -1
  126. package/dist/x402/wallets/index.d.ts.map +1 -1
  127. package/dist/x402/wallets/index.js +0 -1
  128. package/dist/x402/wallets/index.js.map +1 -1
  129. package/dist/x402/wallets/smart-account/chain.d.ts +4 -0
  130. package/dist/x402/wallets/smart-account/chain.d.ts.map +1 -0
  131. package/dist/x402/wallets/smart-account/chain.js +12 -0
  132. package/dist/x402/wallets/smart-account/chain.js.map +1 -0
  133. package/dist/x402/wallets/smart-account/cosigned.d.ts +7 -33
  134. package/dist/x402/wallets/smart-account/cosigned.d.ts.map +1 -1
  135. package/dist/x402/wallets/smart-account/cosigned.js +28 -51
  136. package/dist/x402/wallets/smart-account/cosigned.js.map +1 -1
  137. package/dist/x402/wallets/smart-account/exact.d.ts +6 -20
  138. package/dist/x402/wallets/smart-account/exact.d.ts.map +1 -1
  139. package/dist/x402/wallets/smart-account/exact.js +33 -43
  140. package/dist/x402/wallets/smart-account/exact.js.map +1 -1
  141. package/dist/x402/wallets/smart-account/wallet.d.ts +6 -39
  142. package/dist/x402/wallets/smart-account/wallet.d.ts.map +1 -1
  143. package/dist/x402/wallets/smart-account/wallet.js +9 -36
  144. package/dist/x402/wallets/smart-account/wallet.js.map +1 -1
  145. package/package.json +4 -4
  146. package/dist/x402/http/adapter.d.ts +0 -38
  147. package/dist/x402/http/adapter.d.ts.map +0 -1
  148. package/dist/x402/http/adapter.js +0 -193
  149. package/dist/x402/http/adapter.js.map +0 -1
  150. package/dist/x402/http/v2-adapter.d.ts +0 -56
  151. package/dist/x402/http/v2-adapter.d.ts.map +0 -1
  152. package/dist/x402/http/v2-adapter.js +0 -94
  153. package/dist/x402/http/v2-adapter.js.map +0 -1
@@ -7,6 +7,16 @@ export declare const TxHash: Schema.filter<typeof Schema.NonEmptyTrimmedString>;
7
7
  export type TxHash = typeof TxHash.Type;
8
8
  export declare const Caip2ID: Schema.filter<typeof Schema.NonEmptyTrimmedString>;
9
9
  export type Caip2ID = typeof Caip2ID.Type;
10
+ export declare const Hex32Bytes: Schema.filter<typeof Schema.NonEmptyTrimmedString>;
11
+ export type Hex32Bytes = typeof Hex32Bytes.Type;
12
+ export declare const Hex65Bytes: Schema.filter<typeof Schema.NonEmptyTrimmedString>;
13
+ export type Hex65Bytes = typeof Hex65Bytes.Type;
14
+ export declare const NonNegativeIntegerString: Schema.filter<typeof Schema.NonEmptyTrimmedString>;
15
+ export type NonNegativeIntegerString = typeof NonNegativeIntegerString.Type;
16
+ export declare const ID: Schema.brand<typeof Schema.UUID, "ID">;
17
+ export type ID = typeof ID.Type;
18
+ export declare const ConvertedTimestamp: Schema.Union<[Schema.refine<number, typeof Schema.NonNegative>, Schema.filter<Schema.filter<typeof Schema.NumberFromString>>]>;
19
+ export type ConvertedTimestamp = typeof ConvertedTimestamp.Type;
10
20
  declare const SIWENonceResponse_base: Schema.Class<SIWENonceResponse, {
11
21
  nonce: Schema.refine<string, typeof Schema.Trimmed>;
12
22
  sessionId: Schema.refine<string, typeof Schema.Trimmed>;
@@ -58,67 +68,20 @@ declare const SIWELoginResponse_base: Schema.Class<SIWELoginResponse, {
58
68
  }, {}, {}>;
59
69
  export declare class SIWELoginResponse extends SIWELoginResponse_base {
60
70
  }
61
- declare const PaymentRequirements_base: Schema.Class<PaymentRequirements, {
62
- scheme: Schema.Literal<["exact"]>;
63
- network: Schema.refine<string, typeof Schema.Trimmed>;
64
- maxAmountRequired: Schema.refine<string, typeof Schema.Trimmed>;
65
- resource: Schema.refine<string, typeof Schema.Trimmed>;
66
- description: Schema.refine<string, typeof Schema.Trimmed>;
67
- mimeType: Schema.SchemaClass<string, string, never>;
68
- payTo: Schema.refine<string, typeof Schema.NonEmptyTrimmedString>;
69
- maxTimeoutSeconds: Schema.SchemaClass<number, number, never>;
70
- asset: Schema.refine<string, typeof Schema.NonEmptyTrimmedString>;
71
- extra: Schema.optional<Schema.Record$<typeof Schema.String, typeof Schema.Unknown>>;
72
- }, Schema.Struct.Encoded<{
73
- scheme: Schema.Literal<["exact"]>;
74
- network: Schema.refine<string, typeof Schema.Trimmed>;
75
- maxAmountRequired: Schema.refine<string, typeof Schema.Trimmed>;
76
- resource: Schema.refine<string, typeof Schema.Trimmed>;
77
- description: Schema.refine<string, typeof Schema.Trimmed>;
78
- mimeType: Schema.SchemaClass<string, string, never>;
79
- payTo: Schema.refine<string, typeof Schema.NonEmptyTrimmedString>;
80
- maxTimeoutSeconds: Schema.SchemaClass<number, number, never>;
81
- asset: Schema.refine<string, typeof Schema.NonEmptyTrimmedString>;
82
- extra: Schema.optional<Schema.Record$<typeof Schema.String, typeof Schema.Unknown>>;
83
- }>, never, {
84
- readonly description: string;
85
- } & {
86
- readonly scheme: "exact";
87
- } & {
88
- readonly network: string;
89
- } & {
90
- readonly maxAmountRequired: string;
91
- } & {
92
- readonly resource: string;
93
- } & {
94
- readonly mimeType: string;
95
- } & {
96
- readonly payTo: string;
97
- } & {
98
- readonly maxTimeoutSeconds: number;
99
- } & {
100
- readonly asset: string;
101
- } & {
102
- readonly extra?: {
103
- readonly [x: string]: unknown;
104
- } | undefined;
105
- }, {}, {}>;
106
- export declare class PaymentRequirements extends PaymentRequirements_base {
107
- }
108
71
  declare const ERC3009AuthorizationData_base: Schema.Class<ERC3009AuthorizationData, {
109
72
  from: Schema.refine<string, typeof Schema.NonEmptyTrimmedString>;
110
73
  to: Schema.refine<string, typeof Schema.NonEmptyTrimmedString>;
111
- value: Schema.SchemaClass<string, string, never>;
112
- validAfter: Schema.SchemaClass<string, string, never>;
113
- validBefore: Schema.SchemaClass<string, string, never>;
114
- nonce: Schema.SchemaClass<string, string, never>;
74
+ value: Schema.refine<string, typeof Schema.NonEmptyTrimmedString>;
75
+ validAfter: Schema.refine<string, typeof Schema.NonEmptyTrimmedString>;
76
+ validBefore: Schema.refine<string, typeof Schema.NonEmptyTrimmedString>;
77
+ nonce: Schema.refine<string, typeof Schema.NonEmptyTrimmedString>;
115
78
  }, Schema.Struct.Encoded<{
116
79
  from: Schema.refine<string, typeof Schema.NonEmptyTrimmedString>;
117
80
  to: Schema.refine<string, typeof Schema.NonEmptyTrimmedString>;
118
- value: Schema.SchemaClass<string, string, never>;
119
- validAfter: Schema.SchemaClass<string, string, never>;
120
- validBefore: Schema.SchemaClass<string, string, never>;
121
- nonce: Schema.SchemaClass<string, string, never>;
81
+ value: Schema.refine<string, typeof Schema.NonEmptyTrimmedString>;
82
+ validAfter: Schema.refine<string, typeof Schema.NonEmptyTrimmedString>;
83
+ validBefore: Schema.refine<string, typeof Schema.NonEmptyTrimmedString>;
84
+ nonce: Schema.refine<string, typeof Schema.NonEmptyTrimmedString>;
122
85
  }>, never, {
123
86
  readonly nonce: string;
124
87
  } & {
@@ -143,7 +106,7 @@ declare const ServerAuthorizationData_base: Schema.Class<ServerAuthorizationData
143
106
  readonly validAfter: string;
144
107
  readonly validBefore: string;
145
108
  }, never>;
146
- serverSignature: Schema.SchemaClass<string, string, never>;
109
+ serverSignature: Schema.refine<string, typeof Schema.NonEmptyTrimmedString>;
147
110
  }, Schema.Struct.Encoded<{
148
111
  authorizationData: Schema.SchemaClass<ERC3009AuthorizationData, {
149
112
  readonly nonce: string;
@@ -153,7 +116,7 @@ declare const ServerAuthorizationData_base: Schema.Class<ServerAuthorizationData
153
116
  readonly validAfter: string;
154
117
  readonly validBefore: string;
155
118
  }, never>;
156
- serverSignature: Schema.SchemaClass<string, string, never>;
119
+ serverSignature: Schema.refine<string, typeof Schema.NonEmptyTrimmedString>;
157
120
  }>, never, {
158
121
  readonly authorizationData: ERC3009AuthorizationData;
159
122
  } & {
@@ -161,115 +124,284 @@ declare const ServerAuthorizationData_base: Schema.Class<ServerAuthorizationData
161
124
  }, {}, {}>;
162
125
  export declare class ServerAuthorizationData extends ServerAuthorizationData_base {
163
126
  }
164
- declare const AgentPaymentAuthRequest_base: Schema.Class<AgentPaymentAuthRequest, {
165
- requirements: Schema.NonEmptyArray<typeof PaymentRequirements>;
127
+ /** Dispatch tag on wire envelopes. Distinct from any individual protocol's internal version. */
128
+ export declare const Protocol: Schema.Literal<["x402-v1", "x402-v2"]>;
129
+ export type Protocol = typeof Protocol.Type;
130
+ /** Wire envelope for a {@link PaymentRequest}; `data` validated via `@x402/core/schemas` on decode. */
131
+ export declare const PaymentRequestEnvelope: Schema.Union<[Schema.Struct<{
132
+ protocol: Schema.Literal<["x402-v1"]>;
133
+ data: Schema.Schema<{
134
+ x402Version: 1;
135
+ accepts: {
136
+ description: string;
137
+ scheme: string;
138
+ network: string;
139
+ maxAmountRequired: string;
140
+ resource: string;
141
+ payTo: string;
142
+ maxTimeoutSeconds: number;
143
+ asset: string;
144
+ mimeType?: string | undefined;
145
+ outputSchema?: Record<string, unknown> | null | undefined;
146
+ extra?: Record<string, unknown> | null | undefined;
147
+ }[];
148
+ error?: string | undefined;
149
+ }, {
150
+ x402Version: 1;
151
+ accepts: {
152
+ description: string;
153
+ scheme: string;
154
+ network: string;
155
+ maxAmountRequired: string;
156
+ resource: string;
157
+ payTo: string;
158
+ maxTimeoutSeconds: number;
159
+ asset: string;
160
+ mimeType?: string | undefined;
161
+ outputSchema?: Record<string, unknown> | null | undefined;
162
+ extra?: Record<string, unknown> | null | undefined;
163
+ }[];
164
+ error?: string | undefined;
165
+ }, never>;
166
+ }>, Schema.Struct<{
167
+ protocol: Schema.Literal<["x402-v2"]>;
168
+ data: Schema.Schema<{
169
+ resource: {
170
+ url: string;
171
+ description?: string | undefined;
172
+ mimeType?: string | undefined;
173
+ };
174
+ x402Version: 2;
175
+ accepts: {
176
+ scheme: string;
177
+ network: string;
178
+ payTo: string;
179
+ maxTimeoutSeconds: number;
180
+ asset: string;
181
+ amount: string;
182
+ extra?: Record<string, unknown> | null | undefined;
183
+ }[];
184
+ error?: string | undefined;
185
+ extensions?: Record<string, unknown> | null | undefined;
186
+ }, {
187
+ resource: {
188
+ url: string;
189
+ description?: string | undefined;
190
+ mimeType?: string | undefined;
191
+ };
192
+ x402Version: 2;
193
+ accepts: {
194
+ scheme: string;
195
+ network: string;
196
+ payTo: string;
197
+ maxTimeoutSeconds: number;
198
+ asset: string;
199
+ amount: string;
200
+ extra?: Record<string, unknown> | null | undefined;
201
+ }[];
202
+ error?: string | undefined;
203
+ extensions?: Record<string, unknown> | null | undefined;
204
+ }, never>;
205
+ }>]>;
206
+ export type PaymentRequestEnvelope = typeof PaymentRequestEnvelope.Type;
207
+ /** Wire envelope for a signed {@link PaymentAuthorization}. */
208
+ export declare const PaymentAuthorizationEnvelope: Schema.Union<[Schema.Struct<{
209
+ protocol: Schema.Literal<["x402-v1"]>;
210
+ data: Schema.Schema<{
211
+ scheme: string;
212
+ network: string;
213
+ x402Version: 1;
214
+ payload: Record<string, unknown>;
215
+ }, {
216
+ scheme: string;
217
+ network: string;
218
+ x402Version: 1;
219
+ payload: Record<string, unknown>;
220
+ }, never>;
221
+ }>, Schema.Struct<{
222
+ protocol: Schema.Literal<["x402-v2"]>;
223
+ data: Schema.Schema<{
224
+ x402Version: 2;
225
+ payload: Record<string, unknown>;
226
+ accepted: {
227
+ scheme: string;
228
+ network: string;
229
+ payTo: string;
230
+ maxTimeoutSeconds: number;
231
+ asset: string;
232
+ amount: string;
233
+ extra?: Record<string, unknown> | null | undefined;
234
+ };
235
+ resource?: {
236
+ url: string;
237
+ description?: string | undefined;
238
+ mimeType?: string | undefined;
239
+ } | undefined;
240
+ extensions?: Record<string, unknown> | null | undefined;
241
+ }, {
242
+ x402Version: 2;
243
+ payload: Record<string, unknown>;
244
+ accepted: {
245
+ scheme: string;
246
+ network: string;
247
+ payTo: string;
248
+ maxTimeoutSeconds: number;
249
+ asset: string;
250
+ amount: string;
251
+ extra?: Record<string, unknown> | null | undefined;
252
+ };
253
+ resource?: {
254
+ url: string;
255
+ description?: string | undefined;
256
+ mimeType?: string | undefined;
257
+ } | undefined;
258
+ extensions?: Record<string, unknown> | null | undefined;
259
+ }, never>;
260
+ }>]>;
261
+ export type PaymentAuthorizationEnvelope = typeof PaymentAuthorizationEnvelope.Type;
262
+ /** Request body for `POST /api/v1/agents/:agent/payment/authorize`. */
263
+ export declare const AgentAuthorizeRequest: Schema.Struct<{
264
+ paymentRequest: Schema.Union<[Schema.Struct<{
265
+ protocol: Schema.Literal<["x402-v1"]>;
266
+ data: Schema.Schema<{
267
+ x402Version: 1;
268
+ accepts: {
269
+ description: string;
270
+ scheme: string;
271
+ network: string;
272
+ maxAmountRequired: string;
273
+ resource: string;
274
+ payTo: string;
275
+ maxTimeoutSeconds: number;
276
+ asset: string;
277
+ mimeType?: string | undefined;
278
+ outputSchema?: Record<string, unknown> | null | undefined;
279
+ extra?: Record<string, unknown> | null | undefined;
280
+ }[];
281
+ error?: string | undefined;
282
+ }, {
283
+ x402Version: 1;
284
+ accepts: {
285
+ description: string;
286
+ scheme: string;
287
+ network: string;
288
+ maxAmountRequired: string;
289
+ resource: string;
290
+ payTo: string;
291
+ maxTimeoutSeconds: number;
292
+ asset: string;
293
+ mimeType?: string | undefined;
294
+ outputSchema?: Record<string, unknown> | null | undefined;
295
+ extra?: Record<string, unknown> | null | undefined;
296
+ }[];
297
+ error?: string | undefined;
298
+ }, never>;
299
+ }>, Schema.Struct<{
300
+ protocol: Schema.Literal<["x402-v2"]>;
301
+ data: Schema.Schema<{
302
+ resource: {
303
+ url: string;
304
+ description?: string | undefined;
305
+ mimeType?: string | undefined;
306
+ };
307
+ x402Version: 2;
308
+ accepts: {
309
+ scheme: string;
310
+ network: string;
311
+ payTo: string;
312
+ maxTimeoutSeconds: number;
313
+ asset: string;
314
+ amount: string;
315
+ extra?: Record<string, unknown> | null | undefined;
316
+ }[];
317
+ error?: string | undefined;
318
+ extensions?: Record<string, unknown> | null | undefined;
319
+ }, {
320
+ resource: {
321
+ url: string;
322
+ description?: string | undefined;
323
+ mimeType?: string | undefined;
324
+ };
325
+ x402Version: 2;
326
+ accepts: {
327
+ scheme: string;
328
+ network: string;
329
+ payTo: string;
330
+ maxTimeoutSeconds: number;
331
+ asset: string;
332
+ amount: string;
333
+ extra?: Record<string, unknown> | null | undefined;
334
+ }[];
335
+ error?: string | undefined;
336
+ extensions?: Record<string, unknown> | null | undefined;
337
+ }, never>;
338
+ }>]>;
166
339
  context: Schema.optional<Schema.Struct<{
167
340
  method: Schema.optional<typeof Schema.NonEmptyTrimmedString>;
168
341
  serverUrl: Schema.optional<typeof Schema.NonEmptyTrimmedString>;
169
342
  params: Schema.optional<typeof Schema.Unknown>;
170
343
  }>>;
344
+ }>;
345
+ export type AgentAuthorizeRequest = typeof AgentAuthorizeRequest.Type;
346
+ declare const CoSignature_base: Schema.Class<CoSignature, {
347
+ authorizationData: Schema.SchemaClass<ERC3009AuthorizationData, {
348
+ readonly nonce: string;
349
+ readonly from: string;
350
+ readonly to: string;
351
+ readonly value: string;
352
+ readonly validAfter: string;
353
+ readonly validBefore: string;
354
+ }, never>;
355
+ serverSignature: Schema.refine<string, typeof Schema.NonEmptyTrimmedString>;
171
356
  }, Schema.Struct.Encoded<{
172
- requirements: Schema.NonEmptyArray<typeof PaymentRequirements>;
173
- context: Schema.optional<Schema.Struct<{
174
- method: Schema.optional<typeof Schema.NonEmptyTrimmedString>;
175
- serverUrl: Schema.optional<typeof Schema.NonEmptyTrimmedString>;
176
- params: Schema.optional<typeof Schema.Unknown>;
177
- }>>;
357
+ authorizationData: Schema.SchemaClass<ERC3009AuthorizationData, {
358
+ readonly nonce: string;
359
+ readonly from: string;
360
+ readonly to: string;
361
+ readonly value: string;
362
+ readonly validAfter: string;
363
+ readonly validBefore: string;
364
+ }, never>;
365
+ serverSignature: Schema.refine<string, typeof Schema.NonEmptyTrimmedString>;
178
366
  }>, never, {
179
- readonly requirements: readonly [PaymentRequirements, ...PaymentRequirements[]];
367
+ readonly authorizationData: ERC3009AuthorizationData;
180
368
  } & {
181
- readonly context?: {
182
- readonly method?: string | undefined;
183
- readonly serverUrl?: string | undefined;
184
- readonly params?: unknown;
185
- } | undefined;
369
+ readonly serverSignature: string;
186
370
  }, {}, {}>;
187
- export declare class AgentPaymentAuthRequest extends AgentPaymentAuthRequest_base {
371
+ /**
372
+ * ERC-3009 authorization data + server signature for co-signed agent keys;
373
+ * the agent signs alongside. Scheme-specific today (exact EVM).
374
+ */
375
+ export declare class CoSignature extends CoSignature_base {
188
376
  }
189
- declare const AgentPaymentAuthResponse_base: Schema.Class<AgentPaymentAuthResponse, {
377
+ /**
378
+ * Response body for `POST /api/v1/agents/:agent/payment/authorize`. Returns
379
+ * *indices* into the request's `accepts[]` — the client has the original
380
+ * line-items, so byte-exact echo doesn't require re-serialization.
381
+ *
382
+ * ```
383
+ * {
384
+ * authorized: {
385
+ * selected: { acceptsIndex, limits, coSignature? } | null,
386
+ * alternatives: [{ acceptsIndex, limits }],
387
+ * },
388
+ * rejected: [{ acceptsIndex, reason }],
389
+ * suggested?: { nonce, validBefore },
390
+ * }
391
+ * ```
392
+ */
393
+ export declare const AgentAuthorizeResponse: Schema.Struct<{
190
394
  authorized: Schema.Struct<{
191
- recommended: Schema.NullOr<Schema.refine<number, typeof Schema.NonNegative>>;
192
- requirements: Schema.Array$<Schema.Struct<{
193
- requirement: Schema.SchemaClass<PaymentRequirements, {
194
- readonly description: string;
195
- readonly scheme: "exact";
196
- readonly network: string;
197
- readonly maxAmountRequired: string;
198
- readonly resource: string;
199
- readonly mimeType: string;
200
- readonly payTo: string;
201
- readonly maxTimeoutSeconds: number;
202
- readonly asset: string;
203
- readonly extra?: {
204
- readonly [x: string]: unknown;
205
- } | undefined;
206
- }, never>;
395
+ selected: Schema.NullOr<Schema.Struct<{
396
+ acceptsIndex: Schema.refine<number, typeof Schema.NonNegative>;
207
397
  limits: Schema.Struct<{
208
398
  dailyRemaining: Schema.refine<string, typeof Schema.Trimmed>;
209
399
  monthlyRemaining: Schema.refine<string, typeof Schema.Trimmed>;
210
400
  }>;
401
+ coSignature: Schema.optional<typeof CoSignature>;
211
402
  }>>;
212
- }>;
213
- rejected: Schema.Array$<Schema.Struct<{
214
- requirement: Schema.SchemaClass<PaymentRequirements, {
215
- readonly description: string;
216
- readonly scheme: "exact";
217
- readonly network: string;
218
- readonly maxAmountRequired: string;
219
- readonly resource: string;
220
- readonly mimeType: string;
221
- readonly payTo: string;
222
- readonly maxTimeoutSeconds: number;
223
- readonly asset: string;
224
- readonly extra?: {
225
- readonly [x: string]: unknown;
226
- } | undefined;
227
- }, never>;
228
- reason: Schema.refine<string, typeof Schema.Trimmed>;
229
- }>>;
230
- payment: Schema.optional<Schema.NullOr<Schema.Struct<{
231
- authorizationData: Schema.SchemaClass<ERC3009AuthorizationData, {
232
- readonly nonce: string;
233
- readonly from: string;
234
- readonly to: string;
235
- readonly value: string;
236
- readonly validAfter: string;
237
- readonly validBefore: string;
238
- }, never>;
239
- serverSignature: Schema.SchemaClass<string, string, never>;
240
- requirement: Schema.SchemaClass<PaymentRequirements, {
241
- readonly description: string;
242
- readonly scheme: "exact";
243
- readonly network: string;
244
- readonly maxAmountRequired: string;
245
- readonly resource: string;
246
- readonly mimeType: string;
247
- readonly payTo: string;
248
- readonly maxTimeoutSeconds: number;
249
- readonly asset: string;
250
- readonly extra?: {
251
- readonly [x: string]: unknown;
252
- } | undefined;
253
- }, never>;
254
- }>>>;
255
- }, Schema.Struct.Encoded<{
256
- authorized: Schema.Struct<{
257
- recommended: Schema.NullOr<Schema.refine<number, typeof Schema.NonNegative>>;
258
- requirements: Schema.Array$<Schema.Struct<{
259
- requirement: Schema.SchemaClass<PaymentRequirements, {
260
- readonly description: string;
261
- readonly scheme: "exact";
262
- readonly network: string;
263
- readonly maxAmountRequired: string;
264
- readonly resource: string;
265
- readonly mimeType: string;
266
- readonly payTo: string;
267
- readonly maxTimeoutSeconds: number;
268
- readonly asset: string;
269
- readonly extra?: {
270
- readonly [x: string]: unknown;
271
- } | undefined;
272
- }, never>;
403
+ alternatives: Schema.Array$<Schema.Struct<{
404
+ acceptsIndex: Schema.refine<number, typeof Schema.NonNegative>;
273
405
  limits: Schema.Struct<{
274
406
  dailyRemaining: Schema.refine<string, typeof Schema.Trimmed>;
275
407
  monthlyRemaining: Schema.refine<string, typeof Schema.Trimmed>;
@@ -277,72 +409,15 @@ declare const AgentPaymentAuthResponse_base: Schema.Class<AgentPaymentAuthRespon
277
409
  }>>;
278
410
  }>;
279
411
  rejected: Schema.Array$<Schema.Struct<{
280
- requirement: Schema.SchemaClass<PaymentRequirements, {
281
- readonly description: string;
282
- readonly scheme: "exact";
283
- readonly network: string;
284
- readonly maxAmountRequired: string;
285
- readonly resource: string;
286
- readonly mimeType: string;
287
- readonly payTo: string;
288
- readonly maxTimeoutSeconds: number;
289
- readonly asset: string;
290
- readonly extra?: {
291
- readonly [x: string]: unknown;
292
- } | undefined;
293
- }, never>;
294
- reason: Schema.refine<string, typeof Schema.Trimmed>;
412
+ acceptsIndex: Schema.refine<number, typeof Schema.NonNegative>;
413
+ reason: typeof Schema.NonEmptyTrimmedString;
295
414
  }>>;
296
- payment: Schema.optional<Schema.NullOr<Schema.Struct<{
297
- authorizationData: Schema.SchemaClass<ERC3009AuthorizationData, {
298
- readonly nonce: string;
299
- readonly from: string;
300
- readonly to: string;
301
- readonly value: string;
302
- readonly validAfter: string;
303
- readonly validBefore: string;
304
- }, never>;
305
- serverSignature: Schema.SchemaClass<string, string, never>;
306
- requirement: Schema.SchemaClass<PaymentRequirements, {
307
- readonly description: string;
308
- readonly scheme: "exact";
309
- readonly network: string;
310
- readonly maxAmountRequired: string;
311
- readonly resource: string;
312
- readonly mimeType: string;
313
- readonly payTo: string;
314
- readonly maxTimeoutSeconds: number;
315
- readonly asset: string;
316
- readonly extra?: {
317
- readonly [x: string]: unknown;
318
- } | undefined;
319
- }, never>;
320
- }>>>;
321
- }>, never, {
322
- readonly authorized: {
323
- readonly requirements: readonly {
324
- readonly requirement: PaymentRequirements;
325
- readonly limits: {
326
- readonly dailyRemaining: string;
327
- readonly monthlyRemaining: string;
328
- };
329
- }[];
330
- readonly recommended: number | null;
331
- };
332
- } & {
333
- readonly rejected: readonly {
334
- readonly requirement: PaymentRequirements;
335
- readonly reason: string;
336
- }[];
337
- } & {
338
- readonly payment?: {
339
- readonly authorizationData: ERC3009AuthorizationData;
340
- readonly serverSignature: string;
341
- readonly requirement: PaymentRequirements;
342
- } | null | undefined;
343
- }, {}, {}>;
344
- export declare class AgentPaymentAuthResponse extends AgentPaymentAuthResponse_base {
345
- }
415
+ suggested: Schema.optional<Schema.Struct<{
416
+ nonce: Schema.refine<string, typeof Schema.NonEmptyTrimmedString>;
417
+ validBefore: Schema.refine<string, typeof Schema.NonEmptyTrimmedString>;
418
+ }>>;
419
+ }>;
420
+ export type AgentAuthorizeResponse = typeof AgentAuthorizeResponse.Type;
346
421
  export declare const PaymentEventType: Schema.Union<[Schema.Struct<{
347
422
  type: Schema.Literal<["sending"]>;
348
423
  }>, Schema.Struct<{
@@ -355,110 +430,63 @@ export declare const PaymentEventType: Schema.Union<[Schema.Struct<{
355
430
  reason: Schema.refine<string, typeof Schema.Trimmed>;
356
431
  }>]>;
357
432
  export type PaymentEventType = typeof PaymentEventType.Type;
358
- declare const ExactEvmAuthorization_base: Schema.Class<ExactEvmAuthorization, {
359
- from: Schema.refine<string, typeof Schema.NonEmptyTrimmedString>;
360
- to: Schema.refine<string, typeof Schema.NonEmptyTrimmedString>;
361
- value: Schema.refine<string, typeof Schema.Trimmed>;
362
- validAfter: Schema.refine<string, typeof Schema.Trimmed>;
363
- validBefore: Schema.refine<string, typeof Schema.Trimmed>;
364
- nonce: Schema.refine<string, typeof Schema.Trimmed>;
365
- }, Schema.Struct.Encoded<{
366
- from: Schema.refine<string, typeof Schema.NonEmptyTrimmedString>;
367
- to: Schema.refine<string, typeof Schema.NonEmptyTrimmedString>;
368
- value: Schema.refine<string, typeof Schema.Trimmed>;
369
- validAfter: Schema.refine<string, typeof Schema.Trimmed>;
370
- validBefore: Schema.refine<string, typeof Schema.Trimmed>;
371
- nonce: Schema.refine<string, typeof Schema.Trimmed>;
372
- }>, never, {
373
- readonly nonce: string;
374
- } & {
375
- readonly from: string;
376
- } & {
377
- readonly to: string;
378
- } & {
379
- readonly value: string;
380
- } & {
381
- readonly validAfter: string;
382
- } & {
383
- readonly validBefore: string;
384
- }, {}, {}>;
385
- export declare class ExactEvmAuthorization extends ExactEvmAuthorization_base {
386
- }
387
- declare const ExactEvmPayload_base: Schema.Class<ExactEvmPayload, {
388
- signature: Schema.refine<string, typeof Schema.Trimmed>;
389
- authorization: Schema.SchemaClass<ExactEvmAuthorization, {
390
- readonly nonce: string;
391
- readonly from: string;
392
- readonly to: string;
393
- readonly value: string;
394
- readonly validAfter: string;
395
- readonly validBefore: string;
396
- }, never>;
397
- }, Schema.Struct.Encoded<{
398
- signature: Schema.refine<string, typeof Schema.Trimmed>;
399
- authorization: Schema.SchemaClass<ExactEvmAuthorization, {
400
- readonly nonce: string;
401
- readonly from: string;
402
- readonly to: string;
403
- readonly value: string;
404
- readonly validAfter: string;
405
- readonly validBefore: string;
406
- }, never>;
407
- }>, never, {
408
- readonly signature: string;
409
- } & {
410
- readonly authorization: ExactEvmAuthorization;
411
- }, {}, {}>;
412
- export declare class ExactEvmPayload extends ExactEvmPayload_base {
413
- }
414
- declare const PaymentPayload_base: Schema.Class<PaymentPayload, {
415
- x402Version: Schema.SchemaClass<number, number, never>;
416
- scheme: Schema.refine<string, typeof Schema.Trimmed>;
417
- network: Schema.refine<string, typeof Schema.Trimmed>;
418
- payload: Schema.Union<[typeof ExactEvmPayload, typeof Schema.Unknown]>;
419
- }, Schema.Struct.Encoded<{
420
- x402Version: Schema.SchemaClass<number, number, never>;
421
- scheme: Schema.refine<string, typeof Schema.Trimmed>;
422
- network: Schema.refine<string, typeof Schema.Trimmed>;
423
- payload: Schema.Union<[typeof ExactEvmPayload, typeof Schema.Unknown]>;
424
- }>, never, {
425
- readonly scheme: string;
426
- } & {
427
- readonly network: string;
428
- } & {
429
- readonly x402Version: number;
430
- } & {
431
- readonly payload: unknown;
432
- }, {}, {}>;
433
- export declare class PaymentPayload extends PaymentPayload_base {
434
- }
435
- declare const AgentPaymentEventReport_base: Schema.Class<AgentPaymentEventReport, {
433
+ export type PaymentEvent = PaymentEventType;
434
+ /** Request body for `POST /api/v1/agents/:agent/payment/events`. */
435
+ export declare const AgentPaymentEventReport: Schema.Struct<{
436
436
  id: Schema.refine<string, typeof Schema.Trimmed>;
437
- payment: Schema.SchemaClass<PaymentPayload, {
438
- readonly scheme: string;
439
- readonly network: string;
440
- readonly x402Version: number;
441
- readonly payload: unknown;
442
- }, never>;
443
- event: Schema.Union<[Schema.Struct<{
444
- type: Schema.Literal<["sending"]>;
445
- }>, Schema.Struct<{
446
- type: Schema.Literal<["accepted"]>;
447
- }>, Schema.Struct<{
448
- type: Schema.Literal<["rejected"]>;
449
- reason: Schema.refine<string, typeof Schema.Trimmed>;
437
+ payment: Schema.Union<[Schema.Struct<{
438
+ protocol: Schema.Literal<["x402-v1"]>;
439
+ data: Schema.Schema<{
440
+ scheme: string;
441
+ network: string;
442
+ x402Version: 1;
443
+ payload: Record<string, unknown>;
444
+ }, {
445
+ scheme: string;
446
+ network: string;
447
+ x402Version: 1;
448
+ payload: Record<string, unknown>;
449
+ }, never>;
450
450
  }>, Schema.Struct<{
451
- type: Schema.Literal<["error"]>;
452
- reason: Schema.refine<string, typeof Schema.Trimmed>;
451
+ protocol: Schema.Literal<["x402-v2"]>;
452
+ data: Schema.Schema<{
453
+ x402Version: 2;
454
+ payload: Record<string, unknown>;
455
+ accepted: {
456
+ scheme: string;
457
+ network: string;
458
+ payTo: string;
459
+ maxTimeoutSeconds: number;
460
+ asset: string;
461
+ amount: string;
462
+ extra?: Record<string, unknown> | null | undefined;
463
+ };
464
+ resource?: {
465
+ url: string;
466
+ description?: string | undefined;
467
+ mimeType?: string | undefined;
468
+ } | undefined;
469
+ extensions?: Record<string, unknown> | null | undefined;
470
+ }, {
471
+ x402Version: 2;
472
+ payload: Record<string, unknown>;
473
+ accepted: {
474
+ scheme: string;
475
+ network: string;
476
+ payTo: string;
477
+ maxTimeoutSeconds: number;
478
+ asset: string;
479
+ amount: string;
480
+ extra?: Record<string, unknown> | null | undefined;
481
+ };
482
+ resource?: {
483
+ url: string;
484
+ description?: string | undefined;
485
+ mimeType?: string | undefined;
486
+ } | undefined;
487
+ extensions?: Record<string, unknown> | null | undefined;
488
+ }, never>;
453
489
  }>]>;
454
- }, Schema.Struct.Encoded<{
455
- id: Schema.refine<string, typeof Schema.Trimmed>;
456
- payment: Schema.SchemaClass<PaymentPayload, {
457
- readonly scheme: string;
458
- readonly network: string;
459
- readonly x402Version: number;
460
- readonly payload: unknown;
461
- }, never>;
462
490
  event: Schema.Union<[Schema.Struct<{
463
491
  type: Schema.Literal<["sending"]>;
464
492
  }>, Schema.Struct<{
@@ -470,25 +498,8 @@ declare const AgentPaymentEventReport_base: Schema.Class<AgentPaymentEventReport
470
498
  type: Schema.Literal<["error"]>;
471
499
  reason: Schema.refine<string, typeof Schema.Trimmed>;
472
500
  }>]>;
473
- }>, never, {
474
- readonly payment: PaymentPayload;
475
- } & {
476
- readonly id: string;
477
- } & {
478
- readonly event: {
479
- readonly type: "sending";
480
- } | {
481
- readonly type: "accepted";
482
- } | {
483
- readonly type: "rejected";
484
- readonly reason: string;
485
- } | {
486
- readonly type: "error";
487
- readonly reason: string;
488
- };
489
- }, {}, {}>;
490
- export declare class AgentPaymentEventReport extends AgentPaymentEventReport_base {
491
- }
501
+ }>;
502
+ export type AgentPaymentEventReport = typeof AgentPaymentEventReport.Type;
492
503
  declare const AgentPaymentEventResponse_base: Schema.Class<AgentPaymentEventResponse, {
493
504
  received: Schema.SchemaClass<boolean, boolean, never>;
494
505
  paymentId: Schema.optional<typeof Schema.UUID>;
@@ -517,7 +528,6 @@ export declare class ApiError extends Error {
517
528
  response?: Response | undefined;
518
529
  constructor(message: string, status?: number | undefined, response?: Response | undefined);
519
530
  }
520
- export type PaymentEvent = PaymentEventType;
521
531
  export declare const SpendConfigInput: Schema.Struct<{
522
532
  auto_topup_allowed: Schema.SchemaClass<boolean, boolean, never>;
523
533
  daily_limit: Schema.NullOr<typeof Schema.String>;