@haven_ai/sdk 0.1.3 → 0.1.4

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
@@ -13,6 +13,15 @@ interface HavenClientConfig {
13
13
  confirmationTimeout?: number;
14
14
  /** Polling interval in ms when waiting for confirmation (default: 3000) */
15
15
  pollingInterval?: number;
16
+ /**
17
+ * Extra headers to attach to every request to the Haven API.
18
+ *
19
+ * Used by the MCP server to tag requests with `X-Haven-MCP-Tool: <name>`
20
+ * so the backend can record an audit-log entry per tool invocation. Has
21
+ * no effect on outbound merchant requests (x402 / MPP) — those are
22
+ * standard HTTP and never carry Haven-internal headers.
23
+ */
24
+ defaultHeaders?: Record<string, string>;
16
25
  }
17
26
  interface PaymentRequest {
18
27
  /** Token symbol: "EURe", "USDC.e", or "xDAI" */
@@ -135,6 +144,94 @@ interface X402AuthorizationOptions {
135
144
  /** Stable caller-supplied key for this user intent. Prevents duplicate approvals across fresh 402 quotes. */
136
145
  idempotencyKey?: string;
137
146
  }
147
+ /** Serializable HTTP request state for retrying the same x402 merchant request. */
148
+ interface X402RequestSnapshot {
149
+ url: string;
150
+ method: string;
151
+ headers: [string, string][];
152
+ body?: string;
153
+ }
154
+ /** Quote parsed from an HTTP 402 response without creating a Haven payment. */
155
+ interface X402Quote {
156
+ rail: 'x402';
157
+ idempotencyKey: string;
158
+ paymentRequired: X402PaymentRequired;
159
+ accepted: X402PaymentOption;
160
+ request: X402RequestSnapshot;
161
+ resourceUrl: string;
162
+ description: string | null;
163
+ mimeType: string | null;
164
+ amountAtomic: string;
165
+ amount: string;
166
+ token: string;
167
+ asset: string;
168
+ network: string;
169
+ chainId: number | null;
170
+ merchantAddress: string;
171
+ maxTimeoutSeconds: number;
172
+ }
173
+ /** State bundle an agent can persist while waiting for manual x402 approval. */
174
+ interface X402ResumeState {
175
+ rail: 'x402';
176
+ paymentId: string;
177
+ idempotencyKey: string;
178
+ paymentRequired: X402PaymentRequired;
179
+ accepted: X402PaymentOption;
180
+ url: string;
181
+ request?: X402RequestSnapshot;
182
+ resourceUrl: string;
183
+ description: string | null;
184
+ amountAtomic: string;
185
+ amount: string;
186
+ token: string;
187
+ asset: string;
188
+ network: string;
189
+ chainId: number | null;
190
+ merchantAddress: string;
191
+ }
192
+ interface MppAuthorizationOptions {
193
+ /** Stable caller-supplied key for this user intent. Prevents duplicate approvals across retries. */
194
+ idempotencyKey?: string;
195
+ }
196
+ /** Quote parsed from an MPP challenge without creating a Haven payment. */
197
+ interface MppQuote {
198
+ rail: 'mpp';
199
+ paymentRail: MachinePaymentRail;
200
+ idempotencyKey: string;
201
+ challenge: MachinePaymentChallenge;
202
+ request: X402RequestSnapshot;
203
+ resourceUrl: string;
204
+ description: string | null;
205
+ amountAtomic: string;
206
+ amount: string;
207
+ token: string;
208
+ asset: string;
209
+ network: string;
210
+ chainId: number;
211
+ merchantAddress: string;
212
+ expiresAt: string;
213
+ }
214
+ /** State bundle an agent can persist while waiting for manual MPP approval. */
215
+ interface MppResumeState {
216
+ rail: 'mpp';
217
+ paymentRail: MachinePaymentRail;
218
+ paymentId: string;
219
+ idempotencyKey: string;
220
+ challenge: MachinePaymentChallenge;
221
+ url: string;
222
+ request?: X402RequestSnapshot;
223
+ resourceUrl: string;
224
+ description: string | null;
225
+ amountAtomic: string;
226
+ amount: string;
227
+ token: string;
228
+ asset: string;
229
+ network: string;
230
+ chainId: number;
231
+ merchantAddress: string;
232
+ expiresAt: string;
233
+ }
234
+ type PaymentResumeState = X402ResumeState | MppResumeState;
138
235
  interface ResumeAuthorizedX402Input extends X402AuthorizationOptions {
139
236
  /** Payment or approval request ID returned by authorizeX402 / haven.fetch. */
140
237
  paymentId: string;
@@ -148,9 +245,29 @@ interface ResumeX402PaymentInput extends X402AuthorizationOptions {
148
245
  url: string;
149
246
  /** Original fetch options. Reused for the 402 probe and final merchant retry. */
150
247
  init?: RequestInit;
248
+ /** Serializable original request captured by quoteX402() / pending approval errors. */
249
+ request?: X402RequestSnapshot;
151
250
  /** Original or freshly parsed x402 requirements. Supplying this avoids an extra merchant 402 probe. */
152
251
  paymentRequired?: X402PaymentRequired;
153
252
  }
253
+ interface ResumeAuthorizedMppInput extends MppAuthorizationOptions {
254
+ /** Payment or approval request ID returned by authorizeMachinePayment / haven.fetch. */
255
+ paymentId: string;
256
+ /** Original MPP challenge returned by the paid resource. */
257
+ challenge: MachinePaymentChallenge;
258
+ }
259
+ interface ResumeMppPaymentInput extends MppAuthorizationOptions {
260
+ /** Payment or approval request ID returned by authorizeMachinePayment / haven.fetch. */
261
+ paymentId: string;
262
+ /** Original paid URL. If challenge is omitted, Haven will call it once to re-read the MPP challenge. */
263
+ url: string;
264
+ /** Original fetch options. Reused for the 402 probe and final merchant retry. */
265
+ init?: RequestInit;
266
+ /** Serializable original request captured by quoteMpp() / pending approval errors. */
267
+ request?: X402RequestSnapshot;
268
+ /** Original MPP challenge. Supplying this avoids an extra paid-resource 402 probe. */
269
+ challenge?: MachinePaymentChallenge;
270
+ }
154
271
  type MachinePaymentRail = 'x402' | 'mpp_demo' | 'mpp_crypto' | 'stripe_deposit' | 'spt';
155
272
  interface MachinePaymentChallenge {
156
273
  rail: MachinePaymentRail;
@@ -190,9 +307,134 @@ interface MachinePaymentReceipt {
190
307
  chainId?: number;
191
308
  proofHeader: string;
192
309
  }
310
+ interface HavenAgent {
311
+ id: string;
312
+ name: string;
313
+ status: string;
314
+ safeAddress: string;
315
+ delegateAddress: string;
316
+ chainId: number;
317
+ }
318
+ interface HavenAllowance {
319
+ id: string;
320
+ tokenAddress: string;
321
+ tokenSymbol: string;
322
+ configuredAmount: string;
323
+ resetPeriodMin: number;
324
+ onchain: {
325
+ amount: string;
326
+ spent: string;
327
+ remaining: string;
328
+ effectiveSpent: string;
329
+ resetTimeMin: number;
330
+ lastResetMin: number;
331
+ nonce: number;
332
+ isResetPending: boolean;
333
+ };
334
+ }
335
+ interface HavenAllowanceSummary {
336
+ agentId: string;
337
+ safeAddress: string;
338
+ delegateAddress: string;
339
+ chainId: number;
340
+ allowances: HavenAllowance[];
341
+ }
342
+ interface HavenPaymentReceipt {
343
+ id: string;
344
+ paymentId: string;
345
+ rail: string;
346
+ proofStatus: string;
347
+ txHash: string;
348
+ chainId: number;
349
+ resourceUrl: string;
350
+ merchantAddress: string | null;
351
+ payerAddress: string;
352
+ settlementAddress: string;
353
+ tokenSymbol: string;
354
+ tokenAddress: string;
355
+ amountRaw: string;
356
+ amount: string;
357
+ challengeId: string | null;
358
+ idempotencyKey: string | null;
359
+ challengePayload?: Record<string, unknown> | null;
360
+ selectedPayment?: Record<string, unknown> | null;
361
+ paymentProofHeaderName: string | null;
362
+ protocolReceiptHeaderName: string | null;
363
+ protocolReceiptPayload?: Record<string, unknown> | null;
364
+ merchantStatus: number | null;
365
+ confirmedAt: string | null;
366
+ createdAt: string;
367
+ updatedAt: string;
368
+ }
193
369
  type PaymentStateKind = 'payment_intent' | 'approval_request';
194
- type PaymentPhase = 'agent_signature_required' | 'payment_submitted' | 'payment_confirmed' | 'user_approval_required' | 'user_execution_required' | 'waiting_for_additional_approvals' | 'funding_sent' | 'rejected' | 'expired' | 'failed';
195
- type PaymentNextAction = 'sign_and_submit_payment' | 'check_status_later' | 'none' | 'wait_for_user_approval' | 'wait_for_user_to_complete_payment' | 'retry_original_x402_request' | 'stop_and_tell_user' | 'request_again_if_user_still_wants_it';
370
+ interface AgentPaymentEnumSchema {
371
+ type: 'string';
372
+ enum: readonly string[];
373
+ description: string;
374
+ 'x-enumDescriptions': Record<string, string>;
375
+ }
376
+ declare const AgentPaymentPhase: {
377
+ /** The agent must sign and submit the prepared payment before Haven can relay it. */
378
+ readonly AgentSignatureRequired: "agent_signature_required";
379
+ /** Haven has received the signed payment and the agent should poll for confirmation. */
380
+ readonly PaymentSubmitted: "payment_submitted";
381
+ /** The direct payment is confirmed; the agent does not need to do more for this payment id. */
382
+ readonly PaymentConfirmed: "payment_confirmed";
383
+ /** The payment needs wallet owner approval in Haven before it can continue. */
384
+ readonly UserApprovalRequired: "user_approval_required";
385
+ /** The wallet owner approved the request and still needs to complete the funding payment. */
386
+ readonly UserExecutionRequired: "user_execution_required";
387
+ /** The funding payment was proposed and is waiting for the remaining account approvals. */
388
+ readonly WaitingForAdditionalApprovals: "waiting_for_additional_approvals";
389
+ /** The Haven funding leg was sent; the agent can continue the merchant/protocol leg. */
390
+ readonly FundingSent: "funding_sent";
391
+ /** The wallet owner rejected the request; the agent should stop and tell the user. */
392
+ readonly Rejected: "rejected";
393
+ /** The payment or approval request expired before completion. */
394
+ readonly Expired: "expired";
395
+ /** Haven could not complete the payment; the agent should stop and surface the failure. */
396
+ readonly Failed: "failed";
397
+ };
398
+ type AgentPaymentPhase = (typeof AgentPaymentPhase)[keyof typeof AgentPaymentPhase];
399
+ declare const AgentPaymentNextAction: {
400
+ /** Sign with the delegate key and submit the payment to Haven. */
401
+ readonly SignAndSubmitPayment: "sign_and_submit_payment";
402
+ /** Poll getPaymentStatus later using this payment id. */
403
+ readonly CheckStatusLater: "check_status_later";
404
+ /** No further agent action is required for this payment id. */
405
+ readonly None: "none";
406
+ /** Wait for the wallet owner to approve or reject the request in Haven. */
407
+ readonly WaitForUserApproval: "wait_for_user_approval";
408
+ /** Wait for the wallet owner to finish sending the approved funding payment. */
409
+ readonly WaitForUserToCompletePayment: "wait_for_user_to_complete_payment";
410
+ /** Resume this payment id and retry the original x402 request with the merchant payment header. */
411
+ readonly RetryOriginalX402Request: "retry_original_x402_request";
412
+ /** Stop retrying this payment and tell the user what happened. */
413
+ readonly StopAndTellUser: "stop_and_tell_user";
414
+ /** Ask again only if the user still wants the payment after expiry. */
415
+ readonly RequestAgainIfUserStillWantsIt: "request_again_if_user_still_wants_it";
416
+ };
417
+ type AgentPaymentNextAction = (typeof AgentPaymentNextAction)[keyof typeof AgentPaymentNextAction];
418
+ declare const AgentPaymentRail: {
419
+ /** Standard Haven payment from the user's Safe through an approved delegate allowance. */
420
+ readonly Direct: "direct";
421
+ /** x402 HTTP 402 payment flow with a Haven funding leg and merchant retry leg. */
422
+ readonly X402: "x402";
423
+ /** Machine Payment Protocol flow. */
424
+ readonly Mpp: "mpp";
425
+ };
426
+ type AgentPaymentRail = (typeof AgentPaymentRail)[keyof typeof AgentPaymentRail];
427
+ type PaymentPhase = AgentPaymentPhase;
428
+ type PaymentNextAction = AgentPaymentNextAction;
429
+ declare const AGENT_PAYMENT_PHASE_VALUES: ("rejected" | "expired" | "failed" | "agent_signature_required" | "payment_submitted" | "payment_confirmed" | "user_approval_required" | "user_execution_required" | "waiting_for_additional_approvals" | "funding_sent")[];
430
+ declare const AGENT_PAYMENT_NEXT_ACTION_VALUES: ("sign_and_submit_payment" | "check_status_later" | "none" | "wait_for_user_approval" | "wait_for_user_to_complete_payment" | "retry_original_x402_request" | "stop_and_tell_user" | "request_again_if_user_still_wants_it")[];
431
+ declare const AGENT_PAYMENT_RAIL_VALUES: ("x402" | "mpp" | "direct")[];
432
+ declare const AgentPaymentPhaseDescriptions: Record<AgentPaymentPhase, string>;
433
+ declare const AgentPaymentNextActionDescriptions: Record<AgentPaymentNextAction, string>;
434
+ declare const AgentPaymentRailDescriptions: Record<AgentPaymentRail, string>;
435
+ declare const AgentPaymentPhaseSchema: AgentPaymentEnumSchema;
436
+ declare const AgentPaymentNextActionSchema: AgentPaymentEnumSchema;
437
+ declare const AgentPaymentRailSchema: AgentPaymentEnumSchema;
196
438
  interface PaymentStatusResult {
197
439
  paymentId: string;
198
440
  kind: PaymentStateKind;
@@ -208,12 +450,36 @@ interface PaymentStatusResult {
208
450
  expiresAt: string;
209
451
  chainId: number;
210
452
  message: string;
453
+ amountAtomic?: string | null;
454
+ asset?: string | null;
455
+ network?: string | null;
456
+ description?: string | null;
457
+ idempotencyKey?: string | null;
458
+ x402?: {
459
+ amountAtomic: string | null;
460
+ asset: string | null;
461
+ network: string | null;
462
+ resourceUrl: string | null;
463
+ merchantAddress: string | null;
464
+ description: string | null;
465
+ idempotencyKey: string | null;
466
+ };
467
+ mpp?: {
468
+ amountAtomic: string | null;
469
+ asset: string | null;
470
+ network: string | null;
471
+ resourceUrl: string | null;
472
+ merchantAddress: string | null;
473
+ description: string | null;
474
+ idempotencyKey: string | null;
475
+ challengeId: string | null;
476
+ };
211
477
  }
212
478
  interface PendingApproval extends PaymentStatusResult {
213
479
  kind: 'approval_request';
214
480
  status: 'pending_approval' | 'pending' | string;
215
- phase: 'user_approval_required';
216
- nextAction: 'wait_for_user_approval';
481
+ phase: typeof AgentPaymentPhase.UserApprovalRequired;
482
+ nextAction: typeof AgentPaymentNextAction.WaitForUserApproval;
217
483
  requested?: string;
218
484
  remaining?: string | null;
219
485
  }
@@ -229,6 +495,7 @@ declare class HavenApiError extends HavenError {
229
495
  }
230
496
  declare class HavenPaymentStateError extends HavenApiError {
231
497
  readonly state: PaymentStatusResult;
498
+ resumeState?: X402ResumeState | MppResumeState;
232
499
  constructor(message: string, statusCode: number, state: PaymentStatusResult, body?: unknown);
233
500
  get status(): string;
234
501
  get phase(): PaymentPhase;
@@ -252,9 +519,38 @@ declare class HavenClient {
252
519
  private readonly inFlightX402;
253
520
  private readonly x402ReceiptCache;
254
521
  private readonly inFlightMachinePayments;
522
+ /**
523
+ * Setup-time headers configured via `HavenClientConfig.defaultHeaders`.
524
+ * Read-only after construction — use `withRequestContext` for per-call
525
+ * scoping so concurrent requests don't race on shared mutable state.
526
+ */
527
+ private readonly defaultHeaders;
528
+ /**
529
+ * Async-local store for per-request context (currently: extra headers).
530
+ * Each `withRequestContext` invocation produces an isolated store, so
531
+ * overlapping async work — like two MCP tool dispatches in flight at
532
+ * the same time — see their own headers without stepping on each other.
533
+ */
534
+ private readonly requestContext;
255
535
  /** Delegate address derived from the private key (if provided) */
256
536
  readonly delegateAddress: string | undefined;
257
537
  constructor(config: HavenClientConfig);
538
+ /**
539
+ * Run `fn` with extra Haven-API headers scoped to the async work it
540
+ * performs. Used by the MCP server to tag every Haven API request that
541
+ * a single tool dispatch makes with `X-Haven-MCP-Tool: <name>` so the
542
+ * backend can write an audit-log row attributing the call.
543
+ *
544
+ * The headers are held in an `AsyncLocalStorage` so overlapping
545
+ * dispatches do not leak headers into each other's requests. The store
546
+ * inherits across `await` boundaries, so any Haven API call made while
547
+ * `fn` is awaiting will pick up the right headers.
548
+ *
549
+ * Has no effect on outbound merchant requests (x402 / MPP) — those
550
+ * never go through the internal `request<T>` path that reads the
551
+ * context.
552
+ */
553
+ withRequestContext<T>(headers: Record<string, string>, fn: () => Promise<T>): Promise<T>;
258
554
  /**
259
555
  * Send a payment in one call.
260
556
  *
@@ -297,6 +593,27 @@ declare class HavenClient {
297
593
  * `getPayment()` remains available for payment-intent-only integrations.
298
594
  */
299
595
  getPaymentStatus(paymentId: string): Promise<PaymentStatusResult>;
596
+ /**
597
+ * Get the agent identity tied to this API key.
598
+ */
599
+ getAgent(): Promise<HavenAgent>;
600
+ /**
601
+ * Get configured and on-chain allowances for the authenticated agent.
602
+ */
603
+ getAllowances(): Promise<HavenAllowanceSummary>;
604
+ /**
605
+ * List recent machine-payment receipts/evidence for bookkeeping.
606
+ */
607
+ listReceipts(options?: {
608
+ limit?: number;
609
+ }): Promise<HavenPaymentReceipt[]>;
610
+ /**
611
+ * Rehydrate the x402/MPP resume-state bundle for a payment id.
612
+ *
613
+ * The server returns stored protocol context only. The client still signs the
614
+ * merchant proof locally when resumeX402Payment() or resumeMppPayment() runs.
615
+ */
616
+ getResumeState(paymentId: string): Promise<PaymentResumeState>;
300
617
  /**
301
618
  * Poll until a payment reaches a terminal status (confirmed, failed, expired).
302
619
  */
@@ -311,9 +628,18 @@ declare class HavenClient {
311
628
  * Requires `delegateKey` to be set in the client config.
312
629
  */
313
630
  authorizeX402(paymentRequired: X402PaymentRequired, options?: X402AuthorizationOptions): Promise<X402Receipt>;
631
+ /**
632
+ * Probe a paid endpoint and return its x402 quote without creating a Haven
633
+ * payment or approval request.
634
+ */
635
+ quoteX402(url: string, init?: RequestInit, options?: X402AuthorizationOptions): Promise<X402Quote>;
636
+ /**
637
+ * Pay a previously inspected x402 quote and retry the exact captured request.
638
+ */
639
+ payX402Quote(quote: X402Quote, options?: X402AuthorizationOptions): Promise<Response>;
314
640
  private authorizeStandardX402;
315
641
  resumeAuthorizedX402(input: ResumeAuthorizedX402Input): Promise<X402Receipt>;
316
- resumeX402Payment(input: ResumeX402PaymentInput): Promise<Response>;
642
+ resumeX402Payment(input: ResumeX402PaymentInput | X402ResumeState): Promise<Response>;
317
643
  /**
318
644
  * Fetch wrapper that automatically handles HTTP 402 responses.
319
645
  *
@@ -328,24 +654,48 @@ declare class HavenClient {
328
654
  * Requires `delegateKey` to be set in the client config.
329
655
  */
330
656
  fetch(url: string, init?: RequestInit, options?: X402AuthorizationOptions): Promise<Response>;
657
+ /**
658
+ * Probe a paid MPP endpoint or inspect an existing challenge without creating
659
+ * a Haven payment or approval request.
660
+ */
661
+ quoteMpp(challengeOrUrl: MachinePaymentChallenge | string, init?: RequestInit, options?: MppAuthorizationOptions): Promise<MppQuote>;
662
+ /**
663
+ * Pay a previously inspected MPP quote and retry the exact captured request.
664
+ */
665
+ payMppChallenge(quote: MppQuote, options?: MppAuthorizationOptions): Promise<Response>;
331
666
  private retryX402Request;
332
- authorizeMachinePayment(challenge: MachinePaymentChallenge): Promise<MachinePaymentReceipt>;
667
+ authorizeMachinePayment(challenge: MachinePaymentChallenge, options?: MppAuthorizationOptions): Promise<MachinePaymentReceipt>;
333
668
  private authorizeMppDemoPayment;
669
+ resumeAuthorizedMpp(input: ResumeAuthorizedMppInput): Promise<MachinePaymentReceipt>;
670
+ resumeMppPayment(input: ResumeMppPaymentInput | MppResumeState): Promise<Response>;
334
671
  private fetchWithMachinePayment;
672
+ private retryMppRequest;
335
673
  private assertCanResumeX402;
674
+ private assertCanResumeMpp;
336
675
  private mapX402ReceiptFromAuthorization;
337
676
  private mapX402ReceiptFromStatus;
338
677
  private buildX402Receipt;
339
678
  private createStandardX402Header;
340
679
  private cacheX402Receipt;
341
680
  private mapMachinePaymentReceipt;
681
+ private mapMachinePaymentReceiptFromStatus;
342
682
  private recordMerchantRetryRejected;
343
683
  private reportMachinePaymentEvidence;
344
684
  private throwIfNonSignableAuthorizationState;
345
685
  private throwPaymentStateError;
346
686
  private paymentStateFromRaw;
347
687
  private x402PayerAddress;
688
+ private snapshotX402Request;
689
+ private snapshotRequestBody;
690
+ private requestInitFromSnapshot;
348
691
  private withX402Wallet;
692
+ private buildX402Quote;
693
+ private buildX402ResumeState;
694
+ private buildMppQuote;
695
+ private buildMppResumeState;
696
+ private attachResumeState;
697
+ private attachX402ResumeState;
698
+ private attachMppResumeState;
349
699
  /**
350
700
  * Execute a tool call by name and input.
351
701
  *
@@ -367,6 +717,7 @@ declare class HavenClient {
367
717
  private request;
368
718
  private mapPaymentResult;
369
719
  private mapPaymentStatusResult;
720
+ private mapPaymentReceipt;
370
721
  }
371
722
 
372
723
  /**
@@ -496,4 +847,4 @@ declare function parseMachinePaymentChallengeResponse(response: Response): Promi
496
847
  declare function buildMachinePaymentIdempotencyKey(challenge: MachinePaymentChallenge): string;
497
848
  declare function encodeMachinePaymentProof(receipt: Omit<MachinePaymentReceipt, 'proofHeader'>): string;
498
849
 
499
- export { type ClaudeTool, HavenApiError, HavenClient, type HavenClientConfig, HavenError, HavenPaymentStateError, HavenSigningError, HavenTimeoutError, type MachinePaymentChallenge, type MachinePaymentRail, type MachinePaymentReceipt, type OpenAITool, type PaymentIntent, type PaymentNextAction, type PaymentPhase, type PaymentRequest, type PaymentResult, type PaymentStatus, type PaymentStatusResult, type PendingApproval, type ResumeAuthorizedX402Input, type ResumeX402PaymentInput, type SignData, type X402AuthorizationOptions, type X402PaymentOption, type X402PaymentRequired, type X402Receipt, addressFromKey, buildMachinePaymentIdempotencyKey, encodeMachinePaymentProof, encodePaymentProof, havenTools, parseMachinePaymentChallenge, parseMachinePaymentChallengeResponse, parsePaymentRequired, parsePaymentRequiredResponse, selectPaymentOption, signHash, verifySignature };
850
+ export { AGENT_PAYMENT_NEXT_ACTION_VALUES, AGENT_PAYMENT_PHASE_VALUES, AGENT_PAYMENT_RAIL_VALUES, type AgentPaymentEnumSchema, AgentPaymentNextAction, AgentPaymentNextActionDescriptions, AgentPaymentNextActionSchema, AgentPaymentPhase, AgentPaymentPhaseDescriptions, AgentPaymentPhaseSchema, AgentPaymentRail, AgentPaymentRailDescriptions, AgentPaymentRailSchema, type ClaudeTool, type HavenAgent, type HavenAllowance, type HavenAllowanceSummary, HavenApiError, HavenClient, type HavenClientConfig, HavenError, type HavenPaymentReceipt, HavenPaymentStateError, HavenSigningError, HavenTimeoutError, type MachinePaymentChallenge, type MachinePaymentRail, type MachinePaymentReceipt, type MppAuthorizationOptions, type MppQuote, type MppResumeState, type OpenAITool, type PaymentIntent, type PaymentNextAction, type PaymentPhase, type PaymentRequest, type PaymentResult, type PaymentResumeState, type PaymentStatus, type PaymentStatusResult, type PendingApproval, type ResumeAuthorizedMppInput, type ResumeAuthorizedX402Input, type ResumeMppPaymentInput, type ResumeX402PaymentInput, type SignData, type X402AuthorizationOptions, type X402PaymentOption, type X402PaymentRequired, type X402Quote, type X402Receipt, type X402RequestSnapshot, type X402ResumeState, addressFromKey, buildMachinePaymentIdempotencyKey, encodeMachinePaymentProof, encodePaymentProof, havenTools, parseMachinePaymentChallenge, parseMachinePaymentChallengeResponse, parsePaymentRequired, parsePaymentRequiredResponse, selectPaymentOption, signHash, verifySignature };