File
Blob: worker/src/shared/contracts/hardware.ts
| 1 | import { z } from 'zod'; |
| 2 | |
| 3 | const bytes = z.number().int().nonnegative(); |
| 4 | const memorySchema = z.object({ free: bytes, minimumFree: bytes, largestBlock: bytes }); |
| 5 | const busy = z.number().int().min(0).max(10000).nullable(); |
| 6 | |
| 7 | export 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 | |
| 17 | export type Hardware = z.infer<typeof hardwareSchema>; |