/** * Configurable status line segments for the footer. * * The footer is assembled from an ordered list of segment ids. The default * list (DEFAULT_STATUS_LINE_SEGMENTS) reproduces the historical footer * composition plus the cost segment, so enabling this feature is purely * additive: nothing disappears unless the user removes a segment via the * "statusLine.segments" setting. * * Segment ids: * - "cwd": current working directory, home-shortened (first line) * - "git": git branch with dirty marker (appended to the cwd line) * - "tokens": cumulative input/output tokens (up/down arrows) * - "cache": cache read/write tokens and latest cache hit rate * - "cost": cumulative session cost in USD * - "context": context window usage percentage * - "model": active model id, right-aligned */ export declare const STATUS_LINE_SEGMENT_IDS: readonly ["cwd", "git", "tokens", "cache", "cost", "context", "model"]; export type StatusLineSegmentId = (typeof STATUS_LINE_SEGMENT_IDS)[number]; /** * Default composition: the historical footer (cwd, git branch, token stats, * context usage, model) plus the cost segment. Purely additive. */ export declare const DEFAULT_STATUS_LINE_SEGMENTS: readonly StatusLineSegmentId[]; /** * Resolve the configured segment list. Unknown ids are dropped so a typo in * settings.json degrades gracefully instead of blanking the footer. Returns * the default composition when the config is missing, not an array, empty, * or contains only unknown ids. */ export declare function resolveStatusLineSegments(config: unknown): StatusLineSegmentId[]; /** Token usage accumulated over a whole session. */ export interface SessionTokenTotals { input: number; output: number; cacheRead: number; cacheWrite: number; /** Cost in USD as reported by providers (0 when unknown). */ cost: number; } /** Per-million-token pricing rates from the model catalogue. */ export interface ModelCostRates { input: number; output: number; cacheRead: number; cacheWrite: number; } /** * Cumulative session cost in USD. Prefers the provider-reported cost; when * that is zero but tokens were consumed and the catalogue knows the model * rates, estimates cost as tokens x price per million. */ export declare function computeSessionCostUsd(totals: SessionTokenTotals, modelCost?: ModelCostRates): number; /** Token usage of a single message, with the provider-reported cost when known. */ export interface MessageUsageForCost { input: number; output: number; cacheRead: number; cacheWrite: number; cost: { total: number; }; } /** * Cost in USD of one message's usage. Prefers the provider-reported cost; otherwise estimates it * with `rates`, which must be the rates of the model that PRODUCED the message. Summing this per * message keeps multi-model sessions (/plan phases, /model switches) correct, whereas pricing the * whole session at the current model's rates did not. */ export declare function computeMessageCostUsd(usage: MessageUsageForCost, rates?: ModelCostRates): number; /** Format a USD cost for compact footer display. */ export declare function formatCostUsd(cost: number): string; /** * Parse `git status --porcelain` output. Returns true when the working tree * or index has any change (dirty), false for a clean tree. */ export declare function parseGitPorcelainDirty(porcelainOutput: string): boolean; /** Render the git segment text: branch name plus a dirty marker. */ export declare function formatGitSegment(branch: string | null, dirty: boolean): string | null; /** * Runner for `git status --porcelain`; injectable for tests. May answer synchronously or * asynchronously; the default runner is asynchronous so the footer never blocks rendering. */ export type GitPorcelainRunner = (repoDir: string) => string | null | Promise; /** * Dirty-state lookup with a 2 second TTL cache, called from the footer render path. * * With an asynchronous runner (the default), isDirty() never blocks: it returns the last known * value (null before the first answer) and refreshes it in the background, at most one git * process per repository at a time; `onUpdate` fires when a refresh changes the answer so the * caller can re-render. The previous implementation ran a synchronous `git status` on the render * path every 2 seconds, freezing the TUI on large repositories and on Windows. * Returns null when git is unavailable or the path is not a repo. */ export declare class GitDirtyCache { private static readonly TTL_MS; private cache; /** Token of the refresh in flight per repository; invalidate() drops it so a stale answer is ignored. */ private inFlight; private nextRefreshToken; private runner; private now; private onUpdate; constructor(runner?: GitPorcelainRunner, now?: () => number, onUpdate?: () => void); isDirty(repoDir: string): boolean | null; invalidate(repoDir?: string): void; } //# sourceMappingURL=status-segments.d.ts.map