import type { ConfigField, SysInfo, WidgetStats } from '../../lib/contract/types'; /** * dsh-widgets — Machine/system (SysInfo) shared render layer (widget-family * shared). The five system widgets (sys-cpu / sys-gpu / sys-rings / sys-board * / sys-gpu-line) share the snapshot resolution, the refresh-interval config * schema, the big-figure cycle and the formatting helpers. They live here — * NOT copied into each unit — so the family stays consistent and a new system * widget imports the same machinery. * * All strings come from the per-widget dictionaries (merged by the registry * generator from each unit's manifest; family-shared keys live in * `src/widgets/_shared/locales.json`), so these factories never hard-code text. */ /** Read the machine snapshot from the stats passed to a widget render. */ export declare function sysInfo(stats: WidgetStats): SysInfo | null; /** * Utilization samples ready to plot. * * A `null` in the host history means "the driver did not answer this poll" (the * host's nvidia-smi query has a 3s timeout), NOT "0 %". The chart's x axis is * sample ORDER, so a hole used to be drawn as a break: measured on the live * 利用率 card 2026-09-20 — `history.gpu` held 26 nulls against 0 in * `history.cpu`, and the card rendered TWO polylines (15 + 3 points), which is * exactly the dashed, "cut off" sparkline the user reported while their GPU sat * completely idle at 0 %. * * So a short miss carries the last known value forward (the poll window IS the * averaging window, and the previous reading is the best estimate for a * utilization graph — Windows' own graph does the same). A LONG run (more than * CHART_GAP_MAX samples, i.e. a device that really went away) still breaks the * line, and the card's own no-GPU state reports that case in words. Leading * nulls (before the first reading) are dropped rather than fabricated. */ export declare function plotSamples(vals: Array): Array; /** Feed one successful snapshot into the client-side fallback history. */ export declare function ingestSysInfo(s: SysInfo): void; /** Resolve the sparkline history: host history when present (longer, survives * reloads), else the client-side accumulated fallback (works pre-restart). */ export declare function historyOf(s: SysInfo): { ts: number[]; gpu: Array; } | null; /** Per-widget refresh-interval schema: 5/10/30/60 s presets + a custom numeric * field (used when the preset is `custom`). The collector applies the SHORTEST * effective interval among installed sys-* instances (clamped 5..60 s). */ export declare function intervalSchema(): ConfigField[]; /** Max samples shown by the sparkline (10–30, default 20): the host buffer can * hold 120 points — drawing all of them into a 2×2 card would squash the line * into an unreadable blob. The dropdown keeps the window explicit. */ export declare const SPARK_POINTS_OPTS: Array<[string, string]>; /** Effective sparkline sample window from a per-instance config (10..30). */ export declare function resolveSparkPoints(config: Record | undefined): number; /** Effective refresh seconds from a per-instance config: preset value or the * custom numeric; clamped to 5..60, falling back to 10 on anything invalid. */ export declare function resolveInterval(config: Record | undefined): number; /** Big-figure selectors. GPU: VRAM / temperature / utilization; CPU: the * utilization / used memory. The selection drives BOTH the whole-card click * cycle (store: 'bigMetric') and the config dropdown (same key). */ export declare const GPU_METRIC_OPTS: Array<[string, string | (() => string)]>; export declare const CPU_METRIC_OPTS: Array<[string, string | (() => string)]>; /** Config dropdown for the big-figure mode (per-widget option lists). */ export declare function bigMetricSchema(opts: Array<[string, string | (() => string)]>): ConfigField; /** Cycle hint: "VRAM (GB) → Temp (°C) → Utilization (%) → …" closing the loop. */ export declare function bigHint(opts: Array<[string, string | (() => string)]>): string; /** GPU big-figure options for the widget descriptors. */ export declare function gpuMetricOptions(): Array<[string, string | (() => string)]>; /** CPU big-figure options for the widget descriptors. */ export declare function cpuMetricOptions(): Array<[string, string | (() => string)]>; /** Read an instance's bigMetric mode, falling back to the option-list default. */ export declare function bigMetricOf(stats: WidgetStats, opts: Array<[string, string | (() => string)]>): string;