import { z } from "zod"; import { StageKey } from "./run.js"; export const EventLevel = z.enum(["debug", "info", "warn", "error"]); /** Structured run event. Workers emit these; the control plane persists them with a monotonically increasing seq. */ export const RunEvent = z.object({ kind: z.string().min(1).max(64), level: EventLevel.default("info"), stage: StageKey.optional(), message: z.string().max(4000), data: z.record(z.string(), z.unknown()).optional(), at: z.string().datetime(), }); export type RunEvent = z.infer; export type RunEventInput = z.input; export const PersistedRunEvent = RunEvent.extend({ seq: z.number().int(), runId: z.string().uuid(), attemptId: z.string().uuid().nullable(), workerId: z.string().uuid().nullable(), }); export type PersistedRunEvent = z.infer;