/** Per-request token usage fields that together occupy the model context. */ export interface ContextUsageSnapshot { readonly input: number; readonly output?: number; readonly cacheRead: number; readonly cacheWrite: number; } /** Estimated context-token segments available before the first usage event. */ export type ContextSegmentEstimate = Readonly>; /** * Return the current context occupancy. The latest request is authoritative: * its uncached input and cache read/write tokens are all part of that request's * context. Segment estimates are used only before a request reports usage. * * @param usage - Usage reported by the most recent model request. * @param estimatedSegments - Optional live estimates used before `usage` exists. * @returns Current occupied context tokens, or undefined when not yet known. */ export declare function currentContextTokens(usage: ContextUsageSnapshot | undefined, estimatedSegments?: ContextSegmentEstimate): number | undefined; /** * Format the integer context percentage shared by `/tokens` and the dashboard. * * @param usedTokens - Current occupied context tokens. * @param contextWindow - Active model context capacity. * @returns A clamped integer percentage, or undefined when occupancy is unknown. */ export declare function contextUsagePercent(usedTokens: number | undefined, contextWindow: number | undefined): number | undefined; /** * Build `/tokens` output from cumulative session totals plus current context. * * @param sessionTokens - Cumulative input/output usage across model requests. * @param lastUsage - Usage reported by the most recent model request. * @param contextWindow - Active model context capacity. * @param estimatedSegments - Live context estimates before first reported usage. * @returns Localized token-usage notification text. */ export declare function formatTokenUsageNotice(sessionTokens: Readonly<{ input: number; output: number; }>, lastUsage: ContextUsageSnapshot | undefined, contextWindow: number | undefined, estimatedSegments?: ContextSegmentEstimate): string; //# sourceMappingURL=contextUsage.d.ts.map