@abraca/schema 2.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (92) hide show
  1. package/dist/abracadabra-schema.cjs +853 -0
  2. package/dist/abracadabra-schema.cjs.map +1 -0
  3. package/dist/abracadabra-schema.esm.js +781 -0
  4. package/dist/abracadabra-schema.esm.js.map +1 -0
  5. package/dist/index.d.ts +2538 -0
  6. package/package.json +41 -0
  7. package/src/crdt.ts +63 -0
  8. package/src/generated/calendar.ts +35 -0
  9. package/src/generated/chart.ts +35 -0
  10. package/src/generated/checklist.ts +35 -0
  11. package/src/generated/dashboard.ts +35 -0
  12. package/src/generated/doc.ts +35 -0
  13. package/src/generated/gallery.ts +35 -0
  14. package/src/generated/graph.ts +35 -0
  15. package/src/generated/json-schema/calendar.json +140 -0
  16. package/src/generated/json-schema/chart.json +164 -0
  17. package/src/generated/json-schema/checklist.json +138 -0
  18. package/src/generated/json-schema/dashboard.json +122 -0
  19. package/src/generated/json-schema/doc.json +122 -0
  20. package/src/generated/json-schema/gallery.json +157 -0
  21. package/src/generated/json-schema/graph.json +125 -0
  22. package/src/generated/json-schema/kanban.json +145 -0
  23. package/src/generated/json-schema/map.json +125 -0
  24. package/src/generated/json-schema/outline.json +122 -0
  25. package/src/generated/json-schema/overview.json +122 -0
  26. package/src/generated/json-schema/plugin-manifest.json +221 -0
  27. package/src/generated/json-schema/prose.json +122 -0
  28. package/src/generated/json-schema/sheets.json +135 -0
  29. package/src/generated/json-schema/slides.json +129 -0
  30. package/src/generated/json-schema/table.json +136 -0
  31. package/src/generated/json-schema/timeline.json +122 -0
  32. package/src/generated/kanban.ts +35 -0
  33. package/src/generated/map.ts +35 -0
  34. package/src/generated/markdown/calendar.md +59 -0
  35. package/src/generated/markdown/chart.md +62 -0
  36. package/src/generated/markdown/checklist.md +58 -0
  37. package/src/generated/markdown/dashboard.md +56 -0
  38. package/src/generated/markdown/doc.md +56 -0
  39. package/src/generated/markdown/gallery.md +61 -0
  40. package/src/generated/markdown/graph.md +57 -0
  41. package/src/generated/markdown/kanban.md +62 -0
  42. package/src/generated/markdown/map.md +57 -0
  43. package/src/generated/markdown/outline.md +56 -0
  44. package/src/generated/markdown/overview.md +56 -0
  45. package/src/generated/markdown/prose.md +56 -0
  46. package/src/generated/markdown/sheets.md +59 -0
  47. package/src/generated/markdown/slides.md +57 -0
  48. package/src/generated/markdown/table.md +58 -0
  49. package/src/generated/markdown/timeline.md +56 -0
  50. package/src/generated/outline.ts +35 -0
  51. package/src/generated/overview.ts +35 -0
  52. package/src/generated/prose.ts +35 -0
  53. package/src/generated/rust/calendar.rs +125 -0
  54. package/src/generated/rust/chart.rs +151 -0
  55. package/src/generated/rust/checklist.rs +123 -0
  56. package/src/generated/rust/dashboard.rs +101 -0
  57. package/src/generated/rust/doc.rs +101 -0
  58. package/src/generated/rust/gallery.rs +146 -0
  59. package/src/generated/rust/graph.rs +104 -0
  60. package/src/generated/rust/kanban.rs +127 -0
  61. package/src/generated/rust/map.rs +104 -0
  62. package/src/generated/rust/outline.rs +101 -0
  63. package/src/generated/rust/overview.rs +101 -0
  64. package/src/generated/rust/prose.rs +101 -0
  65. package/src/generated/rust/sheets.rs +110 -0
  66. package/src/generated/rust/slides.rs +111 -0
  67. package/src/generated/rust/table.rs +121 -0
  68. package/src/generated/rust/timeline.rs +101 -0
  69. package/src/generated/sheets.ts +35 -0
  70. package/src/generated/slides.ts +35 -0
  71. package/src/generated/table.ts +35 -0
  72. package/src/generated/timeline.ts +35 -0
  73. package/src/index.ts +389 -0
  74. package/src/manifest/plugin-manifest.ts +212 -0
  75. package/src/query.ts +150 -0
  76. package/src/types/calendar.ts +23 -0
  77. package/src/types/chart.ts +36 -0
  78. package/src/types/checklist.ts +22 -0
  79. package/src/types/dashboard.ts +18 -0
  80. package/src/types/doc.ts +19 -0
  81. package/src/types/gallery.ts +24 -0
  82. package/src/types/graph.ts +21 -0
  83. package/src/types/kanban.ts +27 -0
  84. package/src/types/map.ts +21 -0
  85. package/src/types/outline.ts +17 -0
  86. package/src/types/overview.ts +17 -0
  87. package/src/types/prose.ts +19 -0
  88. package/src/types/sheets.ts +24 -0
  89. package/src/types/slides.ts +22 -0
  90. package/src/types/table.ts +22 -0
  91. package/src/types/timeline.ts +18 -0
  92. package/src/types/universal.ts +59 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"abracadabra-schema.esm.js","names":[],"sources":["../src/crdt.ts","../src/types/universal.ts","../src/query.ts","../src/types/doc.ts","../src/types/prose.ts","../src/types/kanban.ts","../src/types/gallery.ts","../src/types/table.ts","../src/types/outline.ts","../src/types/checklist.ts","../src/types/graph.ts","../src/types/timeline.ts","../src/types/calendar.ts","../src/types/map.ts","../src/types/dashboard.ts","../src/types/chart.ts","../src/types/sheets.ts","../src/types/slides.ts","../src/types/overview.ts","../src/manifest/plugin-manifest.ts","../src/index.ts"],"sourcesContent":["/**\n * CRDT primitive shims for the schema DSL.\n *\n * Y.Text / Y.Array / Y.Map cannot be expressed as plain JSON, so the\n * markers below serve two roles:\n *\n * 1. **Type inference** — consumers writing `body: ytext()` get the\n * compile-time signal that the field is a `Y.Text` instance.\n * 2. **Codegen markers** — generators (TS, Rust, JSON Schema, MCP)\n * read the `crdt: \"ytext\" | \"yarray\" | \"ymap\"` metadata to emit\n * the right output (e.g. JSON Schema gets `string` for ytext;\n * Rust codegen emits `yrs::TextRef`).\n *\n * Runtime validation against meta values is a no-op — meta is read as\n * POJOs from a Y.Map, and CRDT-typed slots live in `body` / `children`,\n * not in `meta`.\n *\n * yjs is a *peer* dep — the type-only import is erased at runtime.\n */\n\nimport type * as Y from \"yjs\";\nimport { z } from \"zod\";\n\nexport type CrdtKind = \"ytext\" | \"yarray\" | \"ymap\";\n\nexport interface CrdtMeta {\n\treadonly crdt: CrdtKind;\n\treadonly element?: z.ZodType;\n}\n\n/** Y.Text marker. Reads as opaque CRDT — schema does not validate the contents. */\nexport function ytext(): z.ZodType<Y.Text> {\n\treturn z\n\t\t.custom<Y.Text>(() => true)\n\t\t.meta({ crdt: \"ytext\" } satisfies CrdtMeta);\n}\n\n/** Y.Array<T> marker. Element schema is preserved in metadata for codegen. */\nexport function yarray<T extends z.ZodType>(\n\telement: T,\n): z.ZodType<Y.Array<z.infer<T>>> {\n\treturn z\n\t\t.custom<Y.Array<z.infer<T>>>(() => true)\n\t\t.meta({ crdt: \"yarray\", element } satisfies CrdtMeta);\n}\n\n/** Y.Map<T> marker. Value schema is preserved in metadata for codegen. */\nexport function ymap<T extends z.ZodType>(\n\tvalue: T,\n): z.ZodType<Y.Map<z.infer<T>>> {\n\treturn z\n\t\t.custom<Y.Map<z.infer<T>>>(() => true)\n\t\t.meta({ crdt: \"ymap\", element: value } satisfies CrdtMeta);\n}\n\n/** Inspect a Zod schema for a CRDT marker. Returns undefined for non-CRDT schemas. */\nexport function crdtMetaOf(schema: z.ZodType): CrdtMeta | undefined {\n\tconst meta = schema.meta() as Partial<CrdtMeta> | undefined;\n\tif (meta && typeof meta.crdt === \"string\") {\n\t\treturn meta as CrdtMeta;\n\t}\n\treturn undefined;\n}\n","/**\n * Universal meta keys that may appear on any typed root.\n *\n * Mirrors the canonical list in `page-type-guidelines.md` §4.5 plus the\n * three cross-cutting cover keys (`coverUploadId`/`coverDocId`/\n * `coverMimeType`). Every key is optional. Per-type schemas merge this\n * object via `UniversalMeta.extend({ ... })`.\n *\n * Descendant-only keys (cell formatting, geo, dashboard layout, spatial\n * transforms, EXIF media metadata, etc.) are deliberately excluded —\n * descendants are untyped and unvalidated by the registry, so those\n * keys flow through the untyped meta path without per-type constraints.\n */\n\nimport { z } from \"zod\";\n\nconst hexColor = z.string().regex(/^#[0-9a-fA-F]{6}$/);\nconst hhmm = z.string().regex(/^[0-2]\\d:[0-5]\\d$/);\n\nexport const UniversalMeta = z.strictObject({\n\tcolor: hexColor.optional(),\n\ticon: z.string().optional(),\n\tdatetimeStart: z.iso.datetime().optional(),\n\tdatetimeEnd: z.iso.datetime().optional(),\n\tallDay: z.boolean().optional(),\n\tdateStart: z.iso.date().optional(),\n\tdateEnd: z.iso.date().optional(),\n\ttimeStart: hhmm.optional(),\n\ttimeEnd: hhmm.optional(),\n\ttags: z.array(z.string()).optional(),\n\tchecked: z.boolean().optional(),\n\tpriority: z.number().int().min(0).max(4).optional(),\n\tstatus: z.string().optional(),\n\trating: z.number().min(0).max(5).optional(),\n\turl: z.string().optional(),\n\temail: z.string().optional(),\n\tphone: z.string().optional(),\n\tnumber: z.number().optional(),\n\tunit: z.string().optional(),\n\tsubtitle: z.string().optional(),\n\tnote: z.string().optional(),\n\ttaskProgress: z.number().min(0).max(100).optional(),\n\t/**\n\t * User id (UUID) the entry is assigned to. Indexed by the v2 query\n\t * layer (`doc_meta_index.assigned_to`) so \"all cards assigned to me\"\n\t * is a single indexed lookup. Server does not validate referential\n\t * integrity — it's just a tag.\n\t */\n\tassignedTo: z.string().optional(),\n\tcoverUploadId: z.string().optional(),\n\tcoverDocId: z.string().optional(),\n\tcoverMimeType: z.string().optional(),\n\t/**\n\t * Migration version. Read by `runMigrations` to determine which\n\t * forward-migrations to apply when projecting an old document.\n\t * Absent ⇒ assume version 1.\n\t */\n\t__schemaVersion: z.number().int().min(1).optional(),\n});\n","/**\n * V2 query layer — predicate AST.\n *\n * Mirrors InstantDB / Prisma `where` shapes: column → predicate pairs\n * composed with boolean AND/OR/NOT. The Rust compiler at\n * `crates/abracadabra/src/query.rs` walks the same shape and emits\n * indexed SQL against `doc_meta_index`.\n *\n * Columns are restricted to the universal-meta projection: `priority`,\n * `dateStart`, `dateEnd`, `tags`, `status`, `assignedTo`. Anything else\n * is rejected. Adding a column requires both:\n * 1. A new column on `doc_meta_index` (migration in `abracadabra-rs`)\n * 2. A new entry in `META_COLUMNS` below\n *\n * The schema is intentionally narrow — only the operators the v2 query\n * layer can actually execute against indexed columns are accepted. New\n * operators require server changes; the schema is the contract.\n */\n\nimport { z } from \"zod\";\n\n// ---------------------------------------------------------------------------\n// Columns\n// ---------------------------------------------------------------------------\n\n/**\n * Whitelisted indexed columns on `doc_meta_index`. Adding to this list\n * requires a parallel migration on the server. Order is the canonical\n * documentation order — not enforced.\n */\nexport const META_COLUMNS = [\n\t\"priority\",\n\t\"dateStart\",\n\t\"dateEnd\",\n\t\"tags\",\n\t\"status\",\n\t\"assignedTo\",\n] as const;\n\nexport type MetaColumn = (typeof META_COLUMNS)[number];\n\nconst ColumnEnum = z.enum(META_COLUMNS);\n\n// ---------------------------------------------------------------------------\n// Operators\n// ---------------------------------------------------------------------------\n\nconst ScalarValue = z.union([z.string(), z.number(), z.boolean(), z.null()]);\n\n/**\n * Numeric / lexicographic comparison operators. Apply to integer\n * (`priority`), date (`dateStart`, `dateEnd`), and string\n * (`status`, `assignedTo`) columns. Strings compare lexicographically\n * — useful for date filtering on the SQLite path where dates are TEXT.\n */\nconst RangeOps = z.strictObject({\n\teq: ScalarValue.optional(),\n\tneq: ScalarValue.optional(),\n\tgt: ScalarValue.optional(),\n\tgte: ScalarValue.optional(),\n\tlt: ScalarValue.optional(),\n\tlte: ScalarValue.optional(),\n\tin: z.array(ScalarValue).optional(),\n\tbetween: z.tuple([ScalarValue, ScalarValue]).optional(),\n});\n\n/**\n * Operators for the `tags` column. `tags` is a JSON array.\n * `contains: \"x\"` matches when the array includes the string `x`.\n * `containsAll: [\"x\",\"y\"]` requires all listed tags to be present.\n * `containsAny: [\"x\",\"y\"]` requires at least one.\n */\nconst TagOps = z.strictObject({\n\tcontains: z.string().optional(),\n\tcontainsAll: z.array(z.string()).optional(),\n\tcontainsAny: z.array(z.string()).optional(),\n\tisEmpty: z.boolean().optional(),\n});\n\n/** Per-column predicate. `null` => column IS NULL. */\nconst ColumnPredicate = z.union([\n\tScalarValue, // shorthand `{ priority: 3 }` == `{ priority: { eq: 3 } }`\n\tRangeOps,\n\tTagOps,\n]);\n\n// ---------------------------------------------------------------------------\n// Composition\n// ---------------------------------------------------------------------------\n\n/**\n * A clause is either:\n * - A leaf: `{ column: predicate, ... }` with multiple columns AND-ed\n * implicitly.\n * - A composition node: `{ AND: [clause, ...] }`, `{ OR: [...] }`,\n * `{ NOT: clause }`.\n *\n * The Zod schema below tolerates mixing leaf columns and composer keys\n * at the same level; the Rust compiler rejects that case with a clear\n * error. Keeping the Zod schema permissive on this point lets us evolve\n * the rule without re-versioning the wire shape.\n */\nexport interface WhereClause {\n\treadonly AND?: ReadonlyArray<WhereClause>;\n\treadonly OR?: ReadonlyArray<WhereClause>;\n\treadonly NOT?: WhereClause;\n\treadonly priority?: z.infer<typeof ColumnPredicate>;\n\treadonly dateStart?: z.infer<typeof ColumnPredicate>;\n\treadonly dateEnd?: z.infer<typeof ColumnPredicate>;\n\treadonly tags?: z.infer<typeof ColumnPredicate>;\n\treadonly status?: z.infer<typeof ColumnPredicate>;\n\treadonly assignedTo?: z.infer<typeof ColumnPredicate>;\n}\n\nexport const WhereClauseSchema: z.ZodType<WhereClause> = z.lazy(() =>\n\tz.strictObject({\n\t\tAND: z.array(WhereClauseSchema).optional(),\n\t\tOR: z.array(WhereClauseSchema).optional(),\n\t\tNOT: WhereClauseSchema.optional(),\n\t\tpriority: ColumnPredicate.optional(),\n\t\tdateStart: ColumnPredicate.optional(),\n\t\tdateEnd: ColumnPredicate.optional(),\n\t\ttags: ColumnPredicate.optional(),\n\t\tstatus: ColumnPredicate.optional(),\n\t\tassignedTo: ColumnPredicate.optional(),\n\t}),\n);\n\n/**\n * Parse + normalise a raw `where` object. Returns a discriminated\n * result so call sites can render server-friendly error messages on\n * the wire.\n */\nexport function parseWhereClause(\n\traw: unknown,\n):\n\t| { ok: true; value: WhereClause }\n\t| { ok: false; errors: ReadonlyArray<{ path: ReadonlyArray<PropertyKey>; message: string }> } {\n\tconst parsed = WhereClauseSchema.safeParse(raw);\n\tif (parsed.success) {\n\t\treturn { ok: true, value: parsed.data };\n\t}\n\treturn {\n\t\tok: false,\n\t\terrors: parsed.error.issues.map((i) => ({\n\t\t\tpath: i.path,\n\t\t\tmessage: i.message,\n\t\t})),\n\t};\n}\n","/**\n * `doc` — the default rich-text page type. Body is a TipTap-backed\n * `Y.Text`; descendants are untyped tree entries.\n */\n\nimport { defineDocType, defineSchema } from \"../index.ts\";\nimport { ytext } from \"../crdt.ts\";\nimport { UniversalMeta } from \"./universal.ts\";\n\nexport const DocMeta = UniversalMeta;\n\nexport const Doc = defineDocType({\n\tname: \"doc\",\n\tversion: 1,\n\tmeta: DocMeta,\n\tbody: ytext(),\n});\n\nexport const docSchema = defineSchema({ types: [Doc] });\n","/**\n * `prose` — long-form prose with serif typography. Same body shape as\n * `doc` (Y.Text TipTap content); descendants are untyped.\n */\n\nimport { defineDocType, defineSchema } from \"../index.ts\";\nimport { ytext } from \"../crdt.ts\";\nimport { UniversalMeta } from \"./universal.ts\";\n\nexport const ProseMeta = UniversalMeta;\n\nexport const Prose = defineDocType({\n\tname: \"prose\",\n\tversion: 1,\n\tmeta: ProseMeta,\n\tbody: ytext(),\n});\n\nexport const proseSchema = defineSchema({ types: [Prose] });\n","/**\n * `kanban` — drag-and-drop board. Direct children are columns;\n * grandchildren are cards. Both descendants are untyped tree entries\n * — only the board itself carries `type: \"kanban\"` and the per-board\n * view-config keys below.\n */\n\nimport { z } from \"zod\";\nimport { defineDocType, defineSchema } from \"../index.ts\";\nimport { UniversalMeta } from \"./universal.ts\";\n\nexport const KanbanMeta = UniversalMeta.extend({\n\tkanbanColumnWidth: z.enum([\"narrow\", \"default\", \"wide\"]).optional(),\n\tkanbanShowIcon: z.boolean().optional(),\n\tkanbanShowTags: z.boolean().optional(),\n\tkanbanShowPriority: z.boolean().optional(),\n\tkanbanShowDueDate: z.boolean().optional(),\n\tkanbanShowCover: z.boolean().optional(),\n});\n\nexport const Kanban = defineDocType({\n\tname: \"kanban\",\n\tversion: 1,\n\tmeta: KanbanMeta,\n});\n\nexport const kanbanSchema = defineSchema({ types: [Kanban] });\n","/**\n * `gallery` — visual grid of items with rich content. Direct children\n * are items (untyped tree entries).\n */\n\nimport { z } from \"zod\";\nimport { defineDocType, defineSchema } from \"../index.ts\";\nimport { UniversalMeta } from \"./universal.ts\";\n\nexport const GalleryMeta = UniversalMeta.extend({\n\tgalleryColumns: z.number().int().min(1).max(6).optional(),\n\tgalleryAspect: z.enum([\"square\", \"4:3\", \"3:2\", \"16:9\", \"free\"]).optional(),\n\tgalleryCardStyle: z.enum([\"default\", \"compact\", \"detailed\"]).optional(),\n\tgalleryShowLabels: z.boolean().optional(),\n\tgallerySortBy: z.enum([\"manual\", \"date\", \"name\", \"rating\"]).optional(),\n});\n\nexport const Gallery = defineDocType({\n\tname: \"gallery\",\n\tversion: 1,\n\tmeta: GalleryMeta,\n});\n\nexport const gallerySchema = defineSchema({ types: [Gallery] });\n","/**\n * `table` — collaborative spreadsheet. Direct children are columns;\n * grandchildren are positional cells (row N = Nth child of each\n * column). Descendants are untyped.\n */\n\nimport { z } from \"zod\";\nimport { defineDocType, defineSchema } from \"../index.ts\";\nimport { UniversalMeta } from \"./universal.ts\";\n\nexport const TableMeta = UniversalMeta.extend({\n\ttableMode: z.enum([\"hierarchy\", \"flat\"]).optional(),\n\ttableSortDir: z.enum([\"asc\", \"desc\"]).optional(),\n});\n\nexport const Table = defineDocType({\n\tname: \"table\",\n\tversion: 1,\n\tmeta: TableMeta,\n});\n\nexport const tableSchema = defineSchema({ types: [Table] });\n","/**\n * `outline` — hierarchical outline with keyboard navigation. Unlimited\n * descendant nesting; all descendants are untyped.\n */\n\nimport { defineDocType, defineSchema } from \"../index.ts\";\nimport { UniversalMeta } from \"./universal.ts\";\n\nexport const OutlineMeta = UniversalMeta;\n\nexport const Outline = defineDocType({\n\tname: \"outline\",\n\tversion: 1,\n\tmeta: OutlineMeta,\n});\n\nexport const outlineSchema = defineSchema({ types: [Outline] });\n","/**\n * `checklist` — collaborative checklist with sub-tasks and due dates.\n * Unlimited descendant nesting; all descendants are untyped (per-task\n * `checked` / `priority` / `dateEnd` flow through universal keys).\n */\n\nimport { z } from \"zod\";\nimport { defineDocType, defineSchema } from \"../index.ts\";\nimport { UniversalMeta } from \"./universal.ts\";\n\nexport const ChecklistMeta = UniversalMeta.extend({\n\tchecklistFilter: z.enum([\"all\", \"active\", \"completed\"]).optional(),\n\tchecklistSort: z.enum([\"manual\", \"priority\", \"due\"]).optional(),\n});\n\nexport const Checklist = defineDocType({\n\tname: \"checklist\",\n\tversion: 1,\n\tmeta: ChecklistMeta,\n});\n\nexport const checklistSchema = defineSchema({ types: [Checklist] });\n","/**\n * `graph` — force-directed knowledge graph rendering. Descendants are\n * untyped (per-node `graphX` / `graphY` / `graphPinned` are written to\n * descendant meta but not validated by the registry).\n */\n\nimport { z } from \"zod\";\nimport { defineDocType, defineSchema } from \"../index.ts\";\nimport { UniversalMeta } from \"./universal.ts\";\n\nexport const GraphMeta = UniversalMeta.extend({\n\tshowRefEdges: z.boolean().optional(),\n});\n\nexport const Graph = defineDocType({\n\tname: \"graph\",\n\tversion: 1,\n\tmeta: GraphMeta,\n});\n\nexport const graphSchema = defineSchema({ types: [Graph] });\n","/**\n * `timeline` — Gantt-style project timeline. Direct children are epics;\n * grandchildren are tasks (both untyped). Per-bar `dateStart` /\n * `dateEnd` / `taskProgress` / `color` use universal keys.\n */\n\nimport { defineDocType, defineSchema } from \"../index.ts\";\nimport { UniversalMeta } from \"./universal.ts\";\n\nexport const TimelineMeta = UniversalMeta;\n\nexport const Timeline = defineDocType({\n\tname: \"timeline\",\n\tversion: 1,\n\tmeta: TimelineMeta,\n});\n\nexport const timelineSchema = defineSchema({ types: [Timeline] });\n","/**\n * `calendar` — event calendar with month/week/day views. Direct\n * children are events (untyped); per-event `datetimeStart` /\n * `datetimeEnd` / `allDay` / `color` use universal keys.\n */\n\nimport { z } from \"zod\";\nimport { defineDocType, defineSchema } from \"../index.ts\";\nimport { UniversalMeta } from \"./universal.ts\";\n\nexport const CalendarMeta = UniversalMeta.extend({\n\tcalendarWeekStart: z.enum([\"sun\", \"mon\"]).optional(),\n\tcalendarView: z.enum([\"month\", \"week\", \"day\"]).optional(),\n\tcalendarShowWeekNumbers: z.boolean().optional(),\n});\n\nexport const Calendar = defineDocType({\n\tname: \"calendar\",\n\tversion: 1,\n\tmeta: CalendarMeta,\n});\n\nexport const calendarSchema = defineSchema({ types: [Calendar] });\n","/**\n * `map` — collaborative world map. Direct children are markers / lines\n * / measure entries (untyped, distinguished by descendant `geoType`\n * key flowing through the untyped meta path).\n */\n\nimport { z } from \"zod\";\nimport { defineDocType, defineSchema } from \"../index.ts\";\nimport { UniversalMeta } from \"./universal.ts\";\n\nexport const MapMeta = UniversalMeta.extend({\n\tmapShowLabels: z.boolean().optional(),\n});\n\nexport const MapDocType = defineDocType({\n\tname: \"map\",\n\tversion: 1,\n\tmeta: MapMeta,\n});\n\nexport const mapSchema = defineSchema({ types: [MapDocType] });\n","/**\n * `dashboard` — arranges documents as draggable icons / widgets.\n * Descendants are untyped; per-item `desk*` layout keys flow through\n * the untyped meta path.\n */\n\nimport { defineDocType, defineSchema } from \"../index.ts\";\nimport { UniversalMeta } from \"./universal.ts\";\n\nexport const DashboardMeta = UniversalMeta;\n\nexport const Dashboard = defineDocType({\n\tname: \"dashboard\",\n\tversion: 1,\n\tmeta: DashboardMeta,\n});\n\nexport const dashboardSchema = defineSchema({ types: [Dashboard] });\n","/**\n * `chart` — manual data points or aggregation over document trees.\n * Direct children are data points (untyped); per-point `number` /\n * `color` / `tags` use universal keys.\n */\n\nimport { z } from \"zod\";\nimport { defineDocType, defineSchema } from \"../index.ts\";\nimport { UniversalMeta } from \"./universal.ts\";\n\nexport const ChartMeta = UniversalMeta.extend({\n\tchartType: z.enum([\"bar\", \"stacked bar\", \"line\", \"donut\", \"treemap\"]).optional(),\n\tchartMetric: z\n\t\t.enum([\n\t\t\t\"value\",\n\t\t\t\"type\",\n\t\t\t\"tag\",\n\t\t\t\"status\",\n\t\t\t\"priority\",\n\t\t\t\"activity\",\n\t\t\t\"completion\",\n\t\t])\n\t\t.optional(),\n\tchartColorScheme: z.enum([\"default\", \"warm\", \"cool\", \"mono\"]).optional(),\n\tchartLimit: z.number().int().min(3).max(30).optional(),\n\tchartShowLegend: z.boolean().optional(),\n\tchartShowValues: z.boolean().optional(),\n});\n\nexport const Chart = defineDocType({\n\tname: \"chart\",\n\tversion: 1,\n\tmeta: ChartMeta,\n});\n\nexport const chartSchema = defineSchema({ types: [Chart] });\n","/**\n * `sheets` — spreadsheet with formulas + formatting. Direct children\n * are columns; grandchildren are positional cells (both untyped).\n * Per-cell `formula` / `bold` / `bgColor` / `numberFormat` etc. flow\n * through the untyped meta path.\n */\n\nimport { z } from \"zod\";\nimport { defineDocType, defineSchema } from \"../index.ts\";\nimport { UniversalMeta } from \"./universal.ts\";\n\nexport const SheetsMeta = UniversalMeta.extend({\n\tsheetsDefaultColWidth: z.number().min(40).max(500).optional(),\n\tsheetsDefaultRowHeight: z.number().min(20).max(100).optional(),\n\tsheetsShowGridlines: z.boolean().optional(),\n});\n\nexport const Sheets = defineDocType({\n\tname: \"sheets\",\n\tversion: 1,\n\tmeta: SheetsMeta,\n});\n\nexport const sheetsSchema = defineSchema({ types: [Sheets] });\n","/**\n * `slides` — two-axis presentation. Direct children are slides;\n * grandchildren are sub-slides (both untyped); per-slide\n * `slidesTransition` / `color` flow through the universal/untyped\n * paths.\n */\n\nimport { z } from \"zod\";\nimport { defineDocType, defineSchema } from \"../index.ts\";\nimport { UniversalMeta } from \"./universal.ts\";\n\nexport const SlidesMeta = UniversalMeta.extend({\n\tslidesTheme: z.enum([\"dark\", \"light\"]).optional(),\n});\n\nexport const Slides = defineDocType({\n\tname: \"slides\",\n\tversion: 1,\n\tmeta: SlidesMeta,\n});\n\nexport const slidesSchema = defineSchema({ types: [Slides] });\n","/**\n * `overview` — space home: activity, people, stats. Descendants are\n * regular pages; no overview-specific config keys today.\n */\n\nimport { defineDocType, defineSchema } from \"../index.ts\";\nimport { UniversalMeta } from \"./universal.ts\";\n\nexport const OverviewMeta = UniversalMeta;\n\nexport const Overview = defineDocType({\n\tname: \"overview\",\n\tversion: 1,\n\tmeta: OverviewMeta,\n});\n\nexport const overviewSchema = defineSchema({ types: [Overview] });\n","/**\n * Runtime validation schema for plugin manifests (manifest v1).\n *\n * The TypeScript types live in `@abraca/plugin/src/manifest.ts` and stay\n * pure — `@abraca/plugin` itself ships zero schemas per `feedback_schema_free_core`.\n * This file is the opt-in Zod validator used by:\n *\n * - the registry server's submission pipeline (verifies submitted manifests\n * before storing the artifact)\n * - the `@abraca/plugin-cli` `validate` command (local pre-submit linting)\n * - hosts (`cou-shell`, `@abraca/nuxt`) before instantiating an external\n * plugin, when they want runtime validation in addition to the\n * compile-time `PluginManifest` typing.\n *\n * The inferred shape is asserted to be structurally identical to\n * `PluginManifest` from `@abraca/plugin` via `_check` type aliases below —\n * if either side drifts, the typecheck fails.\n */\n\nimport { z } from \"zod\";\n\nimport type {\n\tPluginManifest,\n\tPluginCapability,\n} from \"@abraca/plugin\";\n\n// ── Capability vocabulary ─────────────────────────────────────────────────────\n\n/**\n * Capabilities with no dynamic suffix. Anything outside this set and the two\n * prefix families (`network[:*]`, `page-type:<slug>`) is rejected.\n *\n * Encoded as a regex pattern (not a `.refine()` callback) so the\n * Zod-to-JSON-Schema codegen captures it — otherwise the registry server's\n * Rust validator would have to re-implement the vocabulary in parallel.\n */\nconst CAPABILITY_PATTERN =\n\t\"^(fs:read|fs:write|clipboard:read|clipboard:write|doc-read|doc-write|awareness|server-runner|command-palette|toolbar|bubble-menu|slash-command|drag-handle|chat:send|chat:read|notifications:show|network|network:\\\\S+|page-type:[a-z][a-z0-9-]*)$\";\n\nexport const PluginCapabilitySchema = z\n\t.string()\n\t.regex(new RegExp(CAPABILITY_PATTERN), {\n\t\tmessage:\n\t\t\t\"unknown plugin capability — see PluginCapability in @abraca/plugin\",\n\t})\n\t.transform((s) => s as PluginCapability);\n\n// ── Primitive field schemas ───────────────────────────────────────────────────\n\n/** Lowercase-kebab slug. Starts with a letter; no consecutive dashes; no trailing dash. */\nexport const PluginIdSchema = z\n\t.string()\n\t.regex(\n\t\t/^[a-z][a-z0-9]*(-[a-z0-9]+)*$/,\n\t\t\"id must be lowercase-kebab (e.g. 'spatial', 'plugin-coder', 'my-2nd-plugin')\",\n\t);\n\n/**\n * Strict semver `MAJOR.MINOR.PATCH` with optional pre-release / build metadata.\n * Reference: https://semver.org/spec/v2.0.0.html#backusnaur-form-grammar-for-valid-semver-versions\n */\nexport const SemverSchema = z\n\t.string()\n\t.regex(\n\t\t/^(0|[1-9]\\d*)\\.(0|[1-9]\\d*)\\.(0|[1-9]\\d*)(?:-((?:0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\\.(?:0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\\+([0-9a-zA-Z-]+(?:\\.[0-9a-zA-Z-]+)*))?$/,\n\t\t\"version must be valid semver (e.g. '1.2.3', '0.1.0-alpha.1')\",\n\t);\n\n/**\n * Loose semver range — accepts `^1.2.3`, `~1.2`, `>=1.0 <2`, `1.x`, etc.\n * Not parsed here; the registry server runs `semver.validRange` for strict\n * validation. We just guard against obvious junk.\n */\nexport const SemverRangeSchema = z\n\t.string()\n\t.min(1)\n\t.max(80)\n\t.regex(/^[\\d.xX*~^<>=|\\s&,a-zA-Z+-]+$/, \"invalid semver range\");\n\n/** `sha256-<64 hex chars>`. */\nexport const IntegritySchema = z\n\t.string()\n\t.regex(\n\t\t/^sha256-[0-9a-f]{64}$/,\n\t\t\"integrity must be 'sha256-' + 64 lowercase hex chars\",\n\t);\n\n/** Relative POSIX path. No `..` segments, no absolute, no protocols. */\nexport const RelativePathSchema = z\n\t.string()\n\t.min(1)\n\t.max(256)\n\t.refine(\n\t\t(p) =>\n\t\t\t!p.startsWith(\"/\") &&\n\t\t\t!/^[a-z]+:\\/\\//i.test(p) &&\n\t\t\t!p.split(\"/\").includes(\"..\"),\n\t\t\"must be a relative path with no '..' segments\",\n\t);\n\n// ── Sub-schemas ───────────────────────────────────────────────────────────────\n\nexport const PluginManifestAuthorSchema = z.object({\n\tgithub: z.string().min(1).max(64).optional(),\n\tname: z.string().min(1).max(120).optional(),\n\turl: z.string().url().max(512).optional(),\n\temail: z.string().email().max(254).optional(),\n});\n\nexport const PluginPricingSchema = z.enum([\"free\", \"optional\", \"paid\"]);\n\nexport const PluginVersionStatusSchema = z.enum([\n\t\"live\",\n\t\"pending\",\n\t\"rejected\",\n\t\"superseded\",\n]);\n\nexport const PluginManifestContributesSchema = z.object({\n\tpageTypes: z.array(z.string().min(1)).readonly().optional(),\n\textensions: z.array(z.string().min(1)).readonly().optional(),\n\tawarenessFields: z.array(z.string().min(1)).readonly().optional(),\n\tserverRunners: z.array(z.string().min(1)).readonly().optional(),\n\tcommands: z.array(z.string().min(1)).readonly().optional(),\n\tsettingsPanels: z.array(z.string().min(1)).readonly().optional(),\n});\n\n// ── Top-level manifest schema ─────────────────────────────────────────────────\n\nexport const PluginManifestSchema = z.object({\n\tmanifestVersion: z.literal(1),\n\tid: PluginIdSchema,\n\tname: z.string().min(1).max(80).optional(),\n\tversion: SemverSchema,\n\tauthor: PluginManifestAuthorSchema,\n\tlicense: z.string().min(1).max(80),\n\tdescription: z.string().min(1).max(280),\n\treadme: z.string().max(100_000).optional(),\n\thomepage: z.string().url().max(512).optional(),\n\t/** `github:org/repo` shorthand or any URL — registry server normalises. */\n\trepository: z\n\t\t.string()\n\t\t.min(3)\n\t\t.max(512)\n\t\t.optional(),\n\tminAbracadabraVersion: SemverRangeSchema.optional(),\n\tentry: RelativePathSchema,\n\tintegrity: IntegritySchema,\n\tpricing: PluginPricingSchema.optional(),\n\tscreenshots: z.array(RelativePathSchema).max(20).readonly().optional(),\n\tcategories: z.array(z.string().min(1).max(40)).max(10).readonly().optional(),\n\tcapabilities: z.object({\n\t\trequired: z.array(PluginCapabilitySchema).readonly(),\n\t\toptional: z.array(PluginCapabilitySchema).readonly().optional(),\n\t}),\n\tcontributes: PluginManifestContributesSchema.optional(),\n\tpeerDeps: z.record(z.string(), SemverRangeSchema).optional(),\n});\n\n// ── Type identity assertions ──────────────────────────────────────────────────\n//\n// If either of these aliases fails to typecheck, the Zod schema has drifted\n// from `PluginManifest` in @abraca/plugin and the two halves of the contract\n// are out of sync. CI runs vue-tsc which catches the drift at build time.\n\ntype _SchemaInfersPluginManifest = z.infer<typeof PluginManifestSchema> extends PluginManifest\n\t? true\n\t: never;\n\ntype _PluginManifestSatisfiesSchema = PluginManifest extends z.infer<typeof PluginManifestSchema>\n\t? true\n\t: never;\n\n// Force the aliases to be referenced so tsc doesn't elide them.\nconst _check1: _SchemaInfersPluginManifest = true;\nconst _check2: _PluginManifestSatisfiesSchema = true;\nvoid _check1;\nvoid _check2;\n\n// ── Convenience helpers ───────────────────────────────────────────────────────\n\nexport interface ManifestValidationIssue {\n\treadonly path: ReadonlyArray<PropertyKey>;\n\treadonly message: string;\n\treadonly code?: string;\n}\n\nexport type ManifestValidationResult =\n\t| { ok: true; value: PluginManifest }\n\t| { ok: false; errors: ReadonlyArray<ManifestValidationIssue> };\n\n/**\n * Parse and validate a manifest. Always returns a result object — never\n * throws. Useful for surface UIs (the registry submission flow, the CLI's\n * `validate` command) that want to render every issue at once.\n */\nexport function validatePluginManifest(\n\tvalue: unknown,\n): ManifestValidationResult {\n\tconst parsed = PluginManifestSchema.safeParse(value);\n\tif (parsed.success) {\n\t\treturn { ok: true, value: parsed.data as PluginManifest };\n\t}\n\treturn {\n\t\tok: false,\n\t\terrors: parsed.error.issues.map((i) => ({\n\t\t\tpath: i.path,\n\t\t\tmessage: i.message,\n\t\t\tcode: i.code,\n\t\t})),\n\t};\n}\n","/**\n * @abraca/schema — public surface.\n *\n * The package exposes:\n * 1. A small DSL (`defineDocType`, `defineSchema`, `ref`) for declaring\n * doc-types backed by Zod meta schemas.\n * 2. CRDT primitive markers (`ytext`, `yarray`, `ymap`) — see `./crdt.ts`.\n * 3. A library of independently-importable per-page-type schemas (see\n * `./types/`). Each file exports:\n * - the doc-type value (e.g. `Kanban`)\n * - the meta Zod schema (e.g. `KanbanMeta`)\n * - a single-type `SchemaRegistry` (e.g. `kanbanSchema`)\n * Consumers compose registries by hand:\n * `defineSchema({ types: [Kanban, Calendar, Doc] })`.\n * 4. A shared `UniversalMeta` zod object for cross-cutting meta keys.\n *\n * No aggregate \"all page types\" schema is shipped — each app picks the\n * subset it needs.\n */\n\nimport type { z, ZodType } from \"zod\";\n\nexport { ytext, yarray, ymap, crdtMetaOf } from \"./crdt.ts\";\nexport type { CrdtKind, CrdtMeta } from \"./crdt.ts\";\n\nexport { UniversalMeta } from \"./types/universal.ts\";\n\nexport {\n\tMETA_COLUMNS,\n\tWhereClauseSchema,\n\tparseWhereClause,\n} from \"./query.ts\";\nexport type { MetaColumn, WhereClause } from \"./query.ts\";\n\nexport { Doc, DocMeta, docSchema } from \"./types/doc.ts\";\nexport { Prose, ProseMeta, proseSchema } from \"./types/prose.ts\";\nexport { Kanban, KanbanMeta, kanbanSchema } from \"./types/kanban.ts\";\nexport { Gallery, GalleryMeta, gallerySchema } from \"./types/gallery.ts\";\nexport { Table, TableMeta, tableSchema } from \"./types/table.ts\";\nexport { Outline, OutlineMeta, outlineSchema } from \"./types/outline.ts\";\nexport { Checklist, ChecklistMeta, checklistSchema } from \"./types/checklist.ts\";\nexport { Graph, GraphMeta, graphSchema } from \"./types/graph.ts\";\nexport { Timeline, TimelineMeta, timelineSchema } from \"./types/timeline.ts\";\nexport { Calendar, CalendarMeta, calendarSchema } from \"./types/calendar.ts\";\nexport { MapDocType, MapMeta, mapSchema } from \"./types/map.ts\";\nexport { Dashboard, DashboardMeta, dashboardSchema } from \"./types/dashboard.ts\";\nexport { Chart, ChartMeta, chartSchema } from \"./types/chart.ts\";\nexport { Sheets, SheetsMeta, sheetsSchema } from \"./types/sheets.ts\";\nexport { Slides, SlidesMeta, slidesSchema } from \"./types/slides.ts\";\nexport { Overview, OverviewMeta, overviewSchema } from \"./types/overview.ts\";\n\n// ---------------------------------------------------------------------------\n// Plugin manifest validation — opt-in runtime validator for @abraca/plugin's\n// `PluginManifest` type. Used by the registry server, the plugin CLI, and\n// hosts that want defence-in-depth before instantiating external plugins.\n// ---------------------------------------------------------------------------\n\nexport {\n\tPluginManifestSchema,\n\tPluginManifestAuthorSchema,\n\tPluginManifestContributesSchema,\n\tPluginCapabilitySchema,\n\tPluginIdSchema,\n\tSemverSchema,\n\tSemverRangeSchema,\n\tIntegritySchema,\n\tRelativePathSchema,\n\tPluginPricingSchema,\n\tPluginVersionStatusSchema,\n\tvalidatePluginManifest,\n} from \"./manifest/plugin-manifest.ts\";\nexport type {\n\tManifestValidationIssue,\n\tManifestValidationResult,\n} from \"./manifest/plugin-manifest.ts\";\n\n// ---------------------------------------------------------------------------\n// Public types\n// ---------------------------------------------------------------------------\n\n/** A reference to another doc-type by name. Resolved at registry build time. */\nexport interface DocTypeRef {\n\treadonly __ref: string;\n}\n\n/** Declaration handed to {@link defineDocType}. */\nexport interface DocTypeSpec<\n\tName extends string = string,\n\tMetaSchema extends ZodType = ZodType,\n\tBodySchema extends ZodType | undefined = ZodType | undefined,\n> {\n\treadonly name: Name;\n\treadonly version: number;\n\treadonly meta: MetaSchema;\n\t/**\n\t * Body slot — the document's primary content. Typically a CRDT marker\n\t * (`ytext()`, `yarray(...)`, `ymap(...)`) but can be any Zod schema for\n\t * documents whose body is read as a POJO snapshot.\n\t */\n\treadonly body?: BodySchema;\n\t/** Allowed child doc-types, by ref. */\n\treadonly children?: ReadonlyArray<DocTypeRef>;\n\t/** Reserved for Phase 2 — declarative permissions per field. */\n\treadonly permissions?: Record<string, unknown>;\n\t/**\n\t * Forward migrations between versions. Each entry's key is the\n\t * **source** version: `migrations[1]` migrates a v1 meta to v2.\n\t * `runMigrations` chains them up to `version`. Reserved versions\n\t * with no migration entry stop the chain; the meta is returned at\n\t * the highest version reached.\n\t */\n\treadonly migrations?: {\n\t\treadonly [fromVersion: number]: (oldMeta: any) => any;\n\t};\n}\n\n/** Resolved doc-type after registry build. */\nexport interface DocType<\n\tName extends string = string,\n\tMetaSchema extends ZodType = ZodType,\n\tBodySchema extends ZodType | undefined = ZodType | undefined,\n> extends DocTypeSpec<Name, MetaSchema, BodySchema> {\n\treadonly __resolved: true;\n}\n\nexport interface SchemaSpec {\n\treadonly types: ReadonlyArray<DocType>;\n}\n\n/**\n * Phantom meta-type witness on the registry. Carrying the meta map at the\n * type level lets consumers (e.g. `provider.docs(schema).get(type, id)`)\n * extract per-doc-type meta types via {@link DocMetaOf}/{@link DocTypeNameOf}\n * without re-importing the source declarations.\n *\n * Default `Record<string, unknown>` keeps existing untyped consumers working\n * unchanged (Rule 4).\n */\nexport interface SchemaRegistry<\n\tTMap extends Record<string, unknown> = Record<string, unknown>,\n> {\n\treadonly types: ReadonlyMap<string, DocType>;\n\tget(name: string): DocType | undefined;\n\tvalidateMeta(name: string, value: unknown): ValidationResult;\n\t/**\n\t * Returns ok if `child` is allowed under `parent`, err otherwise.\n\t * `parent === null` means the document tree root — only doc-types\n\t * declared as root-eligible (none today; reserved) are accepted there.\n\t */\n\tvalidateChildType(\n\t\tparent: string | null,\n\t\tchild: string,\n\t): ValidationResult;\n\t/**\n\t * Phantom-only field. Exists for type-inference (`infer` patterns in\n\t * {@link DocTypeNameOf}/{@link DocMetaOf}). Always `undefined` at runtime.\n\t */\n\treadonly __metaMap?: TMap;\n}\n\n/**\n * Extract the doc-type names from a typed registry. Works against any\n * `SchemaRegistry<TMap>` value.\n */\nexport type DocTypeNameOf<S> = S extends SchemaRegistry<infer M>\n\t? keyof M & string\n\t: never;\n\n/** Extract the meta type for a given doc-type name from a typed registry. */\nexport type DocMetaOf<S, N extends string> = S extends SchemaRegistry<infer M>\n\t? N extends keyof M\n\t\t? M[N]\n\t\t: never\n\t: never;\n\n/**\n * Internal: derive the meta-map type from a `SchemaSpec` so `defineSchema`\n * can return `SchemaRegistry<MetaMapFor<typeof spec>>` and consumers get\n * fully-inferred per-doc-type meta types at the call site.\n */\ntype MetaMapFor<S extends SchemaSpec> = {\n\t[T in S[\"types\"][number] as T[\"name\"]]: T extends DocType<\n\t\tstring,\n\t\tinfer M extends ZodType\n\t>\n\t\t? z.infer<M>\n\t\t: never;\n};\n\nexport type ValidationResult =\n\t| { ok: true; value: unknown }\n\t| { ok: false; errors: ReadonlyArray<ValidationIssue> };\n\nexport interface ValidationIssue {\n\treadonly path: ReadonlyArray<PropertyKey>;\n\treadonly message: string;\n\treadonly code?: string;\n}\n\n// ---------------------------------------------------------------------------\n// Public API\n// ---------------------------------------------------------------------------\n\n/**\n * Declare a doc-type. The returned value carries enough type information for\n * downstream codegen and is a `DocType` once registered.\n */\nexport function defineDocType<\n\tName extends string,\n\tMetaSchema extends ZodType,\n\tBodySchema extends ZodType | undefined = undefined,\n>(\n\tspec: DocTypeSpec<Name, MetaSchema, BodySchema>,\n): DocType<Name, MetaSchema, BodySchema> {\n\treturn { ...spec, __resolved: true };\n}\n\n/** Reference another doc-type by name. Resolution happens in {@link defineSchema}. */\nexport function ref(name: string): DocTypeRef {\n\treturn { __ref: name };\n}\n\n/**\n * Build a registry from a list of doc-types. Validates that all `ref(...)`\n * targets exist; throws on dangling references.\n *\n * The returned registry carries a phantom `__metaMap` witness inferred from\n * `spec`, so call sites like `provider.docs(schema).get(\"kanban\", id)`\n * see fully-typed meta even though the registry's runtime shape is generic.\n */\nexport function defineSchema<S extends SchemaSpec>(\n\tspec: S,\n): SchemaRegistry<MetaMapFor<S>> {\n\tconst types = new Map<string, DocType>();\n\tfor (const t of spec.types) {\n\t\tif (types.has(t.name)) {\n\t\t\tthrow new Error(`Duplicate doc-type name: ${t.name}`);\n\t\t}\n\t\ttypes.set(t.name, t);\n\t}\n\tfor (const t of spec.types) {\n\t\tfor (const child of t.children ?? []) {\n\t\t\tif (!types.has(child.__ref)) {\n\t\t\t\tthrow new Error(\n\t\t\t\t\t`Doc-type \"${t.name}\" references unknown child doc-type \"${child.__ref}\"`,\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\t}\n\treturn {\n\t\ttypes,\n\t\tget(name) {\n\t\t\treturn types.get(name);\n\t\t},\n\t\tvalidateChildType(parent, child) {\n\t\t\tif (!types.has(child)) {\n\t\t\t\treturn {\n\t\t\t\t\tok: false,\n\t\t\t\t\terrors: [{ path: [], message: `Unknown doc-type: ${child}` }],\n\t\t\t\t};\n\t\t\t}\n\t\t\tif (parent === null) {\n\t\t\t\treturn {\n\t\t\t\t\tok: false,\n\t\t\t\t\terrors: [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tpath: [],\n\t\t\t\t\t\t\tmessage: `Doc-type \"${child}\" cannot be a root document — root-eligibility is reserved for Phase 2`,\n\t\t\t\t\t\t},\n\t\t\t\t\t],\n\t\t\t\t};\n\t\t\t}\n\t\t\tconst parentType = types.get(parent);\n\t\t\tif (!parentType) {\n\t\t\t\treturn {\n\t\t\t\t\tok: false,\n\t\t\t\t\terrors: [{ path: [], message: `Unknown parent doc-type: ${parent}` }],\n\t\t\t\t};\n\t\t\t}\n\t\t\tconst allowed = (parentType.children ?? []).some((c) => c.__ref === child);\n\t\t\tif (allowed) {\n\t\t\t\treturn { ok: true, value: undefined };\n\t\t\t}\n\t\t\treturn {\n\t\t\t\tok: false,\n\t\t\t\terrors: [\n\t\t\t\t\t{\n\t\t\t\t\t\tpath: [],\n\t\t\t\t\t\tmessage: `Doc-type \"${child}\" is not an allowed child of \"${parent}\"`,\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t};\n\t\t},\n\t\tvalidateMeta(name, value) {\n\t\t\tconst t = types.get(name);\n\t\t\t// Rule 4 (feedback_schema_free_core): doc-types not in this\n\t\t\t// registry are unconstrained. Existing-app traffic for types the\n\t\t\t// registry doesn't know about is never rejected — callers can\n\t\t\t// check membership explicitly via `registry.get(name)` if they\n\t\t\t// need strict semantics.\n\t\t\tif (!t) {\n\t\t\t\treturn { ok: true, value };\n\t\t\t}\n\t\t\tconst parsed = t.meta.safeParse(value);\n\t\t\tif (parsed.success) {\n\t\t\t\treturn { ok: true, value: parsed.data };\n\t\t\t}\n\t\t\treturn {\n\t\t\t\tok: false,\n\t\t\t\terrors: parsed.error.issues.map((i) => ({\n\t\t\t\t\tpath: i.path,\n\t\t\t\t\tmessage: i.message,\n\t\t\t\t\tcode: i.code,\n\t\t\t\t})),\n\t\t\t};\n\t\t},\n\t};\n}\n\n/**\n * Apply forward migrations to a meta object.\n *\n * Reads `meta.__schemaVersion` (defaults to `1` if absent) and applies\n * each `migrations[v]` from there up to the schema's declared `version`.\n * Each migration function receives the previous version's meta and\n * returns the next version's meta. The final value carries\n * `__schemaVersion = <highest version reached>`.\n *\n * Behaviour:\n * - **Unknown doc-type**: returns `meta` unchanged. Rule 4 — registries\n * only constrain the types they declare.\n * - **No migrations declared**: returns `meta` unchanged. Useful for\n * freshly-introduced doc-types still at v1.\n * - **Missing migration entry mid-chain**: stops at the highest\n * reachable version. Caller can detect by inspecting\n * `result.__schemaVersion` against `schema.get(typeName)?.version`.\n * - **Non-object meta** (null, undefined, primitives): returns\n * unchanged. Migrations only operate on object meta.\n *\n * Migrations are pure: they receive a meta value and return a new\n * one. They MUST NOT mutate the input (callers may pass shared\n * references).\n *\n * @example\n * // v2 of kanban introduces a new required-shape `boardLayout` key.\n * const Kanban = defineDocType({\n * name: \"kanban\",\n * version: 2,\n * meta: KanbanMetaV2,\n * migrations: {\n * 1: (oldMeta) => ({ ...oldMeta, boardLayout: \"default\" }),\n * },\n * });\n * const fresh = runMigrations(kanbanSchema, \"kanban\", { kanbanShowIcon: true });\n * // fresh.boardLayout === \"default\"\n * // fresh.__schemaVersion === 2\n */\nexport function runMigrations(\n\tregistry: SchemaRegistry,\n\ttypeName: string,\n\tmeta: unknown,\n): unknown {\n\tif (meta === null || typeof meta !== \"object\") return meta;\n\tconst t = registry.get(typeName);\n\tif (!t) return meta; // Rule 4\n\tconst target = t.version;\n\tconst migrations = t.migrations;\n\n\tconst m = meta as Record<string, unknown>;\n\tlet currentVersion: number =\n\t\ttypeof m.__schemaVersion === \"number\" && m.__schemaVersion >= 1\n\t\t\t? m.__schemaVersion\n\t\t\t: 1;\n\tif (currentVersion >= target) return meta;\n\tif (!migrations) return meta;\n\n\tlet working: unknown = meta;\n\tlet migrated = false;\n\twhile (currentVersion < target) {\n\t\tconst fn = migrations[currentVersion];\n\t\tif (typeof fn !== \"function\") break;\n\t\tworking = fn(working);\n\t\tcurrentVersion += 1;\n\t\tmigrated = true;\n\t}\n\tif (!migrated) return meta; // no migration ran → return original unchanged\n\tif (working === null || typeof working !== \"object\") return working;\n\treturn { ...(working as Record<string, unknown>), __schemaVersion: currentVersion };\n}\n"],"mappings":";;;;AA+BA,SAAgB,QAA2B;AAC1C,QAAO,EACL,aAAqB,KAAK,CAC1B,KAAK,EAAE,MAAM,SAAS,CAAoB;;;AAI7C,SAAgB,OACf,SACiC;AACjC,QAAO,EACL,aAAkC,KAAK,CACvC,KAAK;EAAE,MAAM;EAAU;EAAS,CAAoB;;;AAIvD,SAAgB,KACf,OAC+B;AAC/B,QAAO,EACL,aAAgC,KAAK,CACrC,KAAK;EAAE,MAAM;EAAQ,SAAS;EAAO,CAAoB;;;AAI5D,SAAgB,WAAW,QAAyC;CACnE,MAAM,OAAO,OAAO,MAAM;AAC1B,KAAI,QAAQ,OAAO,KAAK,SAAS,SAChC,QAAO;;;;;;;;;;;;;;;;;;AC3CT,MAAM,WAAW,EAAE,QAAQ,CAAC,MAAM,oBAAoB;AACtD,MAAM,OAAO,EAAE,QAAQ,CAAC,MAAM,oBAAoB;AAElD,MAAa,gBAAgB,EAAE,aAAa;CAC3C,OAAO,SAAS,UAAU;CAC1B,MAAM,EAAE,QAAQ,CAAC,UAAU;CAC3B,eAAe,EAAE,IAAI,UAAU,CAAC,UAAU;CAC1C,aAAa,EAAE,IAAI,UAAU,CAAC,UAAU;CACxC,QAAQ,EAAE,SAAS,CAAC,UAAU;CAC9B,WAAW,EAAE,IAAI,MAAM,CAAC,UAAU;CAClC,SAAS,EAAE,IAAI,MAAM,CAAC,UAAU;CAChC,WAAW,KAAK,UAAU;CAC1B,SAAS,KAA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