/** * Token Estimation for Atlas Frames * * Estimates the token count of an Atlas Frame for LLM context window management. * Uses simple heuristics based on JSON serialization size. */ import type { AtlasFrame } from "./types.js"; /** * Estimate the number of tokens in an Atlas Frame * * Uses a simple heuristic: 1 token ≈ 4 characters in JSON * This is approximate but sufficient for auto-tuning decisions. * * @param atlasFrame - The Atlas Frame to estimate * @returns Estimated token count */ export declare function estimateTokens(atlasFrame: AtlasFrame): number; /** * Auto-tune fold radius to fit within token limit * * Starts with the requested radius and reduces it if the resulting * Atlas Frame exceeds the token limit. Stops at radius 0 (seed only). * * @param generateFn - Function that generates an Atlas Frame for a given radius * @param initialRadius - Starting radius to try * @param maxTokens - Maximum token count allowed * @param onAdjustment - Optional callback when radius is adjusted * @returns Object with the final Atlas Frame and radius used */ export declare function autoTuneRadius(generateFn: (radius: number) => AtlasFrame, initialRadius: number, maxTokens: number, onAdjustment?: (oldRadius: number, newRadius: number, tokens: number, limit: number) => void): { atlasFrame: AtlasFrame; radiusUsed: number; tokensUsed: number; }; /** * Estimate if a given radius will exceed token limit * * Rough estimate based on: * - Number of seed modules * - Expected graph density * - Fold radius * * This is used for quick checks before actually generating the frame. * * @param seedCount - Number of seed modules * @param radius - Fold radius * @param avgDegree - Average node degree in graph (default: 3) * @param tokenPerModule - Average tokens per module (default: 200) * @returns Estimated token count */ export declare function estimateTokensBeforeGeneration(seedCount: number, radius: number, avgDegree?: number, tokenPerModule?: number): number;