Repository Public
1/**2 * Sheet Document Schema — version 1.3 *4 * The single contract between the AI pipeline, the editor, the renderer, the exporters and the database.5 * It is pure data: no HTML, no script, no CSS. Everything a sheet can show is one of the block types below,6 * rendered by a component registered in src/renderer. Anything outside this schema is rejected on the server.7 *8 * This module has no dependency on React, Next.js or the database.9 */10import { z } from "zod";1112export const SCHEMA_VERSION = 1 as const;13export const AUTHOR = "Simon-Pierre Boucher" as const;1415// ── Shared vocabulary ───────────────────────────────────────────────────────────────────────────────1617/** Stable identifiers: lower-case letters, digits, dashes. Generated by newId() or written by hand in templates. */18export const Id = z.string().regex(/^[a-z0-9][a-z0-9-]{0,47}$/, "id: a-z, 0-9 and dashes, 1–48 characters");1920/** Semantic colours. The theme decides the actual values; documents never carry hex codes. */21export const TONES = ["neutral", "blue", "teal", "green", "amber", "red", "violet", "pink"] as const;22export const Tone = z.enum(TONES);23export type Tone = z.infer<typeof Tone>;2425/** Icons come from a fixed set drawn in src/renderer/icons.tsx. */26export const ICONS = [27 "brain", "layers", "route", "database", "server", "cpu", "cloud", "network", "search", "filter", "document", "code",28 "chart", "trend", "sigma", "function", "clock", "bolt", "lock", "key", "shield", "users", "user", "globe", "flask",29 "atom", "book", "target", "check", "cross", "warning", "info", "scale", "coins", "bank", "cube", "gear", "arrows",30 "split", "merge", "token", "memory", "queue", "table", "eye", "sparkles", "puzzle", "microscope", "calculator", "link",31] as const;32export const Icon = z.enum(ICONS);33export type Icon = z.infer<typeof Icon>;3435/**36 * Inline text. A small Markdown subset is interpreted by the renderer and nothing else:37 * **bold** *italic* `code` $inline LaTeX$ [label](https://…) [^source-id]38 * Raw HTML is shown as text, never interpreted.39 */40const Inline = (max: number) => z.string().max(max);41const Short = Inline(200);42const Text = Inline(4000);4344/** Only https links (and mailto) may appear in a document. */45export const SafeUrl = z.string().max(2000).refine((u) => {46 try { const p = new URL(u); return p.protocol === "https:" || p.protocol === "mailto:"; } catch { return false; }47}, "URL must be https:// or mailto:");4849export const LOCALES = ["fr", "en"] as const;50export const Locale = z.enum(LOCALES);51export type Locale = z.infer<typeof Locale>;5253export const LEVELS = ["beginner", "intermediate", "advanced"] as const;54export const KINDS = ["explainer", "cheatsheet", "comparison", "architecture", "method", "case-study"] as const;55export const THEMES = ["scientific-light", "scientific-dark", "editorial", "blueprint", "finance"] as const;56export const FORMATS = ["article", "a4", "slide-16-9", "square", "portrait-4-5"] as const;57export type Format = (typeof FORMATS)[number];5859/** Pixel size of the fixed formats (CSS px). `article` is fluid and has no fixed height. */60export const FORMAT_SIZES: Record<Format, { width: number; height: number | null; safeMargin: number }> = {61 article: { width: 1120, height: null, safeMargin: 24 },62 a4: { width: 794, height: 1123, safeMargin: 48 },63 "slide-16-9": { width: 1600, height: 900, safeMargin: 56 },64 square: { width: 1080, height: 1080, safeMargin: 48 },65 "portrait-4-5": { width: 1080, height: 1350, safeMargin: 48 },66};6768// ── Sources and evidence ────────────────────────────────────────────────────────────────────────────6970/**71 * How far a source has been checked.72 * - unverified : written by the model or typed by hand, never checked against anything73 * - resolved : the DOI or URL was fetched by the server and the record exists (title matched for DOIs)74 * - reviewed : the administrator confirmed the reference by hand75 * - unreachable: the server tried and could not reach it76 */77export const SOURCE_STATUS = ["unverified", "resolved", "reviewed", "unreachable"] as const;78export const SourceSchema = z.object({79 id: Id,80 type: z.enum(["article", "book", "preprint", "documentation", "dataset", "web", "report", "upload"]),81 title: Inline(400).min(1),82 authors: z.array(Inline(120)).max(30).default([]),83 year: z.number().int().min(1500).max(2100).optional(),84 container: Inline(300).optional(),85 doi: z.string().max(200).regex(/^10\.\d{4,9}\/\S+$/, "DOI must look like 10.xxxx/…").optional(),86 url: SafeUrl.optional(),87 license: Inline(120).optional(),88 note: Inline(600).optional(),89 status: z.enum(SOURCE_STATUS).default("unverified"),90 checkedAt: z.string().datetime().optional(),91}).strict();92export type Source = z.infer<typeof SourceSchema>;9394/** An assertion the sheet makes, and what it rests on. `derived` = follows from sourced material by a stated argument. */95export const ClaimSchema = z.object({96 id: Id,97 text: Inline(600).min(1),98 status: z.enum(["sourced", "derived", "unverified"]),99 sourceIds: z.array(Id).max(12).default([]),100 blockId: Id.optional(),101}).strict();102export type Claim = z.infer<typeof ClaimSchema>;103104export const AssetRefSchema = z.object({105 id: Id,106 kind: z.enum(["image", "dataset"]),107 /** Row of the `assets` table. */108 assetId: z.string().uuid(),109 alt: Inline(400).default(""),110 credit: Inline(300).optional(),111}).strict();112export type AssetRef = z.infer<typeof AssetRefSchema>;113114// ── Blocks ──────────────────────────────────────────────────────────────────────────────────────────115116/** Width on the 12-column desktop grid. Below 768 px every block takes the full width, in document order. */117export const SPANS = [3, 4, 6, 8, 12] as const;118const base = {119 id: Id,120 /** Desktop column span. */121 span: z.union([z.literal(3), z.literal(4), z.literal(6), z.literal(8), z.literal(12)]).default(12),122 /** Text alternative for visual blocks (required by the quality report on diagram, chart, svg, image, matrix, simulation). */123 alt: Inline(600).optional(),124 sourceIds: z.array(Id).max(12).optional(),125 /** Locked blocks cannot be moved or deleted in the editor and are never touched by AI edits. */126 locked: z.boolean().optional(),127};128129const Heading = z.object({ ...base, type: z.literal("heading"), level: z.union([z.literal(1), z.literal(2), z.literal(3)]), text: Short.min(1), eyebrow: Inline(80).optional() }).strict();130const Paragraph = z.object({ ...base, type: z.literal("paragraph"), text: Text.min(1), lead: z.boolean().optional() }).strict();131const List = z.object({ ...base, type: z.literal("list"), style: z.enum(["bullet", "number", "check"]), items: z.array(Inline(800).min(1)).min(1).max(30) }).strict();132133const Equation = z.object({134 ...base, type: z.literal("equation"),135 /** Display LaTeX, KaTeX subset. Checked syntactically on the server. */136 latex: z.string().min(1).max(2000),137 label: Inline(80).optional(),138 explanation: Inline(1200).optional(),139 variables: z.array(z.object({ symbol: z.string().min(1).max(120), meaning: Inline(300).min(1), unit: Inline(60).optional() }).strict()).max(20).optional(),140 /** standard: textbook result · derived: derived in the sheet (shown as such) · unverified: flagged to the reader. */141 derivation: z.enum(["standard", "derived", "unverified"]).default("standard"),142}).strict();143144const Callout = z.object({145 ...base, type: z.literal("callout"),146 tone: z.enum(["note", "tip", "warning", "definition", "theorem", "example", "assumption"]),147 title: Short.optional(), text: Text.min(1),148}).strict();149150const Table = z.object({151 ...base, type: z.literal("table"),152 caption: Inline(300).optional(),153 columns: z.array(z.object({ label: Short, align: z.enum(["left", "right", "center"]).default("left") }).strict()).min(1).max(8),154 rows: z.array(z.array(Inline(600)).max(8)).min(1).max(40),155 headerColumn: z.boolean().optional(),156}).strict().refine((t) => t.rows.every((r) => r.length === t.columns.length), "every row must have one cell per column");157158const Cards = z.object({159 ...base, type: z.literal("cards"),160 columns: z.union([z.literal(2), z.literal(3), z.literal(4)]).default(3),161 items: z.array(z.object({ icon: Icon.optional(), title: Short.min(1), text: Inline(800), tone: Tone.default("neutral"), badge: Inline(40).optional() }).strict()).min(1).max(12),162}).strict();163164const Steps = z.object({165 ...base, type: z.literal("steps"),166 items: z.array(z.object({ title: Short.min(1), text: Inline(800), icon: Icon.optional() }).strict()).min(1).max(12),167}).strict();168169const Legend = z.object({170 ...base, type: z.literal("legend"),171 title: Short.optional(),172 items: z.array(z.object({ label: Short.min(1), tone: Tone, shape: z.enum(["square", "circle", "line", "dashed", "arrow"]).default("square") }).strict()).min(1).max(12),173}).strict();174175// Diagrams: nodes, ports, edges, groups. Positions are computed by the layout engine unless a node carries x/y.176export const NODE_SHAPES = ["rect", "round", "pill", "diamond", "cylinder", "circle", "hexagon", "note"] as const;177const Port = z.enum(["auto", "top", "right", "bottom", "left"]);178export const DiagramNode = z.object({179 id: Id, label: Inline(80).min(1), sublabel: Inline(120).optional(),180 shape: z.enum(NODE_SHAPES).default("round"), tone: Tone.default("neutral"), icon: Icon.optional(),181 group: Id.optional(),182 /** Manual position (centre of the node, diagram units). Both or neither. */183 x: z.number().finite().min(-20000).max(20000).optional(), y: z.number().finite().min(-20000).max(20000).optional(),184 locked: z.boolean().optional(),185}).strict();186export const DiagramEdge = z.object({187 id: Id, from: Id, to: Id, label: Inline(80).optional(),188 style: z.enum(["solid", "dashed", "dotted"]).default("solid"),189 arrow: z.enum(["end", "both", "none"]).default("end"),190 tone: Tone.default("neutral"),191 fromPort: Port.default("auto"), toPort: Port.default("auto"),192}).strict();193const Diagram = z.object({194 ...base, type: z.literal("diagram"),195 kind: z.enum(["flow", "architecture", "tree", "graph"]).default("flow"),196 direction: z.enum(["TB", "LR"]).default("TB"),197 routing: z.enum(["orthogonal", "curved", "straight"]).default("curved"),198 title: Short.optional(), caption: Inline(400).optional(),199 nodes: z.array(DiagramNode).min(1).max(60),200 edges: z.array(DiagramEdge).max(120).default([]),201 groups: z.array(z.object({ id: Id, label: Inline(80), tone: Tone.default("neutral") }).strict()).max(12).default([]),202 /** What the arrows and colours mean. Required by the quality report when the diagram has edges. */203 legend: z.array(z.object({ label: Short.min(1), tone: Tone, shape: z.enum(["square", "circle", "line", "dashed", "arrow"]).default("square") }).strict()).max(8).default([]),204 /** Step-by-step walkthrough: each step highlights nodes and edges. Played, paused and stepped by the reader. */205 animation: z.object({206 steps: z.array(z.object({ title: Short.min(1), text: Inline(600).optional(), nodes: z.array(Id).max(60).default([]), edges: z.array(Id).max(120).default([]) }).strict()).min(2).max(20),207 }).strict().optional(),208}).strict().superRefine((d, ctx) => {209 const ids = new Set<string>();210 for (const n of d.nodes) { if (ids.has(n.id)) ctx.addIssue({ code: "custom", message: `duplicate node id ${n.id}` }); ids.add(n.id); }211 const groups = new Set(d.groups.map((g) => g.id));212 for (const n of d.nodes) {213 if (n.group && !groups.has(n.group)) ctx.addIssue({ code: "custom", message: `node ${n.id}: unknown group ${n.group}` });214 if ((n.x === undefined) !== (n.y === undefined)) ctx.addIssue({ code: "custom", message: `node ${n.id}: x and y go together` });215 }216 const eids = new Set<string>();217 for (const e of d.edges) {218 if (eids.has(e.id)) ctx.addIssue({ code: "custom", message: `duplicate edge id ${e.id}` }); eids.add(e.id);219 if (!ids.has(e.from) || !ids.has(e.to)) ctx.addIssue({ code: "custom", message: `edge ${e.id}: unknown endpoint` });220 }221 for (const s of d.animation?.steps ?? []) {222 for (const n of s.nodes) if (!ids.has(n)) ctx.addIssue({ code: "custom", message: `animation: unknown node ${n}` });223 for (const e of s.edges) if (!eids.has(e)) ctx.addIssue({ code: "custom", message: `animation: unknown edge ${e}` });224 }225});226227const Timeline = z.object({228 ...base, type: z.literal("timeline"),229 orientation: z.enum(["vertical", "horizontal"]).default("vertical"),230 items: z.array(z.object({ when: Inline(60).min(1), title: Short.min(1), text: Inline(600).optional(), tone: Tone.default("neutral") }).strict()).min(2).max(20),231}).strict();232233/**234 * Nature of the numbers shown. The renderer prints it on every chart, matrix and simulation.235 * - empirical : real observations; at least one source is required236 * - synthetic : generated by a stated process (simulation, random draw with a seed)237 * - illustrative: hand-chosen values that show a shape, not a measurement238 */239export const DATA_KINDS = ["empirical", "synthetic", "illustrative"] as const;240const DataKind = z.enum(DATA_KINDS);241242const Matrix = z.object({243 ...base, type: z.literal("matrix"),244 title: Short.optional(), caption: Inline(400).optional(),245 rowLabels: z.array(Inline(60)).min(1).max(16), colLabels: z.array(Inline(60)).min(1).max(16),246 values: z.array(z.array(z.number().finite()).max(16)).min(1).max(16),247 scale: z.enum(["sequential", "diverging", "none"]).default("sequential"),248 showValues: z.boolean().default(true), decimals: z.number().int().min(0).max(4).default(2),249 dataKind: DataKind,250}).strict().refine((m) => m.values.length === m.rowLabels.length && m.values.every((r) => r.length === m.colLabels.length), "values must be rowLabels × colLabels");251252const Code = z.object({253 ...base, type: z.literal("code"),254 language: z.enum(["python", "typescript", "javascript", "r", "sql", "bash", "json", "yaml", "latex", "julia", "rust", "go", "c", "pseudo", "text"]),255 code: z.string().min(1).max(6000), caption: Inline(300).optional(),256}).strict();257258const Axis = z.object({ label: Short.min(1), unit: Inline(40).optional(), scale: z.enum(["linear", "log"]).default("linear"), min: z.number().finite().optional(), max: z.number().finite().optional() }).strict();259const Chart = z.object({260 ...base, type: z.literal("chart"),261 kind: z.enum(["line", "area", "bar", "scatter", "histogram"]),262 title: Short.optional(), caption: Inline(400).optional(),263 dataKind: DataKind,264 x: Axis.extend({ type: z.enum(["number", "category"]).default("number") }).strict(), y: Axis,265 series: z.array(z.object({266 name: Short.min(1), tone: Tone.default("blue"),267 /** x is a number on a numeric axis, a label on a category axis. lo/hi draw an interval band or error bar. */268 points: z.array(z.object({ x: z.union([z.number().finite(), Inline(60)]), y: z.number().finite(), lo: z.number().finite().optional(), hi: z.number().finite().optional() }).strict()).min(1).max(600),269 }).strict()).min(1).max(8),270 annotations: z.array(z.object({ x: z.union([z.number().finite(), Inline(60)]).optional(), y: z.number().finite().optional(), label: Inline(120).min(1) }).strict()).max(8).optional(),271 /** Rows come from an uploaded dataset (assets[].id of kind dataset) rather than being typed in. */272 datasetRef: Id.optional(),273}).strict();274275/** A sanitised SVG illustration, stored as a tree of whitelisted elements — never as markup. */276export const SVG_TAGS = ["svg", "g", "path", "rect", "circle", "ellipse", "line", "polyline", "polygon", "text", "tspan", "defs", "linearGradient", "radialGradient", "stop", "clipPath", "title", "desc"] as const;277export interface SvgNode { tag: (typeof SVG_TAGS)[number]; attrs: Record<string, string>; children: (SvgNode | string)[] }278export const SvgNodeSchema: z.ZodType<SvgNode> = z.lazy(() => z.object({279 tag: z.enum(SVG_TAGS),280 attrs: z.record(z.string().regex(/^[a-zA-Z][a-zA-Z0-9:-]{0,40}$/), z.string().max(20000)),281 children: z.array(z.union([SvgNodeSchema, z.string().max(2000)])).max(400),282}).strict());283const Svg = z.object({ ...base, type: z.literal("svg"), tree: SvgNodeSchema, caption: Inline(400).optional(), maxWidth: z.number().int().min(80).max(1120).optional() }).strict();284285const Image = z.object({ ...base, type: z.literal("image"), assetRef: Id, caption: Inline(400).optional(), maxWidth: z.number().int().min(80).max(1120).optional() }).strict();286287const Comparison = z.object({288 ...base, type: z.literal("comparison"),289 caption: Inline(300).optional(),290 columns: z.array(z.object({ title: Short.min(1), tone: Tone.default("neutral"), badge: Inline(40).optional() }).strict()).min(2).max(4),291 rows: z.array(z.object({ label: Short.min(1), cells: z.array(Inline(600)).min(2).max(4) }).strict()).min(1).max(16),292 verdict: Inline(800).optional(),293}).strict().refine((c) => c.rows.every((r) => r.cells.length === c.columns.length), "every row must have one cell per column");294295const Accordion = z.object({ ...base, type: z.literal("accordion"), items: z.array(z.object({ title: Short.min(1), text: Text.min(1) }).strict()).min(1).max(12) }).strict();296297const Quiz = z.object({298 ...base, type: z.literal("quiz"),299 question: Inline(600).min(1),300 choices: z.array(z.object({ text: Inline(400).min(1), correct: z.boolean(), explanation: Inline(600).optional() }).strict()).min(2).max(6),301}).strict().refine((q) => q.choices.some((c) => c.correct), "a quiz needs at least one correct choice");302303/**304 * Interactive simulations are pre-approved components (src/sim). A document only picks one and sets its305 * parameters; bounds are enforced against the registry. `function-plot` takes expressions in `config`.306 */307export const SIM_KINDS = [308 "moe-routing", "neural-forward", "kv-cache", "attention", "distribution", "confidence-interval", "regression",309 "correlation", "garch", "random-walk", "impulse-response", "event-study", "function-plot",310] as const;311export type SimKind = (typeof SIM_KINDS)[number];312const Simulation = z.object({313 ...base, type: z.literal("simulation"),314 kind: z.enum(SIM_KINDS),315 title: Short.optional(), caption: Inline(400).optional(),316 /** Initial parameter values. Keys and bounds are defined by the simulation; out-of-range values are clamped. */317 params: z.record(z.string().regex(/^[a-zA-Z][a-zA-Z0-9]{0,23}$/), z.number().finite()).default({}),318 /** Seed of the deterministic random generator: the same seed and parameters always draw the same picture. */319 seed: z.number().int().min(0).max(2 ** 31 - 1).default(1),320 /** Kind-specific options (strings and numbers only), validated by the simulation itself. */321 config: z.record(z.string().regex(/^[a-zA-Z][a-zA-Z0-9]{0,23}$/), z.union([z.string().max(300), z.number().finite(), z.boolean()])).default({}),322}).strict();323324const References = z.object({ ...base, type: z.literal("references"), title: Short.optional() }).strict();325const Divider = z.object({ ...base, type: z.literal("divider") }).strict();326327/** Blocks that can sit inside a tab. Tabs do not nest. */328const leafBlocks = [Heading, Paragraph, List, Equation, Callout, Table, Cards, Steps, Legend, Diagram, Timeline, Matrix, Code, Chart, Svg, Image, Comparison, Accordion, Quiz, Simulation, References, Divider] as const;329export const LeafBlockSchema = z.discriminatedUnion("type", leafBlocks);330export type LeafBlock = z.infer<typeof LeafBlockSchema>;331332const Tabs = z.object({333 ...base, type: z.literal("tabs"),334 tabs: z.array(z.object({ id: Id, label: Inline(60).min(1), blocks: z.array(LeafBlockSchema).min(1).max(12) }).strict()).min(2).max(6),335}).strict();336337export const BlockSchema = z.discriminatedUnion("type", [...leafBlocks, Tabs]);338export type Block = z.infer<typeof BlockSchema>;339export type BlockType = Block["type"];340export type BlockOf<T extends BlockType> = Extract<Block, { type: T }>;341export const BLOCK_TYPES = BlockSchema.options.map((o) => o.shape.type.value) as BlockType[];342343// ── Document ────────────────────────────────────────────────────────────────────────────────────────344345export const MetadataSchema = z.object({346 title: Inline(160).min(1),347 /** Proposed slug; the published slug lives on the sheet row and is checked for uniqueness there. */348 slug: z.string().regex(/^[a-z0-9]+(?:-[a-z0-9]+)*$/).max(96).optional(),349 author: z.literal(AUTHOR).default(AUTHOR),350 locale: Locale,351 summary: Inline(400).default(""),352 topics: z.array(Inline(60).min(1)).max(6).default([]),353 tags: z.array(Inline(40).min(1)).max(12).default([]),354 level: z.enum(LEVELS).default("intermediate"),355 kind: z.enum(KINDS).default("explainer"),356 /** What the reader should be able to do after reading. */357 objectives: z.array(Inline(300).min(1)).max(6).default([]),358 /** True while the sheet is a demonstration that has not been reviewed by the author; shown as a banner. */359 example: z.boolean().optional(),360}).strict();361362export const SheetSchema = z.object({363 schemaVersion: z.literal(SCHEMA_VERSION),364 metadata: MetadataSchema,365 theme: z.object({ preset: z.enum(THEMES).default("scientific-light"), accent: Tone.default("blue") }).strict().default({ preset: "scientific-light", accent: "blue" }),366 layout: z.object({ type: z.literal("responsive-document").default("responsive-document"), format: z.enum(FORMATS).default("article"), maxWidth: z.number().int().min(640).max(1440).default(1120) }).strict()367 .default({ type: "responsive-document", format: "article", maxWidth: 1120 }),368 blocks: z.array(BlockSchema).max(80),369 sources: z.array(SourceSchema).max(60).default([]),370 claims: z.array(ClaimSchema).max(60).default([]),371 assets: z.array(AssetRefSchema).max(40).default([]),372 /** Reserved for cross-block bindings in a later schema version. Interactivity in v1 lives inside blocks. */373 interactions: z.array(z.never()).max(0).default([]),374}).strict().superRefine((doc, ctx) => {375 // Identifiers are unique across the whole document, tabs included, so a patch can address any block.376 const seen = new Set<string>();377 const visit = (b: { id: string }, path: (string | number)[]) => { if (seen.has(b.id)) ctx.addIssue({ code: "custom", message: `duplicate block id ${b.id}`, path }); seen.add(b.id); };378 doc.blocks.forEach((b, i) => { visit(b, ["blocks", i]); if (b.type === "tabs") b.tabs.forEach((t, j) => t.blocks.forEach((c, k) => visit(c, ["blocks", i, "tabs", j, "blocks", k]))); });379 const sources = new Set<string>();380 doc.sources.forEach((s, i) => { if (sources.has(s.id)) ctx.addIssue({ code: "custom", message: `duplicate source id ${s.id}`, path: ["sources", i] }); sources.add(s.id); });381 const assets = new Set(doc.assets.map((a) => a.id));382 const check = (b: Block | LeafBlock, path: (string | number)[]) => {383 for (const s of b.sourceIds ?? []) if (!sources.has(s)) ctx.addIssue({ code: "custom", message: `block ${b.id}: unknown source ${s}`, path });384 if (b.type === "image" && !assets.has(b.assetRef)) ctx.addIssue({ code: "custom", message: `block ${b.id}: unknown asset ${b.assetRef}`, path });385 if (b.type === "chart" && b.datasetRef && !assets.has(b.datasetRef)) ctx.addIssue({ code: "custom", message: `block ${b.id}: unknown dataset ${b.datasetRef}`, path });386 };387 doc.blocks.forEach((b, i) => { check(b, ["blocks", i]); if (b.type === "tabs") b.tabs.forEach((t) => t.blocks.forEach((c) => check(c, ["blocks", i]))); });388 doc.claims.forEach((c, i) => {389 for (const s of c.sourceIds) if (!sources.has(s)) ctx.addIssue({ code: "custom", message: `claim ${c.id}: unknown source ${s}`, path: ["claims", i] });390 if (c.blockId && !seen.has(c.blockId)) ctx.addIssue({ code: "custom", message: `claim ${c.id}: unknown block ${c.blockId}`, path: ["claims", i] });391 });392});393394/** A validated document: every default is filled in. */395export type Sheet = z.infer<typeof SheetSchema>;396/** What may be written by hand or by the model: defaults may be omitted. */397export type SheetInput = z.input<typeof SheetSchema>;398export type Metadata = z.infer<typeof MetadataSchema>;399