/** * Sanitized local journal for automatic x402 payment attempts. * * Each attempt is a separate mode-0600 file. Separate files avoid lost * updates when multiple SDK processes pay concurrently. Records intentionally * exclude request headers, query strings, bodies, wallet keys, signed payment * authorizations, and provider proofs. */ export declare const PAYMENT_ATTEMPT_HEADER = "X-Run402-Payment-Attempt-Id"; export declare const PAYMENT_ATTEMPT_ID_PATTERN: RegExp; export type PaymentAttemptJournalState = "intent" | "submitting" | "response_received" | "intent_pending" | "completed" | "failed" | "ambiguous"; export interface PaymentAttemptRecord { version: 1; payment_attempt_id: string; rail: "x402"; state: PaymentAttemptJournalState; mutation_state: "not_started" | "in_progress" | "completed" | "ambiguous"; method: string; origin: string | null; /** SHA-256 of the URL pathname; raw path/query values are never persisted. */ path_sha256: string | null; /** SHA-256 of the caller key; the raw Idempotency-Key is never persisted. */ caller_key_sha256?: string; created_at: string; updated_at: string; provider_started_at?: string; response_status?: number; last_error_code?: string; payment_id?: string; intent_state?: string; retry_after_seconds?: number; } export interface PaymentAttemptStore { /** Atomically reserve a new id; returns false when it already exists. */ claim(record: PaymentAttemptRecord): boolean; write(record: PaymentAttemptRecord): void; read(paymentAttemptId: string): PaymentAttemptRecord | null; } export declare function createPaymentAttemptId(): string; export declare function paymentAttemptJournalDir(): string; export declare function createFilePaymentAttemptStore(dir?: string): PaymentAttemptStore; /** Read one sanitized attempt from the active wallet profile's journal. */ export declare function readPaymentAttempt(paymentAttemptId: string): PaymentAttemptRecord | null; /** * List recent sanitized attempts for reconciliation. This is a local read; * provider/target state remains authoritative for ambiguous attempts. */ export declare function listPaymentAttempts(opts?: { limit?: number; }): PaymentAttemptRecord[]; export declare function requestSummary(input: RequestInfo | URL, init?: RequestInit): { method: string; origin: string | null; path_sha256: string | null; caller_key_sha256: string | null; }; export declare function attemptIdFromRequest(input: RequestInfo | URL, init?: RequestInit): string | null; export declare function withPaymentAttemptHeader(input: RequestInfo | URL, init: RequestInit | undefined, paymentAttemptId: string, paymentBearing: boolean): [RequestInfo | URL, RequestInit]; export declare function hasPaymentAuthorization(input: RequestInfo | URL, init?: RequestInit): boolean; //# sourceMappingURL=payment-attempts.d.ts.map