import { isRecord } from "@oh-my-pi/pi-utils"; export { isRecord }; import type { LoadPageResult } from "./types.js"; export declare function asRecord(value: unknown): Record | null; /** * Whether an HTTP status settles "is this origin platform X?". Transport * failures (no status), auth/bot walls, timeouts, rate limits and server errors * may be transient, so they never produce a memoized verdict. */ export declare function isConclusiveProbeStatus(status: number | undefined): boolean; /** * True when a failed request to a platform's JSON API settles that the origin * does not run that platform: a conclusive status with a non-JSON body (the * site's own HTML 404 page, say). Platforms answer API errors with JSON. */ export declare function isNonJsonApiResponse(result: LoadPageResult): boolean; /** * Bounded per-origin memo of platform-detection verdicts, negatives included, * so generic URL shapes (`/@user`, `/post/N`, `/t/slug/N`) do not re-probe a * known host on every fetch. Concurrent lookups share one in-flight probe. * Negative verdicts expire after {@link NEGATIVE_VERDICT_TTL_MS}. */ export declare class PlatformProbeCache { #private; constructor(max?: number); /** Memoized (possibly still pending) verdict for `origin`. */ get(origin: string): Promise | undefined; /** * Return the memoized verdict, or run `probe` once for `origin`. A probe * resolving `undefined` is inconclusive: callers see `false` and the next * lookup probes again. */ resolve(origin: string, probe: () => Promise): Promise; /** Memoize a verdict learned from a regular request to `origin`. */ record(origin: string, verdict: boolean): void; } export declare function asString(value: unknown): string | null; export declare function asNumber(value: unknown): number | null; export interface BinaryFetchSuccess { ok: true; buffer: Uint8Array; contentDisposition?: string; /** Full Content-Type header, including charset, when the server supplies one. */ contentType?: string; } export type BinaryFetchResult = BinaryFetchSuccess | { ok: false; error?: string; }; /** * Fetch binary content from a URL */ export declare function fetchBinary(url: string, timeout?: number, signal?: AbortSignal): Promise; /** * Convert binary content to markdown using markit. */ export declare function convertWithMarkit(buffer: Uint8Array, extension: string, timeout?: number, signal?: AbortSignal): Promise<{ content: string; ok: boolean; error?: string; }>;