@fire-spark/ai 0.0.0-stage → 0.36.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.
@@ -0,0 +1,734 @@
1
+ import { JWTVerifyGetKey } from "jose";
2
+ import { z } from "zod";
3
+ import { ScopeChallengeHandler } from "@modelcontextprotocol/server";
4
+ import "@fire-spark/core";
5
+ //#region src/auth.d.ts
6
+ type VerifyKey = Uint8Array | JWTVerifyGetKey;
7
+ declare const jwksFor: (jwksUrl: string) => JWTVerifyGetKey;
8
+ interface VerifiedAgentToken {
9
+ token: string;
10
+ customerId: string;
11
+ clientId: string;
12
+ scopes: string[];
13
+ expiresAt?: number;
14
+ }
15
+ interface VerifyAgentTokenInput {
16
+ token: string;
17
+ /** Merchant authorization server. Must match the token `iss` (RFC 9207). */
18
+ issuer: string;
19
+ /** This merchant's MCP URL. Must be the token's only `aud`. */
20
+ audience: string;
21
+ merchantId: string;
22
+ key: VerifyKey;
23
+ }
24
+ /**
25
+ * Resource-server check. FireSpark does not issue the token.
26
+ * `aud` is exactly this merchant's MCP URL, `sub` is the customer,
27
+ * and `iss` is that merchant's authorization server.
28
+ */
29
+ declare const verifyAgentAccessToken: (input: VerifyAgentTokenInput) => Promise<VerifiedAgentToken | null>;
30
+ //#endregion
31
+ //#region src/channel.d.ts
32
+ interface AgentMerchantConfig {
33
+ merchantId: string;
34
+ issuer: string;
35
+ jwksUrl: string;
36
+ clientId: string;
37
+ clientSecret: string;
38
+ }
39
+ interface AgentChannel {
40
+ merchantId: string;
41
+ channelId: string;
42
+ }
43
+ type ChannelLookup = {
44
+ ok: true;
45
+ channel: AgentChannel;
46
+ } | {
47
+ ok: false;
48
+ reason: "missing" | "upstream";
49
+ };
50
+ /**
51
+ * Every request: the merchant's integration client must list an ACTIVE
52
+ * AGENT channel whose merchant_id is the route merchant.
53
+ */
54
+ declare const resolveAgentChannel: (input: {
55
+ apiUrl: string;
56
+ merchant: AgentMerchantConfig;
57
+ fetchImpl?: typeof fetch;
58
+ }) => Promise<ChannelLookup>;
59
+ //#endregion
60
+ //#region src/idempotency.d.ts
61
+ /** Client key persisted on the order. The cart handle stays `order_id`. */
62
+ declare const idempotencyKeySchema: z.ZodString;
63
+ //#endregion
64
+ //#region src/money.d.ts
65
+ declare const isDecimalString: (value: string) => boolean;
66
+ /** Exact decimal sum. `0.1 + 0.2` stays `0.3`. */
67
+ declare const sumDecimals: (values: readonly string[]) => string;
68
+ /** True when two decimal strings are the same amount. `10.50` equals `10.5`. */
69
+ declare const decimalsEqual: (left: string, right: string) => boolean;
70
+ /**
71
+ * JSON number for the storefront API. The API schema requires a number;
72
+ * this does not pin a currency scale (`10.125` stays `10.125`).
73
+ */
74
+ declare const decimalToNumber: (value: string) => number;
75
+ /** Number that arrived from JSON, rendered without a fixed scale. */
76
+ declare const numberToDecimal: (value: number) => string;
77
+ /** Tool payloads: money as decimal strings, card data removed. */
78
+ declare const presentMoney: (value: unknown) => unknown;
79
+ //#endregion
80
+ //#region src/mrtr.d.ts
81
+ /**
82
+ * Opaque MRTR `requestState`. The client must echo it unchanged.
83
+ * The seal is HMAC-SHA256 so a later phase can trust the total it confirmed.
84
+ */
85
+ declare const sealRequestState: (payload: Record<string, string>, secret: string) => Promise<string>;
86
+ declare const openRequestState: (state: string, secret: string) => Promise<Record<string, string> | null>;
87
+ /**
88
+ * Asks the customer to confirm a total before anything is sent to pay.
89
+ * `requestState` is the sealed order total the retry must echo.
90
+ */
91
+ declare const confirmTotalRequest: (total: string, currency: string, requestState?: string) => import("@modelcontextprotocol/server").InputRequiredResult;
92
+ declare const confirmedTotal: (responses: Record<string, unknown> | undefined) => boolean;
93
+ /** Decimal the customer accepted. Null when they declined or it is not money. */
94
+ declare const confirmedAmount: (responses: Record<string, unknown> | undefined) => string | null;
95
+ //#endregion
96
+ //#region src/scopes.d.ts
97
+ /** Per-tool scopes. Later phases add write tools here. */
98
+ declare const TOOL_SCOPES: {
99
+ readonly list_stores: "agent:stores:read";
100
+ readonly get_menu: "agent:menus:read";
101
+ readonly get_menu_category: "agent:menus:read";
102
+ readonly search_menu: "agent:menus:read";
103
+ readonly get_product: "agent:menus:read";
104
+ readonly build_cart: "agent:carts:write";
105
+ readonly validate_cart: "agent:carts:validate";
106
+ readonly create_order: "agent:orders:write";
107
+ readonly start_payment: "agent:payments:start";
108
+ readonly get_order_status: "agent:orders:read";
109
+ readonly list_saved_cards: "agent:cards:read";
110
+ readonly charge_saved_card: "agent:cards:charge";
111
+ readonly save_card_consent: "agent:cards:consent";
112
+ readonly revoke_saved_card: "agent:cards:revoke";
113
+ };
114
+ type AgentToolName = keyof typeof TOOL_SCOPES;
115
+ declare const requireToolScope: (scope: string) => ScopeChallengeHandler;
116
+ //#endregion
117
+ //#region src/ui.d.ts
118
+ /** MCP App resources. HTML is served with `text/html;profile=mcp-app`. */
119
+ declare const UI_MENU = "ui://firespark/menu";
120
+ declare const UI_PRODUCT = "ui://firespark/product";
121
+ declare const UI_CART = "ui://firespark/cart";
122
+ interface AgentWidgets {
123
+ menu: string;
124
+ product: string;
125
+ cart: string;
126
+ }
127
+ /** https origin, or a single-label wildcard such as `https://*.cdn.com`. */
128
+ declare const isImageOrigin: (value: string) => boolean;
129
+ //#endregion
130
+ //#region src/runtime.d.ts
131
+ interface StorefrontTokenInput {
132
+ merchantId: string;
133
+ customerId: string;
134
+ subjectToken: string;
135
+ }
136
+ interface AgentRuntime {
137
+ apiUrl: string;
138
+ fetchImpl?: typeof fetch;
139
+ merchant: (merchantId: string) => AgentMerchantConfig | null;
140
+ /** HMAC and AES key for MRTR state and single-use payment links. */
141
+ linkSecret?: string;
142
+ /** Tests inject this. Production exchanges the customer token. */
143
+ storefrontToken?: (input: StorefrontTokenInput) => Promise<string>;
144
+ verifyKey?: (merchant: AgentMerchantConfig) => Promise<VerifyKey> | VerifyKey;
145
+ /** Self-contained MCP App HTML for menu, product and cart. */
146
+ widgets?: AgentWidgets;
147
+ /** https origins allowed to load merchant images inside the widget. */
148
+ imageDomains?: (merchantId: string) => readonly string[];
149
+ }
150
+ declare const storefrontAccessToken: (runtime: AgentRuntime, input: StorefrontTokenInput) => Promise<string>;
151
+ declare const verificationKey: (runtime: AgentRuntime, merchant: AgentMerchantConfig) => Promise<VerifyKey>;
152
+ //#endregion
153
+ //#region src/handler.d.ts
154
+ declare const agentResourceUrl: (request: Request, merchantId: string) => string;
155
+ declare const agentMetadataPath: (merchantId: string) => string;
156
+ declare const createAgentMcpHandler: (runtime: AgentRuntime) => (request: Request, merchantId: string) => Promise<Response>;
157
+ /**
158
+ * RFC 9728 metadata. CIMD stays on the merchant's authorization server:
159
+ * this route does not offer dynamic client registration.
160
+ */
161
+ declare const agentProtectedResource: (request: Request, merchantId: string, runtime: AgentRuntime) => Response;
162
+ declare const agentMetadataOptions: () => Response;
163
+ //#endregion
164
+ //#region src/tools/schemas.d.ts
165
+ declare const idSchema: z.ZodString;
166
+ declare const decimalSchema: z.ZodString;
167
+ declare const cartLineSchema: z.ZodObject<{
168
+ type: z.ZodEnum<{
169
+ FEE: "FEE";
170
+ PRODUCT: "PRODUCT";
171
+ }>;
172
+ uid: z.ZodUUID;
173
+ id: z.ZodString;
174
+ parent_uid: z.ZodNullable<z.ZodUUID>;
175
+ parent_id: z.ZodNullable<z.ZodString>;
176
+ group_id: z.ZodOptional<z.ZodString>;
177
+ name: z.ZodString;
178
+ quantity: z.ZodNumber;
179
+ tax_rate: z.ZodNullable<z.ZodNumber>;
180
+ discount_rate: z.ZodNumber;
181
+ unit_subtotal: z.ZodString;
182
+ unit_discount: z.ZodString;
183
+ unit_tax_total: z.ZodString;
184
+ unit_total: z.ZodString;
185
+ subtotal: z.ZodString;
186
+ discount_total: z.ZodString;
187
+ tax_total: z.ZodString;
188
+ total: z.ZodString;
189
+ unit_group_subtotal: z.ZodString;
190
+ unit_group_discount: z.ZodString;
191
+ unit_group_tax_total: z.ZodString;
192
+ unit_group_total: z.ZodString;
193
+ group_subtotal: z.ZodString;
194
+ group_discount: z.ZodString;
195
+ group_tax_total: z.ZodString;
196
+ group_total: z.ZodString;
197
+ }, z.core.$strict>;
198
+ declare const totalsSchema: z.ZodObject<{
199
+ currency: z.ZodString;
200
+ subtotal: z.ZodString;
201
+ discount_rate: z.ZodNumber;
202
+ discount_total: z.ZodString;
203
+ tax_rate: z.ZodNumber;
204
+ tax_total: z.ZodString;
205
+ total: z.ZodString;
206
+ }, z.core.$strict>;
207
+ declare const customerSchema: z.ZodObject<{
208
+ display_name: z.ZodString;
209
+ first_name: z.ZodString;
210
+ last_name: z.ZodString;
211
+ email: z.ZodEmail;
212
+ phone: z.ZodString;
213
+ }, z.core.$strict>;
214
+ declare const listStoresSchema: z.ZodObject<{
215
+ latitude: z.ZodOptional<z.ZodNumber>;
216
+ longitude: z.ZodOptional<z.ZodNumber>;
217
+ limit: z.ZodOptional<z.ZodNumber>;
218
+ cursor: z.ZodOptional<z.ZodString>;
219
+ brand_id: z.ZodOptional<z.ZodString>;
220
+ fulfillment_id: z.ZodOptional<z.ZodString>;
221
+ }, z.core.$strict>;
222
+ declare const getMenuSchema: z.ZodObject<{
223
+ store_id: z.ZodOptional<z.ZodString>;
224
+ fulfillment_id: z.ZodOptional<z.ZodString>;
225
+ brand_id: z.ZodOptional<z.ZodString>;
226
+ category_id: z.ZodOptional<z.ZodString>;
227
+ cursor: z.ZodOptional<z.ZodString>;
228
+ limit: z.ZodOptional<z.ZodNumber>;
229
+ locale: z.ZodOptional<z.ZodString>;
230
+ }, z.core.$strict>;
231
+ declare const getMenuCategorySchema: z.ZodObject<{
232
+ handle: z.ZodString;
233
+ category_id: z.ZodString;
234
+ cursor: z.ZodOptional<z.ZodString>;
235
+ limit: z.ZodOptional<z.ZodNumber>;
236
+ }, z.core.$strict>;
237
+ declare const searchMenuSchema: z.ZodObject<{
238
+ query: z.ZodString;
239
+ store_id: z.ZodOptional<z.ZodString>;
240
+ fulfillment_id: z.ZodOptional<z.ZodString>;
241
+ brand_id: z.ZodOptional<z.ZodString>;
242
+ handle: z.ZodOptional<z.ZodString>;
243
+ cursor: z.ZodOptional<z.ZodString>;
244
+ limit: z.ZodOptional<z.ZodNumber>;
245
+ locale: z.ZodOptional<z.ZodString>;
246
+ }, z.core.$strict>;
247
+ declare const getProductSchema: z.ZodObject<{
248
+ product_id: z.ZodString;
249
+ store_id: z.ZodOptional<z.ZodString>;
250
+ fulfillment_id: z.ZodOptional<z.ZodString>;
251
+ brand_id: z.ZodOptional<z.ZodString>;
252
+ handle: z.ZodOptional<z.ZodString>;
253
+ locale: z.ZodOptional<z.ZodString>;
254
+ }, z.core.$strict>;
255
+ declare const buildCartSchema: z.ZodObject<{
256
+ order_id: z.ZodOptional<z.ZodString>;
257
+ store_id: z.ZodString;
258
+ fulfillment_id: z.ZodString;
259
+ brand_id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
260
+ is_anonymous: z.ZodOptional<z.ZodBoolean>;
261
+ customer: z.ZodOptional<z.ZodObject<{
262
+ display_name: z.ZodString;
263
+ first_name: z.ZodString;
264
+ last_name: z.ZodString;
265
+ email: z.ZodEmail;
266
+ phone: z.ZodString;
267
+ }, z.core.$strict>>;
268
+ lines: z.ZodOptional<z.ZodArray<z.ZodObject<{
269
+ type: z.ZodEnum<{
270
+ FEE: "FEE";
271
+ PRODUCT: "PRODUCT";
272
+ }>;
273
+ uid: z.ZodUUID;
274
+ id: z.ZodString;
275
+ parent_uid: z.ZodNullable<z.ZodUUID>;
276
+ parent_id: z.ZodNullable<z.ZodString>;
277
+ group_id: z.ZodOptional<z.ZodString>;
278
+ name: z.ZodString;
279
+ quantity: z.ZodNumber;
280
+ tax_rate: z.ZodNullable<z.ZodNumber>;
281
+ discount_rate: z.ZodNumber;
282
+ unit_subtotal: z.ZodString;
283
+ unit_discount: z.ZodString;
284
+ unit_tax_total: z.ZodString;
285
+ unit_total: z.ZodString;
286
+ subtotal: z.ZodString;
287
+ discount_total: z.ZodString;
288
+ tax_total: z.ZodString;
289
+ total: z.ZodString;
290
+ unit_group_subtotal: z.ZodString;
291
+ unit_group_discount: z.ZodString;
292
+ unit_group_tax_total: z.ZodString;
293
+ unit_group_total: z.ZodString;
294
+ group_subtotal: z.ZodString;
295
+ group_discount: z.ZodString;
296
+ group_tax_total: z.ZodString;
297
+ group_total: z.ZodString;
298
+ }, z.core.$strict>>>;
299
+ totals: z.ZodOptional<z.ZodObject<{
300
+ currency: z.ZodString;
301
+ subtotal: z.ZodString;
302
+ discount_rate: z.ZodNumber;
303
+ discount_total: z.ZodString;
304
+ tax_rate: z.ZodNumber;
305
+ tax_total: z.ZodString;
306
+ total: z.ZodString;
307
+ }, z.core.$strict>>;
308
+ idempotency_key: z.ZodString;
309
+ product_id: z.ZodOptional<z.ZodString>;
310
+ quantity: z.ZodOptional<z.ZodNumber>;
311
+ modifiers: z.ZodOptional<z.ZodArray<z.ZodObject<{
312
+ group_id: z.ZodString;
313
+ product_id: z.ZodString;
314
+ quantity: z.ZodNumber;
315
+ }, z.core.$strict>>>;
316
+ return_url: z.ZodOptional<z.ZodURL>;
317
+ locale: z.ZodOptional<z.ZodString>;
318
+ }, z.core.$strict>;
319
+ declare const validateCartSchema: z.ZodObject<{
320
+ store_id: z.ZodString;
321
+ fulfillment_id: z.ZodString;
322
+ brand_id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
323
+ is_anonymous: z.ZodOptional<z.ZodBoolean>;
324
+ lines: z.ZodArray<z.ZodObject<{
325
+ type: z.ZodEnum<{
326
+ FEE: "FEE";
327
+ PRODUCT: "PRODUCT";
328
+ }>;
329
+ uid: z.ZodUUID;
330
+ id: z.ZodString;
331
+ parent_uid: z.ZodNullable<z.ZodUUID>;
332
+ parent_id: z.ZodNullable<z.ZodString>;
333
+ group_id: z.ZodOptional<z.ZodString>;
334
+ name: z.ZodString;
335
+ quantity: z.ZodNumber;
336
+ tax_rate: z.ZodNullable<z.ZodNumber>;
337
+ discount_rate: z.ZodNumber;
338
+ unit_subtotal: z.ZodString;
339
+ unit_discount: z.ZodString;
340
+ unit_tax_total: z.ZodString;
341
+ unit_total: z.ZodString;
342
+ subtotal: z.ZodString;
343
+ discount_total: z.ZodString;
344
+ tax_total: z.ZodString;
345
+ total: z.ZodString;
346
+ unit_group_subtotal: z.ZodString;
347
+ unit_group_discount: z.ZodString;
348
+ unit_group_tax_total: z.ZodString;
349
+ unit_group_total: z.ZodString;
350
+ group_subtotal: z.ZodString;
351
+ group_discount: z.ZodString;
352
+ group_tax_total: z.ZodString;
353
+ group_total: z.ZodString;
354
+ }, z.core.$strict>>;
355
+ totals: z.ZodObject<{
356
+ currency: z.ZodString;
357
+ subtotal: z.ZodString;
358
+ discount_rate: z.ZodNumber;
359
+ discount_total: z.ZodString;
360
+ tax_rate: z.ZodNumber;
361
+ tax_total: z.ZodString;
362
+ total: z.ZodString;
363
+ }, z.core.$strict>;
364
+ }, z.core.$strict>;
365
+ declare const orderStatusSchema: z.ZodObject<{
366
+ order_id: z.ZodString;
367
+ }, z.core.$strict>;
368
+ /** Amounts for a new order. Currency is never accepted from the cart. */
369
+ declare const orderAmountSchema: z.ZodObject<{
370
+ subtotal: z.ZodString;
371
+ discount_rate: z.ZodNumber;
372
+ discount_total: z.ZodString;
373
+ tax_rate: z.ZodNumber;
374
+ tax_total: z.ZodString;
375
+ total: z.ZodString;
376
+ }, z.core.$strict>;
377
+ declare const createOrderSchema: z.ZodObject<{
378
+ store_id: z.ZodString;
379
+ fulfillment_id: z.ZodString;
380
+ brand_id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
381
+ is_anonymous: z.ZodOptional<z.ZodBoolean>;
382
+ customer: z.ZodObject<{
383
+ display_name: z.ZodString;
384
+ first_name: z.ZodString;
385
+ last_name: z.ZodString;
386
+ email: z.ZodEmail;
387
+ phone: z.ZodString;
388
+ }, z.core.$strict>;
389
+ lines: z.ZodArray<z.ZodObject<{
390
+ type: z.ZodEnum<{
391
+ FEE: "FEE";
392
+ PRODUCT: "PRODUCT";
393
+ }>;
394
+ uid: z.ZodUUID;
395
+ id: z.ZodString;
396
+ parent_uid: z.ZodNullable<z.ZodUUID>;
397
+ parent_id: z.ZodNullable<z.ZodString>;
398
+ group_id: z.ZodOptional<z.ZodString>;
399
+ name: z.ZodString;
400
+ quantity: z.ZodNumber;
401
+ tax_rate: z.ZodNullable<z.ZodNumber>;
402
+ discount_rate: z.ZodNumber;
403
+ unit_subtotal: z.ZodString;
404
+ unit_discount: z.ZodString;
405
+ unit_tax_total: z.ZodString;
406
+ unit_total: z.ZodString;
407
+ subtotal: z.ZodString;
408
+ discount_total: z.ZodString;
409
+ tax_total: z.ZodString;
410
+ total: z.ZodString;
411
+ unit_group_subtotal: z.ZodString;
412
+ unit_group_discount: z.ZodString;
413
+ unit_group_tax_total: z.ZodString;
414
+ unit_group_total: z.ZodString;
415
+ group_subtotal: z.ZodString;
416
+ group_discount: z.ZodString;
417
+ group_tax_total: z.ZodString;
418
+ group_total: z.ZodString;
419
+ }, z.core.$strict>>;
420
+ totals: z.ZodObject<{
421
+ subtotal: z.ZodString;
422
+ discount_rate: z.ZodNumber;
423
+ discount_total: z.ZodString;
424
+ tax_rate: z.ZodNumber;
425
+ tax_total: z.ZodString;
426
+ total: z.ZodString;
427
+ }, z.core.$strict>;
428
+ idempotency_key: z.ZodString;
429
+ }, z.core.$strict>;
430
+ declare const startPaymentSchema: z.ZodObject<{
431
+ order_id: z.ZodString;
432
+ idempotency_key: z.ZodString;
433
+ return_url: z.ZodURL;
434
+ }, z.core.$strict>;
435
+ declare const listSavedCardsSchema: z.ZodObject<{}, z.core.$strict>;
436
+ declare const chargeSavedCardSchema: z.ZodObject<{
437
+ order_id: z.ZodString;
438
+ card_ref: z.ZodString;
439
+ confirmed_total: z.ZodString;
440
+ idempotency_key: z.ZodString;
441
+ return_url: z.ZodURL;
442
+ }, z.core.$strict>;
443
+ declare const saveCardConsentSchema: z.ZodObject<{
444
+ order_id: z.ZodString;
445
+ idempotency_key: z.ZodString;
446
+ return_url: z.ZodURL;
447
+ }, z.core.$strict>;
448
+ declare const revokeSavedCardSchema: z.ZodObject<{
449
+ card_ref: z.ZodString;
450
+ idempotency_key: z.ZodString;
451
+ }, z.core.$strict>;
452
+ type ListStoresInput = z.infer<typeof listStoresSchema>;
453
+ type GetMenuInput = z.infer<typeof getMenuSchema>;
454
+ type GetMenuCategoryInput = z.infer<typeof getMenuCategorySchema>;
455
+ type SearchMenuInput = z.infer<typeof searchMenuSchema>;
456
+ type GetProductInput = z.infer<typeof getProductSchema>;
457
+ type BuildCartInput = z.infer<typeof buildCartSchema>;
458
+ type ValidateCartInput = z.infer<typeof validateCartSchema>;
459
+ type OrderStatusInput = z.infer<typeof orderStatusSchema>;
460
+ type CreateOrderInput = z.infer<typeof createOrderSchema>;
461
+ type StartPaymentInput = z.infer<typeof startPaymentSchema>;
462
+ type ChargeSavedCardInput = z.infer<typeof chargeSavedCardSchema>;
463
+ type SaveCardConsentInput = z.infer<typeof saveCardConsentSchema>;
464
+ type RevokeSavedCardInput = z.infer<typeof revokeSavedCardSchema>;
465
+ //#endregion
466
+ //#region src/tools/execute.d.ts
467
+ interface AgentCallContext {
468
+ apiUrl: string;
469
+ merchantId: string;
470
+ channelId: string;
471
+ customerId: string;
472
+ storefrontToken: string;
473
+ fetchImpl?: typeof fetch;
474
+ linkSecret?: string;
475
+ origin?: string;
476
+ }
477
+ declare const executeListStores: (args: ListStoresInput, ctx: AgentCallContext) => Promise<{
478
+ content: {
479
+ type: "text";
480
+ text: string;
481
+ }[];
482
+ isError: true;
483
+ } | {
484
+ content: {
485
+ type: "text";
486
+ text: string;
487
+ }[];
488
+ structuredContent: Record<string, unknown>;
489
+ }>;
490
+ declare const executeBuildCart: (args: BuildCartInput, ctx: AgentCallContext) => Promise<{
491
+ content: {
492
+ type: "text";
493
+ text: string;
494
+ }[];
495
+ isError: true;
496
+ } | {
497
+ content: {
498
+ type: "text";
499
+ text: string;
500
+ }[];
501
+ structuredContent: Record<string, unknown>;
502
+ }>;
503
+ declare const executeValidateCart: (args: ValidateCartInput, ctx: AgentCallContext) => Promise<{
504
+ content: {
505
+ type: "text";
506
+ text: string;
507
+ }[];
508
+ isError: true;
509
+ } | {
510
+ content: {
511
+ type: "text";
512
+ text: string;
513
+ }[];
514
+ structuredContent: Record<string, unknown>;
515
+ }>;
516
+ declare const executeOrderStatus: (args: OrderStatusInput, ctx: AgentCallContext) => Promise<{
517
+ content: {
518
+ type: "text";
519
+ text: string;
520
+ }[];
521
+ isError: true;
522
+ } | {
523
+ content: {
524
+ type: "text";
525
+ text: string;
526
+ }[];
527
+ structuredContent: Record<string, unknown>;
528
+ }>;
529
+ //#endregion
530
+ //#region src/tools/menu.run.d.ts
531
+ declare const executeGetMenu: (args: GetMenuInput, ctx: AgentCallContext) => Promise<{
532
+ content: {
533
+ type: "text";
534
+ text: string;
535
+ }[];
536
+ isError: true;
537
+ } | {
538
+ content: {
539
+ type: "text";
540
+ text: string;
541
+ }[];
542
+ structuredContent: Record<string, unknown>;
543
+ }>;
544
+ declare const executeGetMenuCategory: (args: GetMenuCategoryInput, ctx: AgentCallContext) => Promise<{
545
+ content: {
546
+ type: "text";
547
+ text: string;
548
+ }[];
549
+ isError: true;
550
+ } | {
551
+ content: {
552
+ type: "text";
553
+ text: string;
554
+ }[];
555
+ structuredContent: Record<string, unknown>;
556
+ }>;
557
+ declare const executeSearchMenu: (args: SearchMenuInput, ctx: AgentCallContext) => Promise<{
558
+ content: {
559
+ type: "text";
560
+ text: string;
561
+ }[];
562
+ isError: true;
563
+ } | {
564
+ content: {
565
+ type: "text";
566
+ text: string;
567
+ }[];
568
+ structuredContent: Record<string, unknown>;
569
+ }>;
570
+ declare const executeGetProduct: (args: GetProductInput, ctx: AgentCallContext) => Promise<{
571
+ content: {
572
+ type: "text";
573
+ text: string;
574
+ }[];
575
+ isError: true;
576
+ } | {
577
+ content: {
578
+ type: "text";
579
+ text: string;
580
+ }[];
581
+ structuredContent: Record<string, unknown>;
582
+ }>;
583
+ //#endregion
584
+ //#region src/tools/orders.d.ts
585
+ interface CreateOrderRound {
586
+ inputResponses?: Record<string, unknown>;
587
+ requestState?: string;
588
+ }
589
+ declare const executeCreateOrder: (args: CreateOrderInput, ctx: AgentCallContext, round?: CreateOrderRound) => Promise<import("@modelcontextprotocol/server").InputRequiredResult | {
590
+ content: {
591
+ type: "text";
592
+ text: string;
593
+ }[];
594
+ isError: true;
595
+ } | {
596
+ content: {
597
+ type: "text";
598
+ text: string;
599
+ }[];
600
+ structuredContent: Record<string, unknown>;
601
+ }>;
602
+ //#endregion
603
+ //#region src/tools/pay.d.ts
604
+ declare const executeStartPayment: (args: StartPaymentInput, ctx: AgentCallContext, now?: number, options?: {
605
+ saveCard?: boolean;
606
+ }) => Promise<{
607
+ content: {
608
+ type: "text";
609
+ text: string;
610
+ }[];
611
+ isError: true;
612
+ } | {
613
+ content: {
614
+ type: "text";
615
+ text: string;
616
+ }[];
617
+ structuredContent: Record<string, unknown>;
618
+ }>;
619
+ //#endregion
620
+ //#region src/tools/cards.d.ts
621
+ interface CardRound {
622
+ inputResponses?: Record<string, unknown>;
623
+ requestState?: string;
624
+ }
625
+ declare const executeListSavedCards: (_args: Record<string, never>, ctx: AgentCallContext) => Promise<{
626
+ content: {
627
+ type: "text";
628
+ text: string;
629
+ }[];
630
+ isError: true;
631
+ } | {
632
+ content: {
633
+ type: "text";
634
+ text: string;
635
+ }[];
636
+ structuredContent: Record<string, unknown>;
637
+ }>;
638
+ declare const executeChargeSavedCard: (args: ChargeSavedCardInput, ctx: AgentCallContext, round?: CardRound) => Promise<import("@modelcontextprotocol/server").InputRequiredResult | {
639
+ content: {
640
+ type: "text";
641
+ text: string;
642
+ }[];
643
+ isError: true;
644
+ } | {
645
+ content: {
646
+ type: "text";
647
+ text: string;
648
+ }[];
649
+ structuredContent: Record<string, unknown>;
650
+ }>;
651
+ declare const executeSaveCardConsent: (args: SaveCardConsentInput, ctx: AgentCallContext, round?: CardRound) => Promise<import("@modelcontextprotocol/server").InputRequiredResult | {
652
+ content: {
653
+ type: "text";
654
+ text: string;
655
+ }[];
656
+ isError: true;
657
+ } | {
658
+ content: {
659
+ type: "text";
660
+ text: string;
661
+ }[];
662
+ structuredContent: Record<string, unknown>;
663
+ }>;
664
+ declare const executeRevokeSavedCard: (args: RevokeSavedCardInput, ctx: AgentCallContext) => Promise<{
665
+ content: {
666
+ type: "text";
667
+ text: string;
668
+ }[];
669
+ isError: true;
670
+ } | {
671
+ content: {
672
+ type: "text";
673
+ text: string;
674
+ }[];
675
+ structuredContent: Record<string, unknown>;
676
+ }>;
677
+ //#endregion
678
+ //#region src/payments/page.d.ts
679
+ declare const handleAgentPayment: (request: Request, merchantId: string, token: string, runtime: AgentRuntime) => Promise<Response>;
680
+ //#endregion
681
+ //#region src/payments/return.d.ts
682
+ declare const botReturnUrl: (returnUrl: string, status: string) => string;
683
+ declare const handleAgentPaymentReturn: (request: Request, merchantId: string, runtime: AgentRuntime) => Promise<Response>;
684
+ declare const handleAgentTestGateway: (request: Request, merchantId: string, runtime: AgentRuntime) => Promise<Response>;
685
+ //#endregion
686
+ //#region src/payments/buttons.d.ts
687
+ interface AgentCheckout {
688
+ mode: "test" | "hosted";
689
+ operation: string;
690
+ redirectKey: string;
691
+ }
692
+ interface AgentPaymentButton {
693
+ id: string;
694
+ providerId: string;
695
+ providerName: string;
696
+ method: string;
697
+ methodName: string;
698
+ checkout: AgentCheckout | null;
699
+ /** Gateway declared hosted tokenization. The page may offer save-card. */
700
+ saveCard: boolean;
701
+ }
702
+ /** Real gateway methods. Cash, pin pads and redemptions are not buttons. */
703
+ declare const paymentButtons: (payments: unknown) => AgentPaymentButton[];
704
+ //#endregion
705
+ //#region src/payments/link.d.ts
706
+ type AgentLinkPurpose = "pay" | "continue" | "return" | "gateway";
707
+ interface AgentLinkClaims {
708
+ purpose: AgentLinkPurpose;
709
+ merchantId: string;
710
+ channelId: string;
711
+ customerId: string;
712
+ orderId: string;
713
+ returnUrl: string;
714
+ jti: string;
715
+ exp: number;
716
+ storefrontToken: string;
717
+ paymentId?: string;
718
+ tenderId?: string;
719
+ attemptReference?: string;
720
+ mode?: "test" | "hosted";
721
+ /** Customer agreed to save the card at the gateway. */
722
+ saveCard?: boolean;
723
+ }
724
+ type OpenAgentLink = {
725
+ ok: true;
726
+ claims: AgentLinkClaims;
727
+ } | {
728
+ ok: false;
729
+ reason: "expired" | "invalid";
730
+ };
731
+ declare const mintAgentLink: (claims: AgentLinkClaims, secret: string) => Promise<string>;
732
+ declare const openAgentLink: (token: string, secret: string, now?: number) => Promise<OpenAgentLink>;
733
+ //#endregion
734
+ export { type AgentCallContext, type AgentChannel, type AgentMerchantConfig, type AgentRuntime, type AgentToolName, type AgentWidgets, type ChannelLookup, type StorefrontTokenInput, TOOL_SCOPES, UI_CART, UI_MENU, UI_PRODUCT, type VerifiedAgentToken, type VerifyAgentTokenInput, type VerifyKey, agentMetadataOptions, agentMetadataPath, agentProtectedResource, agentResourceUrl, botReturnUrl, buildCartSchema, cartLineSchema, chargeSavedCardSchema, confirmTotalRequest, confirmedAmount, confirmedTotal, createAgentMcpHandler, createOrderSchema, customerSchema, decimalSchema, decimalToNumber, decimalsEqual, executeBuildCart, executeChargeSavedCard, executeCreateOrder, executeGetMenu, executeGetMenuCategory, executeGetProduct, executeListSavedCards, executeListStores, executeOrderStatus, executeRevokeSavedCard, executeSaveCardConsent, executeSearchMenu, executeStartPayment, executeValidateCart, getMenuCategorySchema, getMenuSchema, getProductSchema, handleAgentPayment, handleAgentPaymentReturn, handleAgentTestGateway, idSchema, idempotencyKeySchema, isDecimalString, isImageOrigin, jwksFor, listSavedCardsSchema, listStoresSchema, mintAgentLink, numberToDecimal, openAgentLink, openRequestState, orderAmountSchema, orderStatusSchema, paymentButtons, presentMoney, requireToolScope, resolveAgentChannel, revokeSavedCardSchema, saveCardConsentSchema, sealRequestState, searchMenuSchema, startPaymentSchema, storefrontAccessToken, sumDecimals, totalsSchema, validateCartSchema, verificationKey, verifyAgentAccessToken };