/**
 * Language-aware token estimation — tokenx-inspired approach.
 * Replaces the naive `chars / 4` heuristic with segment-level analysis.
 *
 * The heuristic estimator (`estimateTokenCount`/`sliceByTokens`) is the
 * zero-dependency default. For exact, model-specific counts, use the
 * pluggable {@link Tokenizer} abstraction (`createTokenizer`), which lazily
 * loads OpenAI BPE encodings (`o200k_base`, `cl100k_base`) via `gpt-tokenizer`
 * only when requested.
 */
import { z } from 'zod';
export interface LanguageConfig {
    pattern: RegExp;
    averageCharsPerToken: number;
}
export interface TokenEstimationOptions {
    defaultCharsPerToken?: number;
    languageConfigs?: LanguageConfig[];
}
/** Estimate token count using language-aware heuristics */
export declare function estimateTokenCount(text?: string | number, options?: TokenEstimationOptions): number;
/** Slice text by token positions (like Array.slice but for tokens) */
export declare function sliceByTokens(text: string, start?: number, end?: number, options?: TokenEstimationOptions): string;
export declare const TokenizerNameSchema: z.ZodEnum<{
    heuristic: "heuristic";
    o200k_base: "o200k_base";
    cl100k_base: "cl100k_base";
}>;
export type TokenizerName = z.infer<typeof TokenizerNameSchema>;
export interface Tokenizer {
    /** Identifier of the active encoding (`heuristic` for the language-aware estimate). */
    readonly name: TokenizerName;
    /** Token count for `text`. A number input is treated as a character count (heuristic only). */
    count(text: string | number): number;
    /** Slice `text` by token positions, like `Array.prototype.slice` but token-aware. */
    slice(text: string, start?: number, end?: number): string;
}
/**
 * Build a tokenizer for the given encoding. `heuristic` resolves synchronously
 * with no dependency; BPE encodings lazily load their tables once (cached).
 */
export declare function createTokenizer(name: TokenizerName): Promise<Tokenizer>;
/**
 * Resolve a tokenizer name from an explicit option, then the `OCC_TOKENIZER`
 * env var, defaulting to `heuristic`. Throws on an unrecognized value.
 */
export declare function resolveTokenizerName(explicit?: string, env?: string | undefined): TokenizerName;
