//#region src/surface-tokens.d.ts declare const TOKEN_ESTIMATOR_ID: "chumbo-json-lexeme-v1"; declare const SURFACE_TOKEN_LIMITS: Readonly<{ /** Base host framing cost when >= 1 MCP tool is advertised. */catalogBaseTokens: 24; /** Per-tool MCP host wrapper overhead (tool header, role/callable framing). */ perToolEnvelopeTokens: 12; /** Per-tool inputSchema advisory threshold (~3 KiB canonical schema). */ bloatedInputSchemaTokens: 800; /** Per-tool outputSchema advisory threshold (~3 KiB canonical schema). */ bloatedOutputSchemaTokens: 800; /** Total cold-start prompt token warning threshold across tools/list. */ catalogColdStartWarnTokens: 8000; /** Severe cold-start prompt token threshold. */ catalogColdStartSevereTokens: 20000; }>; /** Pure, Deno-safe structural input accepted by token and surface estimators. */ interface SurfaceToolInput { readonly name?: unknown; readonly title?: unknown; readonly description?: unknown; readonly inputSchema?: unknown; readonly outputSchema?: unknown; readonly annotations?: unknown; } interface ToolTokenBreakdown { readonly name: string; readonly envelopeTokens: number; readonly proseTokens: number; readonly inputSchemaTokens: number; readonly outputSchemaTokens: number; /** Cold-start tokens injected into model system context: envelope + prose + inputSchema. */ readonly promptTokens: number; /** Full discovery cost including outputSchema: promptTokens + outputSchemaTokens. */ readonly wireTokens: number; readonly wireBytes: number; readonly inputPropertyCount: number; readonly bloatedInputSchema: boolean; readonly bloatedOutputSchema: boolean; } interface CatalogTokenReport { readonly estimator: typeof TOKEN_ESTIMATOR_ID; readonly toolCount: number; /** Total cold-start model context tokens (catalogBaseTokens + sum(promptTokens)). */ readonly totalPromptTokens: number; readonly totalOutputSchemaTokens: number; readonly totalWireTokens: number; readonly totalWireBytes: number; readonly maxCatalogTokens: number; readonly overColdStartBudget: boolean; readonly bloatedInputTools: readonly string[]; readonly bloatedOutputTools: readonly string[]; /** Sorted by promptTokens descending, then name ascending for deterministic output. */ readonly tools: readonly ToolTokenBreakdown[]; } interface EstimateCatalogTokensOptions { readonly maxCatalogTokens?: number; readonly bloatedInputSchemaTokens?: number; readonly bloatedOutputSchemaTokens?: number; } interface ResultTokenEstimate { readonly estimator: typeof TOKEN_ESTIMATOR_ID; readonly textTokens: number; readonly structuredTokens: number; readonly totalTokens: number; readonly encodedBytes: number; } /** * Deterministic token estimate for prose and JSON strings without BPE tables. * - ASCII alphanumeric/underscore runs: ceil(length / 4) tokens * - Structural JSON / punctuation characters: 1 token per symbol run of 1..2 chars * - Non-ASCII UTF-8 bytes: ceil(byteLength / 2) tokens */ declare function estimateTextTokens(value: string): number; declare function estimateJsonTokens(canonicalJson: string): number; declare function estimateToolTokens(rawTool: SurfaceToolInput, options?: EstimateCatalogTokensOptions): ToolTokenBreakdown; declare function estimateCatalogTokens(tools: readonly SurfaceToolInput[], options?: EstimateCatalogTokensOptions): CatalogTokenReport; /** * Deterministic token and byte estimate for a runtime tool/resource/prompt result. */ declare function estimateResultTokens(result: unknown): ResultTokenEstimate; //#endregion export { CatalogTokenReport, EstimateCatalogTokensOptions, ResultTokenEstimate, SURFACE_TOKEN_LIMITS, SurfaceToolInput, TOKEN_ESTIMATOR_ID, ToolTokenBreakdown, estimateCatalogTokens, estimateJsonTokens, estimateResultTokens, estimateTextTokens, estimateToolTokens }; //# sourceMappingURL=surface-tokens.d.ts.map