export { formatNumber } from "@oh-my-pi/pi-utils"; export interface RenderResult { url: string; finalUrl: string; contentType: string; method: string; content: string; fetchedAt: string; truncated: boolean; notes: string[]; } export type SpecialHandler = (url: string, timeout: number, signal?: AbortSignal) => Promise; export declare const MAX_OUTPUT_CHARS = 500000; export declare const MAX_BYTES: number; /** * Truncate and cleanup output */ export declare function finalizeOutput(content: string): { content: string; truncated: boolean; }; export interface LoadPageOptions { timeout?: number; headers?: Record; method?: string; body?: string; maxBytes?: number; signal?: AbortSignal; } export interface LoadPageResult { content: string; contentType: string; finalUrl: string; ok: boolean; status?: number; } /** * Fetch a page with timeout and size limit */ export declare function loadPage(url: string, options?: LoadPageOptions): Promise; /** * Convert HTML to markdown using Turndown with GFM support. * Strips script/style tags before conversion. */ export declare function htmlToBasicMarkdown(html: string): Promise; /** * Build a RenderResult from markdown content. Calls finalizeOutput internally. */ export declare function buildResult(md: string, opts: { url: string; finalUrl?: string; method: string; fetchedAt: string; notes?: string[]; contentType?: string; }): RenderResult; /** * Format a date value as YYYY-MM-DD. Returns empty string on invalid input. */ export declare function formatIsoDate(value?: string | number | Date): string; /** * Decode common HTML entities. */ export declare function decodeHtmlEntities(text: string): string; /** * Format seconds into HH:MM:SS or MM:SS. */ export declare function formatMediaDuration(totalSeconds: number): string; /** * Extract localized text, preferring en-US/en. */ export type LocalizedText = string | Record | null | undefined; export declare function getLocalizedText(value: LocalizedText, defaultLocale?: string): string | undefined; /** * Check if content looks like HTML by inspecting the leading tag. */ export declare function looksLikeHtml(content: string): boolean;