/** * Authenticated HTTP client for the marketplace server. * * Signs requests with EIP-191 personal_sign using the agent's secp256k1 key. * Server uses ecrecover to determine caller address. * * Headers (when requireAuth=true, the default): * X-Signature: 0x + 130 hex (65-byte EIP-191 sig: r||s||v) * X-Timestamp: unix ms (within 5 min drift) * X-Nonce: 16-128 lowercase hex chars (E2 replay protection) * Message: METHOD\nPATH\nTIMESTAMP\nSHA256(BODY)\nNONCE * * Note: caller address is derived from signature on server side * (no X-Agent-ID header needed). */ export interface ErrorBody { error?: string; code?: string; detail?: string; recipient?: string; price_usdc?: number; chain_id?: number; token_address?: string; mode?: string; hint?: string; agent_id?: string; /** * 024 — carried by the 410 DEPRECATED envelope on install. Typed rather than * read off `unknown` so the CLI can print the author's reason instead of a * bare "Server error 410". */ deprecated_since?: string; deprecation_message?: string; /** #12 — publish conflict responses carry the version and the row they collided with. */ version?: string; existing_id?: string | null; name?: string; } export declare class HttpError extends Error { readonly status: number; readonly code: string; readonly body: ErrorBody; constructor(status: number, code: string, message: string, body?: ErrorBody); } /** * Say what the server said. * * "Server error 402" sends the reader off to debug their own setup, while the * server's envelope names the price, the code and the way out. The envelope * was already in `err.body` — it was simply never printed. */ export declare function serverEnvelope(err: HttpError): string[]; export declare function authedFetch(method: string, path: string, body?: unknown, opts?: { baseUrl?: string; requireAuth?: boolean; }): Promise; export declare function authedJson(method: string, path: string, body?: unknown, opts?: { baseUrl?: string; requireAuth?: boolean; }): Promise;