spb/autoscholar
Public
1import { z } from "zod";2import { StageKey } from "./run.js";34export const EventLevel = z.enum(["debug", "info", "warn", "error"]);56/** Structured run event. Workers emit these; the control plane persists them with a monotonically increasing seq. */7export const RunEvent = z.object({8 kind: z.string().min(1).max(64),9 level: EventLevel.default("info"),10 stage: StageKey.optional(),11 message: z.string().max(4000),12 data: z.record(z.string(), z.unknown()).optional(),13 at: z.string().datetime(),14});15export type RunEvent = z.infer<typeof RunEvent>;16export type RunEventInput = z.input<typeof RunEvent>;1718export const PersistedRunEvent = RunEvent.extend({19 seq: z.number().int(),20 runId: z.string().uuid(),21 attemptId: z.string().uuid().nullable(),22 workerId: z.string().uuid().nullable(),23});24export type PersistedRunEvent = z.infer<typeof PersistedRunEvent>;25