Skip to content
File

Blob: worker/src/shared/contracts/hardware.ts

typescript18 lines
1import { z } from 'zod';
2 
3const bytes = z.number().int().nonnegative();
4const memorySchema = z.object({ free: bytes, minimumFree: bytes, largestBlock: bytes });
5const busy = z.number().int().min(0).max(10000).nullable();
6 
7export const hardwareSchema = z.object({
8 sampledAtMs: z.number().int().nonnegative(),
9 cpuBusyBps: z.tuple([busy, busy]),
10 chipTemperatureMc: z.number().int().min(-10000).max(80000).nullable(),
11 internal: memorySchema,
12 psram: memorySchema,
13 sampleCostUs: bytes,
14 samplerStackFree: bytes,
15});
16 
17export type Hardware = z.infer<typeof hardwareSchema>;