import type { ProviderUsageRow } from '../../../shared/provider-usage.js'; import { usageError } from '../result.js'; export declare function fetchGrokUsage(): Promise>; export declare function parseGrokBillingBytes(body: Uint8Array, nowMs?: number): { error?: ReturnType; snapshot?: GrokBillingSnapshot; }; interface GrokBillingSnapshot { resetsAt?: string; usedPercent: number; } /** * Abort covers headers **and** body consumption. Clearing the timer after * `fetch()` resolves (headers only) leaves body stalls hanging forever. * Race body read against the abort signal because some runtimes do not reject * `arrayBuffer()` promptly when only the request signal aborts mid-stream. * * Exported so unit tests can exercise the timeout contract without changing * the production `fetchGrokUsage()` surface. */ export declare function fetchUntilBody(url: string, init: RequestInit, timeoutMs: number): Promise<{ bodyBytes: Uint8Array; bodyText: string; headers: Headers; status: number; ok: boolean; }>; interface GrpcWebFrames { error?: string; payload?: Uint8Array; trailers: Record; } /** * Parse the gRPC-Web envelope of this **unary** endpoint fail-closed. A valid * response is exactly one uncompressed data frame followed by one uncompressed * trailer frame (the trailer must be last). Anything else — a second data frame, * a frame after the trailer, a trailer before the data, a truncated/residual * frame, or a compressed/unknown frame flag — is a hard error. The caller still * requires the trailer to carry an explicit `grpc-status:0`. */ export declare function parseGrpcWebFrames(body: Uint8Array): GrpcWebFrames; export {}; //# sourceMappingURL=grok.d.ts.map