import { type SystemBlockSource } from '../core/system-prompt-builder.js'; import type { Context } from '../core/context.js'; /** * Real, per-category token accounting for the live context window — the data * behind an honest `/context` display. Every number is measured from the actual * assembled inputs (`ctx.systemPrompt`, `ctx.tools`, `ctx.messages`) using the * same 3.5-chars/token estimator the compactor and live bar use, so the total * here reconciles with the context-fill bar. It replaces the hardcoded fake * percentages the TUI dashboard used to show. */ export interface ContextBreakdown { system: { total: number; /** Tokens attributed to each system-prompt section (see SystemBlockSource). */ bySource: Record; }; tools: { total: number; builtin: number; mcp: number; /** Number of tool definitions in the request. */ count: number; /** MCP tool tokens grouped by originating server. */ mcpByServer: Record; }; history: { total: number; /** User/assistant text + tool_use inputs + thinking. */ text: number; /** tool_result output content. */ toolResults: number; messageCount: number; }; volatile: { /** Completed-work ledger, appended to `system` at request time. */ ledger: number; /** Next-steps gate, appended to `system` at request time. */ nextsteps: number; total: number; }; /** system.total + tools.total + history.total + volatile.total. */ total: number; effectiveMaxContext: number; /** total / effectiveMaxContext — may exceed 1 before compaction fires. */ usedPct: number; /** * Non-fatal build warnings encountered during breakdown computation. * Empty when everything succeeded; populated when volatile blocks * (ledger, nextsteps) threw during construction and were silently omitted. */ warnings: string[]; } /** * Compute the real per-category token breakdown of a live context. Safe to call * interactively (e.g. from `/context`): it walks the full message array once, so * it is O(messages·blocks), not the O(1) cached path the per-turn bar uses. */ export declare function getContextBreakdown(ctx: Context): ContextBreakdown; //# sourceMappingURL=context-breakdown.d.ts.map