import type { DiagnosticOutcome, IRNode, TranspileDiagnostic } from './types.js'; /** * Approximate token count using a punctuation/whitespace split heuristic. * * @remarks This is NOT aligned with any specific BPE tokenizer (GPT, Claude, etc.). * Do not use for billing calculations or precise context-window budgeting. * Intended for relative comparisons (IR vs generated output). * * @param text - The text to estimate tokens for * @returns Approximate token count */ export declare function countTokens(text: string): number; /** * Serialize an IR tree to a compact KERN-like text format. * * Used for token-count comparisons and IR debugging. Outputs one line per node * with props inline and children indented. * * @param node - The IR node to serialize * @param indent - Current indentation prefix (used in recursion) * @returns Compact string representation of the IR tree */ export declare function serializeIR(node: IRNode, indent?: string): string; export declare function camelKey(text: string): string; /** Escape text content for JSX — prevents XSS in rendered HTML */ export declare function escapeJsxText(s: string): string; /** Escape attribute values for JSX — prevents XSS in attributes */ export declare function escapeJsxAttr(s: string): string; /** Escape strings for JS string literals (single-quoted) */ export declare function escapeJsString(s: string): string; /** @deprecated Use escapeJsxText, escapeJsxAttr, or escapeJsString */ export declare function escapeJsx(s: string): string; export type AccountedEntry = { outcome: DiagnosticOutcome; reason?: string; }; /** Mark a node (and optionally all its descendants) as accounted for in the tracking map. */ export declare function accountNode(map: Map, node: IRNode, outcome: DiagnosticOutcome, reason?: string, recursive?: boolean): void; /** Build diagnostics by diffing all IR nodes against the accounted map. Root-cause-only reporting. */ export declare function buildDiagnostics(root: IRNode, accounted: Map, target: string): TranspileDiagnostic[];