import type { CacheStats } from '@wrongstack/core/types'; import { type ContextBreakdown } from '@wrongstack/core/utils'; import type { AppProps } from '../app-props.js'; import type { FleetEntry, State } from '../app-state.js'; import type { StatuslineItem } from '../components/statusline-picker.js'; import type { TokenRefreshData } from './use-token-counter-refresh.js'; interface StatusbarViewModelOptions { agent: AppProps['agent']; tokenCounter: AppProps['tokenCounter']; activeMaxContext: number | undefined; effectiveMaxContext: number | undefined; liveProvider: string; liveModel: string; liveTodos: readonly { status: string; }[]; sidebarVisible?: boolean | undefined; state: State; /** * Statusline hidden items. The plan/task chips are the only consumers of * the 3s `fs.stat` polls in this hook — when the corresponding chip is * user-hidden, skip the poll entirely until it is visible again. */ hiddenItems?: readonly StatuslineItem[] | undefined; /** * Live token-counter refresh snapshot — supplies per-request * `currentRequestTokens` plus cumulative `cacheStats`. When omitted the * view model falls back to reading the counter directly so existing * callers stay correct (the older path was a render-time poll of * mutable counters and lagged async provider responses). * * Typed as the exact `TokenRefreshData` shape so callers passing the * hook's return value stay assignable under `exactOptionalPropertyTypes`. */ tokenRefresh?: TokenRefreshData; } interface PlanCounts { open: number; inProgress: number; done: number; } interface TaskCounts { pending: number; inProgress: number; completed: number; blocked: number; failed: number; } /** Builds status-bar projections without coupling them to the root App render. */ export declare function useStatusbarViewModel({ agent, tokenCounter, activeMaxContext, effectiveMaxContext, liveProvider, liveModel, liveTodos, sidebarVisible, state, hiddenItems, tokenRefresh, }: StatusbarViewModelOptions): { contextBreakdown: ContextBreakdown | undefined; currentContextTokens: number; contextWindow: { used: number; max: number; } | undefined; cacheStats: CacheStats; /** * "Cache coverage" — how far the cached prefix reaches through the live * request, expressed in tokens. Computed from the per-request * `cacheRead` snapshot (the cached prefix of the current prompt) and * the measured `used` total. Capped at `used` so the figure never * overshoots the actual request size. Zero when no cache read was * reported on the latest request — the indicator stays hidden instead * of suggesting a meaningless 0. */ cacheCoverageTokens: number; todos: { pending: number; inProgress: number; completed: number; }; fleetCounts: { running: number; idle: number; pending: number; completed: number; } | undefined; visibleSubagentCount: number; hasVisibleFleetPanel: boolean; entriesWithLeader: Record; planCounts: PlanCounts | null; taskCounts: TaskCounts | null; droppedTools: number; }; export {}; //# sourceMappingURL=use-statusbar-view-model.d.ts.map