@agentcash/router 1.5.0 → 1.5.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/index.d.cts CHANGED
@@ -4,7 +4,6 @@ import { ZodType } from 'zod';
4
4
  import { Store } from 'mppx';
5
5
  import { PaymentRequirements, PaymentRequired, SettleResponse, Network } from '@x402/core/types';
6
6
  import * as viem from 'viem';
7
- export { S as SIWX_ERROR_MESSAGES, a as SiwxErrorCode } from './siwx-BMlja_nt.cjs';
8
7
 
9
8
  interface EntitlementStore {
10
9
  has(route: string, wallet: string): Promise<boolean>;
@@ -128,7 +127,7 @@ interface ErrorEvent {
128
127
  interface AuthEvent {
129
128
  /** Authentication mode that was verified */
130
129
  authMode: 'siwx' | 'apiKey';
131
- /** Verified wallet address (lowercase) */
130
+ /** Verified canonical wallet address (EVM lowercase, non-EVM preserved) */
132
131
  wallet: string | null;
133
132
  /** Route key */
134
133
  route: string;
@@ -271,6 +270,49 @@ interface HandlerPaymentContext {
271
270
  transaction?: string;
272
271
  receipt?: string;
273
272
  }
273
+ interface SettlementLifecycleContext<TBody = unknown> {
274
+ route: string;
275
+ request: NextRequest;
276
+ body: TBody;
277
+ wallet: string;
278
+ account: unknown;
279
+ payment: HandlerPaymentContext;
280
+ response: NextResponse;
281
+ result: unknown;
282
+ }
283
+ interface SettlementSettledContext<TBody = unknown> extends Omit<SettlementLifecycleContext<TBody>, 'payment'> {
284
+ payment: HandlerPaymentContext & {
285
+ status: 'settled';
286
+ };
287
+ }
288
+ interface SettlementErrorContext<TBody = unknown> extends SettlementLifecycleContext<TBody> {
289
+ error: unknown;
290
+ phase: 'settle' | 'afterSettle';
291
+ }
292
+ interface SettledHandlerErrorContext<TBody = unknown> extends SettlementSettledContext<TBody> {
293
+ error: unknown;
294
+ }
295
+ interface SettlementLifecycle<TBody = unknown> {
296
+ /**
297
+ * Runs after the handler returns a successful response, before router-controlled
298
+ * settlement/broadcast. Throw with `.status` to return a specific error and
299
+ * skip settlement when the protocol flow has not already settled.
300
+ */
301
+ beforeSettle?: (ctx: SettlementLifecycleContext<TBody>) => void | Promise<void>;
302
+ /**
303
+ * Runs after successful settlement. Use for durable ledgers and audit rows.
304
+ * Errors are alerted and do not change the already-settled response.
305
+ */
306
+ afterSettle?: (ctx: SettlementSettledContext<TBody>) => void | Promise<void>;
307
+ /**
308
+ * Runs when the router has already observed a settled payment, then the
309
+ * handler returns an error response. Use for app-owned refund or
310
+ * compensation queues.
311
+ */
312
+ onSettledHandlerError?: (ctx: SettledHandlerErrorContext<TBody>) => void | Promise<void>;
313
+ /** Runs when router-controlled settlement fails after the handler succeeded. */
314
+ onSettlementError?: (ctx: SettlementErrorContext<TBody>) => void | Promise<void>;
315
+ }
274
316
  interface HandlerContext<TBody = undefined, TQuery = undefined> {
275
317
  body: TBody;
276
318
  query: TQuery;
@@ -321,22 +363,22 @@ interface RouteEntry {
321
363
  querySchema?: ZodType;
322
364
  outputSchema?: ZodType;
323
365
  /**
324
- * Conforming example for the request input (body for body routes, query params for query routes).
325
- * Required whenever `bodySchema` or `querySchema` is set. Must satisfy the corresponding schema
326
- * validated at route-registration time via the Zod schema.
366
+ * Optional conforming example for the request input (body for body routes, query params for query routes).
367
+ * When present, it must satisfy the corresponding schema and is validated at route registration.
327
368
  *
328
369
  * Emitted in the bazaar discovery extension so indexers can advertise a working sample call.
329
370
  */
330
371
  inputExample?: JsonObject;
331
372
  /**
332
- * Conforming example for the response output. Required whenever `outputSchema` is set.
333
- * Must satisfy `outputSchema` validated at route-registration time via the Zod schema.
373
+ * Optional conforming example for the response output. When present, it must
374
+ * satisfy `outputSchema` and is validated at route registration.
334
375
  *
335
376
  * Accepts any JSON value (object, array, or primitive) to support top-level array or
336
377
  * primitive response schemas.
337
378
  *
338
- * Emitted in the bazaar discovery extension. Without it the `output` block is dropped from
339
- * the declaration entirely (the output schema alone cannot be exposed in bazaar without an example).
379
+ * Emitted in the bazaar discovery extension. Without it the `output` block is
380
+ * dropped from the declaration entirely (the output schema alone cannot be
381
+ * exposed in bazaar without an example).
340
382
  */
341
383
  outputExample?: JsonValue;
342
384
  description?: string;
@@ -349,6 +391,7 @@ interface RouteEntry {
349
391
  providerName?: string;
350
392
  providerConfig?: ProviderConfig;
351
393
  validateFn?: (body: unknown) => void | Promise<void>;
394
+ settlement?: SettlementLifecycle;
352
395
  mppInfo?: MppProtocolInfo;
353
396
  }
354
397
  interface DiscoveryConfig {
@@ -423,7 +466,7 @@ interface RouterConfig {
423
466
  * createRouter({
424
467
  * mpp: {
425
468
  * secretKey: process.env.MPP_SECRET_KEY!,
426
- * currency: USDC,
469
+ * currency: TEMPO_USDC_CURRENCY,
427
470
  * useDefaultStore: true,
428
471
  * }
429
472
  * })
@@ -431,7 +474,7 @@ interface RouterConfig {
431
474
  useDefaultStore?: boolean;
432
475
  };
433
476
  /**
434
- * Payment protocols to accept on auto-priced routes (those using the `prices` config).
477
+ * Payment protocols to accept on paid routes unless a route overrides them.
435
478
  *
436
479
  * @default ['x402']
437
480
  *
@@ -439,7 +482,7 @@ interface RouterConfig {
439
482
  * // Accept both x402 and MPP payments
440
483
  * createRouter({
441
484
  * protocols: ['x402', 'mpp'],
442
- * mpp: { secretKey, currency, recipient },
485
+ * mpp: { secretKey, currency: TEMPO_USDC_CURRENCY, recipient },
443
486
  * prices: { 'exa/search': '0.01' }
444
487
  * })
445
488
  */
@@ -476,7 +519,7 @@ interface ResolvedX402Facilitator {
476
519
  config: X402RouterFacilitatorConfig;
477
520
  }
478
521
 
479
- interface OrchestrateDeps {
522
+ interface RouterDeps {
480
523
  x402Server: X402Server | null;
481
524
  initPromise: Promise<void>;
482
525
  x402InitError?: string;
@@ -485,6 +528,7 @@ interface OrchestrateDeps {
485
528
  nonceStore: NonceStore;
486
529
  entitlementStore: EntitlementStore;
487
530
  payeeAddress: string;
531
+ mppRecipient?: string;
488
532
  network: string;
489
533
  x402FacilitatorsByNetwork?: Record<string, ResolvedX402Facilitator>;
490
534
  x402Accepts: X402AcceptConfig[];
@@ -502,6 +546,9 @@ interface OrchestrateDeps {
502
546
  tempoClient?: viem.Client | null;
503
547
  }
504
548
 
549
+ /** @deprecated alias kept for downstream consumers; use `RouterDeps`. */
550
+ type OrchestrateDeps = RouterDeps;
551
+
505
552
  type True = true;
506
553
  type False = false;
507
554
  /**
@@ -521,16 +568,12 @@ type InputTypeFor<TBody, TQuery> = [TBody] extends [undefined] ? [TQuery] extend
521
568
  * because TypeScript doesn't reliably gate overload selection on `this` for
522
569
  * generic classes (structurally identical instance types collapse).
523
570
  */
524
- type HandlerArg<TBody, TQuery, HasAuth extends boolean, NeedsBody extends boolean, HasBody extends boolean, NeedsInputExample extends boolean, NeedsOutputExample extends boolean> = HasAuth extends true ? [NeedsBody, HasBody] extends [true, false] ? {
571
+ type HandlerArg<TBody, TQuery, HasAuth extends boolean, NeedsBody extends boolean, HasBody extends boolean> = HasAuth extends true ? [NeedsBody, HasBody] extends [true, false] ? {
525
572
  __missing: 'Call .body(schema) — dynamic/tiered pricing requires a body schema to resolve the price against';
526
- } : NeedsInputExample extends true ? {
527
- __missing: 'Call .inputExample(sample) — .body()/.query() routes must advertise a conforming request example for bazaar discovery';
528
- } : NeedsOutputExample extends true ? {
529
- __missing: 'Call .outputExample(sample) — .output() routes must advertise a conforming response example for bazaar discovery';
530
573
  } : (ctx: HandlerContext<TBody, TQuery>) => Promise<unknown> : {
531
574
  __missing: 'Select an auth mode: .paid(pricing), .siwx(), .apiKey(resolver), or .unprotected()';
532
575
  };
533
- declare class RouteBuilder<TBody = undefined, TQuery = undefined, TOutput = undefined, HasAuth extends boolean = false, NeedsBody extends boolean = false, HasBody extends boolean = false, NeedsInputExample extends boolean = false, NeedsOutputExample extends boolean = false> {
576
+ declare class RouteBuilder<TBody = undefined, TQuery = undefined, TOutput = undefined, HasAuth extends boolean = false, NeedsBody extends boolean = false, HasBody extends boolean = false> {
534
577
  /** @internal */ readonly _key: string;
535
578
  /** @internal */ readonly _registry: RouteRegistry;
536
579
  /** @internal */ readonly _deps: OrchestrateDeps;
@@ -540,7 +583,7 @@ declare class RouteBuilder<TBody = undefined, TQuery = undefined, TOutput = unde
540
583
  /** @internal */ _protocols: ProtocolType[];
541
584
  /** @internal */ _maxPrice: string | undefined;
542
585
  /** @internal */ _minPrice: string | undefined;
543
- /** @internal */ _payTo: string | ((request: Request) => string | Promise<string>) | undefined;
586
+ /** @internal */ _payTo: PayToConfig | undefined;
544
587
  /** @internal */ _bodySchema: ZodType | undefined;
545
588
  /** @internal */ _querySchema: ZodType | undefined;
546
589
  /** @internal */ _outputSchema: ZodType | undefined;
@@ -555,13 +598,14 @@ declare class RouteBuilder<TBody = undefined, TQuery = undefined, TOutput = unde
555
598
  /** @internal */ _providerName: string | undefined;
556
599
  /** @internal */ _providerConfig: ProviderConfig | undefined;
557
600
  /** @internal */ _validateFn: ((body: TBody) => void | Promise<void>) | undefined;
601
+ /** @internal */ _settlement: SettlementLifecycle<TBody> | undefined;
558
602
  /** @internal */ _mppInfo: MppProtocolInfo | undefined;
559
603
  constructor(key: string, registry: RouteRegistry, deps: OrchestrateDeps);
560
604
  private fork;
561
- paid(pricing: string, options?: PaidOptions): RouteBuilder<TBody, TQuery, TOutput, True, False, HasBody, NeedsInputExample, NeedsOutputExample>;
605
+ paid(pricing: string, options?: PaidOptions): RouteBuilder<TBody, TQuery, TOutput, True, False, HasBody>;
562
606
  paid<TBodyIn>(pricing: (body: TBodyIn) => string | Promise<string>, options?: PaidOptions & {
563
607
  maxPrice?: string;
564
- }): RouteBuilder<TBody, TQuery, TOutput, True, True, HasBody, NeedsInputExample, NeedsOutputExample>;
608
+ }): RouteBuilder<TBody, TQuery, TOutput, True, True, HasBody>;
565
609
  paid(pricing: {
566
610
  field: string;
567
611
  tiers: Record<string, {
@@ -569,21 +613,26 @@ declare class RouteBuilder<TBody = undefined, TQuery = undefined, TOutput = unde
569
613
  label?: string;
570
614
  }>;
571
615
  default?: string;
572
- }, options?: PaidOptions): RouteBuilder<TBody, TQuery, TOutput, True, True, HasBody, NeedsInputExample, NeedsOutputExample>;
573
- siwx(): RouteBuilder<TBody, TQuery, TOutput, True, False, HasBody, NeedsInputExample, NeedsOutputExample>;
574
- apiKey(resolver: (key: string) => unknown | Promise<unknown>): RouteBuilder<TBody, TQuery, TOutput, True, NeedsBody, HasBody, NeedsInputExample, NeedsOutputExample>;
575
- unprotected(): RouteBuilder<TBody, TQuery, TOutput, True, False, HasBody, NeedsInputExample, NeedsOutputExample>;
616
+ }, options?: PaidOptions): RouteBuilder<TBody, TQuery, TOutput, True, True, HasBody>;
617
+ siwx(): RouteBuilder<TBody, TQuery, TOutput, True, False, HasBody>;
618
+ apiKey(resolver: (key: string) => unknown | Promise<unknown>): RouteBuilder<TBody, TQuery, TOutput, True, NeedsBody, HasBody>;
619
+ unprotected(): RouteBuilder<TBody, TQuery, TOutput, True, False, HasBody>;
576
620
  provider(name: string, config?: ProviderConfig): this;
577
- body<T>(schema: ZodType<T>): RouteBuilder<T, TQuery, TOutput, HasAuth, NeedsBody, True, True, NeedsOutputExample>;
578
- query<T>(schema: ZodType<T>): RouteBuilder<TBody, T, TOutput, HasAuth, NeedsBody, HasBody, True, NeedsOutputExample>;
579
- output<T>(schema: ZodType<T>): RouteBuilder<TBody, TQuery, T, HasAuth, NeedsBody, HasBody, NeedsInputExample, True>;
621
+ body<T>(schema: ZodType<T>): RouteBuilder<T, TQuery, TOutput, HasAuth, NeedsBody, True>;
622
+ body<T>(schema: ZodType<T>, example: T & JsonObject): RouteBuilder<T, TQuery, TOutput, HasAuth, NeedsBody, True>;
623
+ query<T>(schema: ZodType<T>): RouteBuilder<TBody, T, TOutput, HasAuth, NeedsBody, HasBody>;
624
+ query<T>(schema: ZodType<T>, example: T & JsonObject): RouteBuilder<TBody, T, TOutput, HasAuth, NeedsBody, HasBody>;
625
+ output<T>(schema: ZodType<T>): RouteBuilder<TBody, TQuery, T, HasAuth, NeedsBody, HasBody>;
626
+ output<T>(schema: ZodType<T>, example: T & JsonValue): RouteBuilder<TBody, TQuery, T, HasAuth, NeedsBody, HasBody>;
580
627
  /**
581
628
  * Provide a conforming example of the request input (body or query params).
582
629
  *
583
- * **Required** whenever `.body()` or `.query()` is set enforced at compile time via
584
- * `.handler()` overloads, and at route-registration time via Zod validation of the
585
- * example against the schema. The example is embedded in the bazaar discovery extension
586
- * so indexers can advertise a working sample call.
630
+ * Optional. When provided, the example is validated against the request schema
631
+ * at route registration and embedded in the bazaar discovery extension so
632
+ * indexers can advertise a working sample call.
633
+ *
634
+ * For the common case, pass the example directly to `.body(schema, example)` or
635
+ * `.query(schema, example)` instead.
587
636
  *
588
637
  * @example
589
638
  * ```ts
@@ -594,14 +643,15 @@ declare class RouteBuilder<TBody = undefined, TQuery = undefined, TOutput = unde
594
643
  * .handler(async ({ body }) => { ... });
595
644
  * ```
596
645
  */
597
- inputExample(example: InputTypeFor<TBody, TQuery> & JsonObject): RouteBuilder<TBody, TQuery, TOutput, HasAuth, NeedsBody, HasBody, False, NeedsOutputExample>;
646
+ inputExample(example: InputTypeFor<TBody, TQuery> & JsonObject): RouteBuilder<TBody, TQuery, TOutput, HasAuth, NeedsBody, HasBody>;
598
647
  /**
599
648
  * Provide a conforming example of the response output.
600
649
  *
601
- * **Required** whenever `.output()` is set enforced at compile time via `.handler()`
602
- * overloads, and at route-registration time via Zod validation of the example against
603
- * the schema. The example is embedded in the bazaar discovery extension so indexers
604
- * can advertise the response shape.
650
+ * Optional. When provided, the example is validated against the output schema
651
+ * at route registration and embedded in the bazaar discovery extension so
652
+ * indexers can advertise the response shape.
653
+ *
654
+ * For the common case, pass the example directly to `.output(schema, example)` instead.
605
655
  *
606
656
  * Accepts any JSON value (objects, arrays, or primitives) — top-level array
607
657
  * or primitive responses (e.g. `z.array(...)`) are supported alongside the
@@ -623,7 +673,7 @@ declare class RouteBuilder<TBody = undefined, TQuery = undefined, TOutput = unde
623
673
  * .handler(async () => { ... });
624
674
  * ```
625
675
  */
626
- outputExample(example: TOutput & JsonValue): RouteBuilder<TBody, TQuery, TOutput, HasAuth, NeedsBody, HasBody, NeedsInputExample, False>;
676
+ outputExample(example: TOutput & JsonValue): RouteBuilder<TBody, TQuery, TOutput, HasAuth, NeedsBody, HasBody>;
627
677
  description(text: string): this;
628
678
  path(p: string): this;
629
679
  method(m: 'GET' | 'POST' | 'DELETE' | 'PUT' | 'PATCH'): this;
@@ -648,8 +698,17 @@ declare class RouteBuilder<TBody = undefined, TQuery = undefined, TOutput = unde
648
698
  * .handler(async ({ body }) => { ... });
649
699
  * ```
650
700
  */
651
- validate(fn: (body: TBody) => void | Promise<void>): RouteBuilder<TBody, TQuery, TOutput, HasAuth, NeedsBody, HasBody, NeedsInputExample, NeedsOutputExample>;
652
- handler(fn: HandlerArg<TBody, TQuery, HasAuth, NeedsBody, HasBody, NeedsInputExample, NeedsOutputExample>): (request: NextRequest) => Promise<Response>;
701
+ validate(fn: (body: TBody) => void | Promise<void>): RouteBuilder<TBody, TQuery, TOutput, HasAuth, NeedsBody, HasBody>;
702
+ /**
703
+ * Add route-specific settlement hooks.
704
+ *
705
+ * `beforeSettle` runs after a successful handler response but before
706
+ * router-controlled settlement/broadcast, so it can still prevent the charge
707
+ * for x402 and MPP transaction-payload flows. `afterSettle` runs after
708
+ * settlement and is intended for durable ledgers or app-owned refund queues.
709
+ */
710
+ settlement(lifecycle: SettlementLifecycle<TBody>): RouteBuilder<TBody, TQuery, TOutput, HasAuth, NeedsBody, HasBody>;
711
+ handler(fn: HandlerArg<TBody, TQuery, HasAuth, NeedsBody, HasBody>): (request: NextRequest) => Promise<Response>;
653
712
  }
654
713
 
655
714
  declare const BASE_NETWORK = "eip155:8453";
@@ -658,7 +717,7 @@ declare const TEMPO_USDC_CURRENCY = "0x20c000000000000000000000b9537d11c60e8b50"
658
717
  declare const ZERO_EVM_ADDRESS = "0x0000000000000000000000000000000000000000";
659
718
 
660
719
  type RouterEnv = Record<string, string | undefined>;
661
- type RouterConfigIssueCode = 'missing_base_url' | 'empty_protocols' | 'missing_x402_accepts' | 'missing_x402_network' | 'unsupported_x402_network' | 'missing_x402_asset' | 'invalid_x402_decimals' | 'missing_x402_payee' | 'missing_cdp_keys' | 'placeholder_payee' | 'missing_mpp_config' | 'missing_mpp_secret_key' | 'missing_mpp_currency' | 'missing_mpp_recipient' | 'missing_mpp_rpc_url' | 'missing_mpp_default_store_env';
720
+ type RouterConfigIssueCode = 'missing_base_url' | 'empty_protocols' | 'missing_x402_accepts' | 'missing_x402_network' | 'unsupported_x402_network' | 'missing_x402_asset' | 'invalid_x402_decimals' | 'missing_x402_payee' | 'missing_cdp_keys' | 'placeholder_payee' | 'missing_mpp_config' | 'missing_mpp_secret_key' | 'missing_mpp_currency' | 'invalid_mpp_currency' | 'missing_mpp_recipient' | 'invalid_mpp_recipient' | 'missing_mpp_rpc_url' | 'invalid_mpp_fee_payer_key' | 'missing_mpp_default_store_env';
662
721
  interface RouterConfigIssue {
663
722
  code: RouterConfigIssueCode;
664
723
  message: string;
@@ -690,6 +749,14 @@ declare function x402AcceptsFromEnv(env: RouterEnv, options?: {
690
749
  }): X402AcceptConfig[];
691
750
  declare function paidOptionsForProtocols(protocols: readonly ProtocolType[]): PaidOptions;
692
751
 
752
+ /**
753
+ * SIWX verification error codes.
754
+ * Enables clients to auto-retry transient failures (e.g., expired challenge).
755
+ */
756
+ type SiwxErrorCode = 'siwx_missing_header' | 'siwx_malformed' | 'siwx_expired' | 'siwx_nonce_used' | 'siwx_invalid_signature';
757
+ /** Human-readable error messages for each SIWX error code. */
758
+ declare const SIWX_ERROR_MESSAGES: Record<SiwxErrorCode, string>;
759
+
693
760
  interface MonitorEntry {
694
761
  provider: string;
695
762
  route: string;
@@ -699,7 +766,7 @@ interface MonitorEntry {
699
766
  critical?: number;
700
767
  }
701
768
  interface ServiceRouter<TPriceKeys extends string = never> {
702
- route<K extends string>(keyOrDefinition: K | RouteDefinition<K>): [K] extends [TPriceKeys] ? RouteBuilder<undefined, undefined, undefined, true, false, false, false, false> : RouteBuilder<undefined, undefined, undefined, false, false, false, false, false>;
769
+ route<K extends string>(keyOrDefinition: K | RouteDefinition<K>): [K] extends [TPriceKeys] ? RouteBuilder<undefined, undefined, undefined, true, false, false> : RouteBuilder<undefined, undefined, undefined, false, false, false>;
703
770
  wellKnown(): (request: NextRequest) => Promise<NextResponse>;
704
771
  openapi(): (request: NextRequest) => Promise<NextResponse>;
705
772
  llmsTxt(): (request: NextRequest) => Promise<NextResponse>;
@@ -710,4 +777,4 @@ declare function createRouter<const P extends Record<string, string> = Record<ne
710
777
  prices?: P;
711
778
  }): ServiceRouter<Extract<keyof P, string>>;
712
779
 
713
- export { type AlertEvent, type AlertFn, type AlertLevel, type AuthEvent, type AuthMode, BASE_NETWORK, type DiscoveryConfig, type EntitlementStore, type ErrorEvent, type HandlerContext, type HandlerPaymentContext, HttpError, MemoryEntitlementStore, MemoryNonceStore, type MonitorEntry, type MppProtocolInfo, type NonceStore, type OveragePolicy, type PaidOptions, type PayToConfig, type PaymentEvent, type PaymentStatus, type PluginContext, type PricingConfig, type ProtocolType, type ProviderConfig, type ProviderQuotaEvent, type QuotaInfo, type QuotaLevel, type RedisEntitlementStoreOptions, type RedisNonceStoreOptions, type RequestMeta, type ResponseMeta, RouteBuilder, type RouteEntry, RouteRegistry, type RouterConfig, RouterConfigError, type RouterConfigIssue, type RouterConfigIssueCode, type RouterConfigValidationOptions, type RouterEnv, type RouterPlugin, SIWX_CHALLENGE_EXPIRY_MS, SOLANA_MAINNET_NETWORK, type ServiceRouter, type SettlementEvent, TEMPO_USDC_CURRENCY, type TierConfig, type X402AcceptConfig, type X402FacilitatorTarget, type X402FacilitatorsConfig, type X402ResolvedAccept, type X402RouterFacilitatorConfig, type X402Server, ZERO_EVM_ADDRESS, consolePlugin, createRedisEntitlementStore, createRedisNonceStore, createRouter, formatRouterConfigIssues, getRouterConfigIssues, mppFromEnv, paidOptionsForProtocols, validateRouterConfig, x402AcceptsFromEnv };
780
+ export { type AlertEvent, type AlertFn, type AlertLevel, type AuthEvent, type AuthMode, BASE_NETWORK, type DiscoveryConfig, type EntitlementStore, type ErrorEvent, type HandlerContext, type HandlerPaymentContext, HttpError, MemoryEntitlementStore, MemoryNonceStore, type MonitorEntry, type MppProtocolInfo, type NonceStore, type OveragePolicy, type PaidOptions, type PayToConfig, type PaymentEvent, type PaymentStatus, type PluginContext, type PricingConfig, type ProtocolType, type ProviderConfig, type ProviderQuotaEvent, type QuotaInfo, type QuotaLevel, type RedisEntitlementStoreOptions, type RedisNonceStoreOptions, type RequestMeta, type ResponseMeta, RouteBuilder, type RouteEntry, RouteRegistry, type RouterConfig, RouterConfigError, type RouterConfigIssue, type RouterConfigIssueCode, type RouterConfigValidationOptions, type RouterEnv, type RouterPlugin, SIWX_CHALLENGE_EXPIRY_MS, SIWX_ERROR_MESSAGES, SOLANA_MAINNET_NETWORK, type ServiceRouter, type SettledHandlerErrorContext, type SettlementErrorContext, type SettlementEvent, type SettlementLifecycle, type SettlementLifecycleContext, type SettlementSettledContext, type SiwxErrorCode, TEMPO_USDC_CURRENCY, type TierConfig, type X402AcceptConfig, type X402FacilitatorTarget, type X402FacilitatorsConfig, type X402ResolvedAccept, type X402RouterFacilitatorConfig, type X402Server, ZERO_EVM_ADDRESS, consolePlugin, createRedisEntitlementStore, createRedisNonceStore, createRouter, formatRouterConfigIssues, getRouterConfigIssues, mppFromEnv, paidOptionsForProtocols, validateRouterConfig, x402AcceptsFromEnv };