/** * Token accounting for context virtualization. * * Uses the tiered token accounting module (content-class aware conservative * fallback, calibrated uplift when provider usage is available). The governor * must never under-count, so estimation is always upper-biased. */ import type { AgentMessage } from "@apholdings/jensen-agent-core"; import type { Tool } from "@apholdings/jensen-ai"; import { analyzeText, type ContentClass, estimateTextTokens, MAX_CALIBRATED_MULTIPLIER, resolveAccountingMode, type TokenAccountingMode, type TokenAccountingOptions } from "./token-accounting.js"; export { analyzeText, estimateTextTokens, MAX_CALIBRATED_MULTIPLIER, resolveAccountingMode }; export type { ContentClass, TokenAccountingMode, TokenAccountingOptions }; export interface TokenAccounting { /** Calibrated multiplier from provider-usage observation (>= 1). */ calibratedMultiplier?: number; } /** Estimate the token cost of the stable prefix (system prompt + tool schemas). */ export declare function estimateStablePrefixTokens(systemPrompt: string, tools: readonly Tool[] | undefined, accounting?: TokenAccounting): number; export interface ContextAssembly { systemPrompt: string; dynamicPrompt?: string; messages: AgentMessage[]; tools?: Tool[]; } /** Estimate the cost of a message, choosing a content class per role/block. */ export declare function estimateMessageTokens(message: AgentMessage, accounting?: TokenAccounting): number; /** * Estimate the total input tokens Jensen would send for this assembly, * including system prompt, tool schemas, and the host-context dynamic prompt. */ export declare function estimateAssemblyInputTokens(assembly: ContextAssembly, accounting?: TokenAccounting): number; /** Estimate the token cost of a list of messages. */ export declare function estimateMessageTokensFor(messages: AgentMessage[], accounting?: TokenAccounting): number; export interface ContextRegionCosts { systemPromptTokens: number; toolSchemaTokens: number; dynamicPromptTokens: number; messageTokens: number; /** systemPrompt + toolSchema + dynamicPrompt (the fixed prefix). */ fixedPrefixTokens: number; } /** * Structured, per-region cost breakdown used for fixed-prefix diagnostics and * telemetry. Never used to fabricate completion authority. */ export declare function estimateContextRegionCosts(assembly: ContextAssembly, accounting?: TokenAccounting): ContextRegionCosts; //# sourceMappingURL=context-token.d.ts.map