feat: make each plugin an npm workspace built by a termix-plugin CLI

This commit is contained in:
LukeGus committed 2026-09-22 15:09:50 -05:00
1 parent 4758016f41
commit 5796186a1c
448 files changed
+3087 -2003

No files matched your search

@@ -0,0 +1,24 @@
import type { ServerMetrics } from "@/main-axios";
/**
* Coarse fingerprint of a metrics poll. Adaptive polling backs off while it
* stays the same, so it must move whenever something a card shows changes.
*/
export function metricsChangeKey(data: ServerMetrics): string {
const bucket = (value: number | null | undefined) =>
value == null ? null : Math.round(value / 5) * 5;
return JSON.stringify({
cpu: bucket(data.cpu.percent),
memory: bucket(data.memory.percent),
disk: bucket(data.disk.percent),
running: data.processes?.running ?? null,
ports: data.ports?.ports?.length ?? 0,
firewall: data.firewall?.status ?? null,
gpus:
data.gpu?.gpus?.map((gpu) => [
bucket(gpu.utilizationPercent),
bucket(gpu.memoryPercent),
]) ?? [],
gpuProcesses: data.gpu?.processes?.length ?? 0,
});
}