import type { SessionSummary } from './scan.js'; import type { UsageSnapshot } from '../shared/types.js'; /** How many months of history the activity heatmap covers. */ export declare const HEATMAP_MONTHS = 12; /** * Format an epoch millisecond instant as `YYYY-MM-DD` in a zone. * @param timeMs - Epoch milliseconds. * @param timeZone - IANA zone name. * @returns The local date key. */ export declare function dayKeyInZone(timeMs: number, timeZone: string): string; /** * The heatmap window: roughly the last year, trimmed to a whole even number of * weeks. * * Both ends are what the panel needs rather than what the calendar offers, and * the panel draws this window as **two stacked half-year blocks**: * * - It starts on a **Sunday**, because a contribution column is a week, so a * window starting mid-week would put a partial week in column 0. * - It spans an **even** number of weeks. The panel splits the columns in half, * and an odd count cannot be halved — one block would come out a column * short and the two rows would end at different x positions, which reads as a * table missing a column. Trimming up to six days off the start is invisible * next to a year of history and is the only way both rows can be equal. * * The trim only ever moves the start later, so the window is never longer than * requested and never reaches past `todayKey`. * @param todayKey - Today's key, the last day the window covers. * @returns Inclusive `{ from, to }` day keys. */ export declare function heatmapWindow(todayKey: string): { from: string; to: string; }; /** * Compute the current activity streak, in consecutive local days. * * A streak is counted back from today, or from yesterday when today has no * activity yet — a day still in progress is not a broken streak. * @param activeDays - Set of `YYYY-MM-DD` keys with any activity. * @param todayKey - Today's key. * @returns `{ current, longest }` in days. */ export declare function computeStreaks(activeDays: ReadonlySet, todayKey: string): { current: number; longest: number; }; /** Inputs for {@link buildSnapshot}. */ export interface AggregateInput { /** Every session summary read from disk. */ summaries: readonly SessionSummary[]; /** IANA zone the day keys were built in. */ timeZone: string; /** Absolute `$DSH_HOME`. */ home: string; /** Today's `YYYY-MM-DD` key in `timeZone`. */ todayKey: string; /** Session id the browser has open, highlighted in the list. */ currentSession?: string; /** Non-fatal read problems carried through from the scan. */ warnings: string[]; /** Wall-clock milliseconds the scan took. */ elapsedMs: number; /** How many sessions to return in the list. */ sessionLimit?: number; /** Resolved account identity, when the harness has one. */ identity?: UsageSnapshot['identity']; } /** * Build the panel's complete snapshot. * @param input - Summaries plus the environment facts. * @returns The wire snapshot. */ export declare function buildSnapshot(input: AggregateInput): UsageSnapshot;