@typecaast/schema 0.3.0 → 0.4.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.
- package/dist/index.cjs +7 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +15 -2
- package/dist/index.d.ts +15 -2
- package/dist/index.js +7 -1
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/typecaast.schema.json +20 -0
package/dist/index.cjs
CHANGED
|
@@ -166,6 +166,11 @@ var actionsNodeSchema = zod.z.object({
|
|
|
166
166
|
type: zod.z.literal("actions"),
|
|
167
167
|
elements: zod.z.array(buttonElementSchema)
|
|
168
168
|
});
|
|
169
|
+
var codeBlockNodeSchema = zod.z.object({
|
|
170
|
+
type: zod.z.literal("codeblock"),
|
|
171
|
+
text: zod.z.string(),
|
|
172
|
+
lang: zod.z.string().optional()
|
|
173
|
+
});
|
|
169
174
|
var attachmentNodeSchema = zod.z.lazy(
|
|
170
175
|
() => zod.z.object({
|
|
171
176
|
type: zod.z.literal("attachment"),
|
|
@@ -181,6 +186,7 @@ var registry = /* @__PURE__ */ new Map([
|
|
|
181
186
|
["context", contextNodeSchema],
|
|
182
187
|
["divider", dividerNodeSchema],
|
|
183
188
|
["actions", actionsNodeSchema],
|
|
189
|
+
["codeblock", codeBlockNodeSchema],
|
|
184
190
|
["attachment", attachmentNodeSchema]
|
|
185
191
|
]);
|
|
186
192
|
function registerContentNodeType(type, schema) {
|
|
@@ -552,6 +558,7 @@ exports.assetModeSchema = assetModeSchema;
|
|
|
552
558
|
exports.attachmentNodeSchema = attachmentNodeSchema;
|
|
553
559
|
exports.buildContentNodeSchema = buildContentNodeSchema;
|
|
554
560
|
exports.buttonElementSchema = buttonElementSchema;
|
|
561
|
+
exports.codeBlockNodeSchema = codeBlockNodeSchema;
|
|
555
562
|
exports.composerModeSchema = composerModeSchema;
|
|
556
563
|
exports.composerTypeStepSchema = composerTypeStepSchema;
|
|
557
564
|
exports.configJsonSchema = configJsonSchema;
|
package/dist/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/meta.ts","../src/participants.ts","../src/pacing.ts","../src/content-nodes.ts","../src/content-registry.ts","../src/content-sugar.ts","../src/timeline.ts","../src/config.ts","../src/validate.ts"],"names":["z"],"mappings":";;;;;AAGO,IAAM,UAAA,GAAaA,MAAE,MAAA,CAAO;AAAA,EACjC,OAAOA,KAAA,CAAE,MAAA,EAAO,CAAE,GAAA,GAAM,QAAA,EAAS;AAAA,EACjC,QAAQA,KAAA,CAAE,MAAA,EAAO,CAAE,GAAA,GAAM,QAAA;AAC3B,CAAC;AAgBM,IAAM,gBAAgBA,KAAA,CAAE,IAAA,CAAK,CAAC,QAAA,EAAU,OAAA,EAAS,OAAO,CAAC;AASzD,IAAM,qBAAqBA,KAAA,CAAE,IAAA,CAAK,CAAC,MAAA,EAAQ,QAAA,EAAU,OAAO,CAAC;AAQ7D,IAAM,kBAAkBA,KAAA,CAAE,IAAA,CAAK,CAAC,OAAA,EAAS,MAAA,EAAQ,MAAM,CAAC;AAQxD,IAAM,kBAAkBA,KAAA,CAAE,IAAA,CAAK,CAAC,QAAA,EAAU,KAAK,CAAC;AAIhD,IAAM,aAAA,GAAgBA,MAAE,MAAA,CAAO;AAAA,EACpC,EAAA,EAAIA,KAAA,CAAE,MAAA,EAAO,CAAE,IAAI,CAAC,CAAA;AAAA,EACpB,OAAA,EAASA,KAAA,CAAE,MAAA,CAAOA,KAAA,CAAE,MAAA,IAAUA,KAAA,CAAE,OAAA,EAAS,CAAA,CAAE,QAAA;AAC7C,CAAC;AAIM,IAAM,UAAA,GAAaA,MAAE,MAAA,CAAO;AAAA;AAAA,EAEjC,MAAA,EAAQ,UAAA;AAAA,EACR,GAAA,EAAKA,MAAE,MAAA,EAAO,CAAE,KAAI,CAAE,QAAA,EAAS,CAAE,OAAA,CAAQ,EAAE,CAAA;AAAA,EAC3C,GAAA,EAAK,aAAA,CAAc,OAAA,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;AAAA,YACN,QAAA,EAAU,SAAA;AAAA,YACV,OAAA,EAAS,0CAAA;AAAA,YACT,QAAA,EAAU,GAAG,GAAG,CAAA,OAAA,CAAA;AAAA,YAChB,IAAA,EAAM;AAAA,WACP,CAAA;AAAA,QACH;AAAA,MACF,CAAA,MAAA,IAAW,CAAC,UAAA,CAAW,GAAA,CAAI,MAAM,CAAA,EAAG;AAClC,QAAA,WAAA,CAAY,IAAA,CAAK;AAAA,UACf,IAAA,EAAM,UAAA;AAAA,UACN,QAAA,EAAU,SAAA;AAAA,UACV,OAAA,EAAS,WAAW,MAAM,CAAA,kCAAA,CAAA;AAAA,UAC1B,QAAA,EAAU,GAAG,GAAG,CAAA,OAAA,CAAA;AAAA,UAChB,IAAA,EAAM;AAAA,SACP,CAAA;AAAA,MACH;AAAA,IACF;AAEA,IAAA,IAAI,IAAA,CAAK,IAAA,KAAS,SAAA,IAAa,IAAA,CAAK,SAAS,QAAA,EAAU,aAAA,EAAA;AAAA,EACzD,CAAC,CAAA;AAED,EAAA,OAAO,WAAA;AACT","file":"index.cjs","sourcesContent":["import { z } from \"zod\";\n\n/** A pixel dimension pair (authoring reference; the exact frame for video). */\nexport const sizeSchema = z.object({\n width: z.number().int().positive(),\n height: z.number().int().positive(),\n});\nexport type Size = z.infer<typeof sizeSchema>;\n\n/**\n * How the rendered conversation fills its container. The widget is\n * **container-driven** in the first two modes — its size never grows\n * with content; messages clip when they overflow the bottom-anchored\n * thread.\n * - `reflow`: fills the container in both axes; bubbles re-wrap to the\n * container width.\n * - `scale`: renders at the exact authored canvas size and CSS-scales\n * to fit (preserves the canonical layout — letterboxes if the\n * container's aspect doesn't match the canvas).\n * - `fixed`: pins the widget to the authored canvas px; clips. The only\n * non-container-driven mode.\n */\nexport const fitModeSchema = z.enum([\"reflow\", \"scale\", \"fixed\"]);\nexport type FitMode = z.infer<typeof fitModeSchema>;\n\n/**\n * Reply-box (composer) visibility:\n * - `auto`: shown only while someone is typing/sending (default).\n * - `always`: keep the message input visible the whole time.\n * - `never`: never show it.\n */\nexport const composerModeSchema = z.enum([\"auto\", \"always\", \"never\"]);\nexport type ComposerMode = z.infer<typeof composerModeSchema>;\n\n/**\n * Color theme. `auto` inherits the host page's `prefers-color-scheme` (live\n * preview) and falls back to `light`; video export resolves `auto` to a\n * concrete mode and defaults to `light` when unspecified.\n */\nexport const themeModeSchema = z.enum([\"light\", \"dark\", \"auto\"]);\nexport type ThemeMode = z.infer<typeof themeModeSchema>;\n\n/**\n * Asset resolution strategy.\n * - `inline`: embed images as data URLs (self-contained config; default).\n * - `url`: reference hosted images (smaller config; user hosts their own).\n */\nexport const assetModeSchema = z.enum([\"inline\", \"url\"]);\nexport type AssetMode = z.infer<typeof assetModeSchema>;\n\n/** Reference to a skin plus its skin-specific options (validated by the skin). */\nexport const skinRefSchema = z.object({\n id: z.string().min(1),\n options: z.record(z.string(), z.unknown()).optional(),\n});\nexport type SkinRef = z.infer<typeof skinRefSchema>;\n\n/** Top-level rendering/authoring metadata. */\nexport const metaSchema = z.object({\n /** Authoring reference size; fixed frame for video. */\n canvas: sizeSchema,\n fps: z.number().int().positive().default(30),\n fit: fitModeSchema.default(\"reflow\"),\n theme: themeModeSchema.default(\"auto\"),\n skin: skinRefSchema,\n /** Seed for all deterministic jitter (no `Math.random`). */\n seed: z.number().int().default(42),\n /** Canvas background: `\"transparent\"` or any CSS color. */\n background: z.string().default(\"transparent\"),\n assets: assetModeSchema.default(\"inline\"),\n /** Reply-box visibility (see `composerModeSchema`). */\n composer: composerModeSchema.default(\"auto\"),\n /**\n * Auto-replay when the timeline reaches the end. Honored by the builder\n * preview and by `<Typecaast>` when the consumer doesn't pass an explicit\n * `loop` prop.\n */\n loop: z.boolean().default(false),\n});\n\n/** `meta` as it appears after parsing (defaults applied). */\nexport type Meta = z.infer<typeof metaSchema>;\n/** `meta` as authored (fields with defaults are optional). */\nexport type MetaInput = z.input<typeof metaSchema>;\n","import { z } from \"zod\";\n\n/** Whether a participant is a human or an app/bot (changes how skins render it). */\nexport const participantKindSchema = z.enum([\"person\", \"app\"]);\nexport type ParticipantKind = z.infer<typeof participantKindSchema>;\n\n/** A speaker in the conversation. */\nexport const participantSchema = z.object({\n /** Stable id referenced by timeline steps (`from`, `target`, …). */\n id: z.string().min(1),\n name: z.string().min(1),\n /** Avatar asset (data URL or referenced URL per `meta.assets`). */\n avatar: z.string().optional(),\n /** Accent color (CSS color) some skins use for the author. */\n color: z.string().optional(),\n /** The viewer — rendered as the \"self\" side and the composer's author. */\n isSelf: z.boolean().optional(),\n kind: participantKindSchema.default(\"person\"),\n});\nexport type Participant = z.infer<typeof participantSchema>;\nexport type ParticipantInput = z.input<typeof participantSchema>;\n\nexport const participantsSchema = z.array(participantSchema);\n","import { z } from \"zod\";\n\n/**\n * Global auto-pacing defaults. Every value is overridable per step in the\n * timeline; the engine computes delays/durations from these and bakes in\n * seeded, deterministic jitter (`humanize`).\n */\nexport const pacingSchema = z.object({\n /** Gap before an incoming message ≈ reading time of the prior message. */\n readingWpm: z.number().positive().default(240),\n /** Chars/sec for composer typing + sender typing duration. */\n typingCps: z.number().positive().default(14),\n /** ±fraction of seeded jitter so pacing doesn't feel robotic (0–1). */\n humanize: z.number().min(0).max(1).default(0.15),\n /** Delay before the first event. */\n startDelayMs: z.number().nonnegative().default(400),\n});\nexport type Pacing = z.infer<typeof pacingSchema>;\nexport type PacingInput = z.input<typeof pacingSchema>;\n","import { z } from \"zod\";\n\n/**\n * Inline marks inside a text node. `text` runs carry plain content; the others\n * are the recognized marks (`code`, `link`, `mention`, `emoji`, and the\n * emphasis marks `bold`/`italic`/`strike`). New marks can be added without a\n * schema-version bump (unknown content node types are handled leniently; see\n * the registry). Emphasis marks are flat (no nesting, e.g. bold *and* italic on\n * the same run) — a deliberate v1 simplification matching Slack's common usage.\n */\nexport const inlineTextSchema = z.object({\n type: z.literal(\"text\"),\n value: z.string(),\n});\nexport const inlineCodeSchema = z.object({\n type: z.literal(\"code\"),\n value: z.string(),\n});\nexport const inlineBoldSchema = z.object({\n type: z.literal(\"bold\"),\n value: z.string(),\n});\nexport const inlineItalicSchema = z.object({\n type: z.literal(\"italic\"),\n value: z.string(),\n});\nexport const inlineStrikeSchema = z.object({\n type: z.literal(\"strike\"),\n value: z.string(),\n});\nexport const inlineLinkSchema = z.object({\n type: z.literal(\"link\"),\n href: z.string(),\n label: z.string().optional(),\n});\nexport const inlineMentionSchema = z.object({\n type: z.literal(\"mention\"),\n /** Display label as authored, e.g. `\"@PostHog\"`. */\n label: z.string(),\n /** Resolved participant id, filled when the mention binds to a participant. */\n id: z.string().optional(),\n});\nexport const inlineEmojiSchema = z.object({\n type: z.literal(\"emoji\"),\n /** The rendered glyph, e.g. `\"🦔\"`. */\n value: z.string(),\n /** Optional shortcode, e.g. `\"hedgehog\"`. */\n shortcode: z.string().optional(),\n});\n\nexport const inlineNodeSchema = z.discriminatedUnion(\"type\", [\n inlineTextSchema,\n inlineCodeSchema,\n inlineBoldSchema,\n inlineItalicSchema,\n inlineStrikeSchema,\n inlineLinkSchema,\n inlineMentionSchema,\n inlineEmojiSchema,\n]);\nexport type InlineNode = z.infer<typeof inlineNodeSchema>;\n\n/** A block of inline content. */\nexport const textNodeSchema = z.object({\n type: z.literal(\"text\"),\n spans: z.array(inlineNodeSchema),\n});\nexport type TextNode = z.infer<typeof textNodeSchema>;\n\n/** An in-message image (same hosting model as avatars, per `meta.assets`). */\nexport const imageNodeSchema = z.object({\n type: z.literal(\"image\"),\n src: z.string(),\n alt: z.string().optional(),\n width: z.number().positive().optional(),\n height: z.number().positive().optional(),\n});\nexport type ImageNode = z.infer<typeof imageNodeSchema>;\n\n// --- Block Kit content nodes -------------------------------------------------\n// Slack apps compose rich messages from \"blocks\". These model the common set\n// (header / section / context / divider / actions / image / attachment) so an\n// app message is a normal message from an `app` participant whose `content`\n// carries blocks — the same primitives a real Slack app would emit. Skins that\n// don't understand a block skip it (lenient registry), so they're Slack-leaning\n// but safe everywhere.\n\n/**\n * An interactive button (in an `actions` block or as a `section` accessory).\n * With `href` the skin renders a link opening in a new tab; without one it's\n * visibly inert. `style` controls emphasis — omitted = default (outlined),\n * matching Slack's `primary`/`danger`/default button styles.\n */\nexport const buttonElementSchema = z.object({\n type: z.literal(\"button\"),\n label: z.string(),\n href: z.string().optional(),\n style: z.enum([\"primary\", \"danger\"]).optional(),\n});\nexport type ButtonElement = z.infer<typeof buttonElementSchema>;\n\n/** A small image element (a `context` element or a `section` accessory). */\nexport const imageElementSchema = z.object({\n type: z.literal(\"image\"),\n src: z.string(),\n alt: z.string().optional(),\n});\nexport type ImageElement = z.infer<typeof imageElementSchema>;\n\n/** A large bold heading (Block Kit `header` — plain text, no inline marks). */\nexport const headerNodeSchema = z.object({\n type: z.literal(\"header\"),\n text: z.string(),\n});\nexport type HeaderNode = z.infer<typeof headerNodeSchema>;\n\n/**\n * A section block: a paragraph of inline content, with an optional `accessory`\n * (a button or image to its right) and optional `fields` (a two-column grid).\n * Text may be authored as `spans` (resolved) or `text` (sugar, parsed to spans\n * by `toContentNodes`).\n */\nexport const sectionFieldSchema = z.object({\n spans: z.array(inlineNodeSchema).optional(),\n text: z.string().optional(),\n});\nexport const sectionNodeSchema = z.object({\n type: z.literal(\"section\"),\n spans: z.array(inlineNodeSchema).optional(),\n text: z.string().optional(),\n accessory: z\n .discriminatedUnion(\"type\", [buttonElementSchema, imageElementSchema])\n .optional(),\n fields: z.array(sectionFieldSchema).optional(),\n});\nexport type SectionNode = z.infer<typeof sectionNodeSchema>;\n\n/** A context block: a row of small, muted text/image elements. */\nexport const contextTextElementSchema = z.object({\n type: z.literal(\"text\"),\n spans: z.array(inlineNodeSchema).optional(),\n text: z.string().optional(),\n});\nexport const contextElementSchema = z.discriminatedUnion(\"type\", [\n contextTextElementSchema,\n imageElementSchema,\n]);\nexport type ContextElement = z.infer<typeof contextElementSchema>;\nexport const contextNodeSchema = z.object({\n type: z.literal(\"context\"),\n elements: z.array(contextElementSchema),\n});\nexport type ContextNode = z.infer<typeof contextNodeSchema>;\n\n/** A horizontal rule between blocks. */\nexport const dividerNodeSchema = z.object({\n type: z.literal(\"divider\"),\n});\nexport type DividerNode = z.infer<typeof dividerNodeSchema>;\n\n/** A row of interactive buttons. */\nexport const actionsNodeSchema = z.object({\n type: z.literal(\"actions\"),\n elements: z.array(buttonElementSchema),\n});\nexport type ActionsNode = z.infer<typeof actionsNodeSchema>;\n\n/**\n * A legacy-style attachment: nested blocks rendered behind a colored left bar.\n * `color` is any CSS color (defaults to a neutral bar). Recursive — its Zod\n * schema lives in `content-registry.ts` (where the node union is built).\n */\nexport interface AttachmentNode {\n type: \"attachment\";\n color?: string;\n content: ContentNode[];\n}\n\n/**\n * A content node whose `type` the runtime doesn't recognize. It validates\n * leniently (only `type` is required) and is skipped by skins that don't handle\n * it — so future node types (`linkPreview`, `videoEmbed`, …) slot in without\n * breaking older runtimes or bumping the schema version.\n */\nexport interface UnknownContentNode {\n type: string;\n [key: string]: unknown;\n}\n\n/** The body of a message: an ordered list of content nodes. */\nexport type ContentNode =\n | TextNode\n | ImageNode\n | HeaderNode\n | SectionNode\n | ContextNode\n | DividerNode\n | ActionsNode\n | AttachmentNode\n | UnknownContentNode;\n","import { z } from \"zod\";\nimport {\n actionsNodeSchema,\n contextNodeSchema,\n dividerNodeSchema,\n headerNodeSchema,\n imageNodeSchema,\n sectionNodeSchema,\n textNodeSchema,\n type AttachmentNode,\n type ContentNode,\n} from \"./content-nodes.js\";\n\n/**\n * A legacy-style attachment node — nested blocks behind a colored left bar.\n * Recursive (its `content` is the full node array), so it's defined here where\n * `contentSchema` is in scope and wrapped in `z.lazy` to defer the reference.\n */\nexport const attachmentNodeSchema: z.ZodType<AttachmentNode> = z.lazy(() =>\n z.object({\n type: z.literal(\"attachment\"),\n color: z.string().optional(),\n content: contentSchema,\n }),\n);\n\n/**\n * The content-type registry. Each message body node has a `type` resolved\n * through here. Built-ins cover text/image plus the Block Kit blocks\n * (header/section/context/divider/actions/attachment); additional types can be\n * registered (with their own strict schema) without a schema-version bump.\n *\n * Nodes whose `type` is **not** registered validate leniently (only `type` is\n * required) and are skipped by skins that don't handle them. Nodes whose `type`\n * **is** registered must satisfy that type's schema — so a malformed `text`\n * node is an error rather than silently passing through the lenient path.\n */\nconst registry = new Map<string, z.ZodTypeAny>([\n [\"text\", textNodeSchema],\n [\"image\", imageNodeSchema],\n [\"header\", headerNodeSchema],\n [\"section\", sectionNodeSchema],\n [\"context\", contextNodeSchema],\n [\"divider\", dividerNodeSchema],\n [\"actions\", actionsNodeSchema],\n [\"attachment\", attachmentNodeSchema],\n]);\n\n/** Register (or override) the strict schema for a content node type. */\nexport function registerContentNodeType(\n type: string,\n schema: z.ZodTypeAny,\n): void {\n registry.set(type, schema);\n}\n\n/** The content node types the runtime validates strictly. */\nexport function knownContentNodeTypes(): string[] {\n return [...registry.keys()];\n}\n\nexport function isKnownContentNodeType(type: string): boolean {\n return registry.has(type);\n}\n\n/** Accepts any object with a string `type` that isn't a registered type. */\nconst lenientUnknownNodeSchema = z\n .looseObject({ type: z.string() })\n .refine((node) => !registry.has(node.type), {\n message: \"malformed content node for a registered type\",\n });\n\n/**\n * Build a content-node schema from the current registry state. Call this after\n * registering a new type to pick it up; `contentNodeSchema` below is the\n * default built from the v1 registry (`text` + `image`).\n */\nexport function buildContentNodeSchema(): z.ZodType<ContentNode> {\n return z.union([\n ...registry.values(),\n lenientUnknownNodeSchema,\n ]) as unknown as z.ZodType<ContentNode>;\n}\n\n/** Default content-node schema (text + image + lenient unknown). */\nexport const contentNodeSchema = buildContentNodeSchema();\n\n/** A message body: an ordered array of content nodes. */\nexport const contentSchema = z.array(contentNodeSchema);\n","import type {\n AttachmentNode,\n ContentNode,\n ContextNode,\n ImageNode,\n InlineNode,\n SectionNode,\n TextNode,\n} from \"./content-nodes.js\";\n\n/**\n * Matches an inline mark, in priority order: a backtick code span, Slack mrkdwn\n * emphasis (`*bold*`, `_italic_`, `~strike~`), an http(s) link, a `<@id>`\n * mention (Slack's encoded form — resolved to a display name at compile), or a\n * bare `@name` mention. Everything else becomes plain text runs.\n *\n * Emphasis delimiters must hug their content (no leading/trailing space), and\n * `_italic_` requires non-alphanumeric boundaries so `snake_case` and URLs with\n * underscores are left alone.\n */\nconst INLINE_TOKEN =\n /`([^`]+)`|\\*(?!\\s)([^*\\n]+?)(?<!\\s)\\*|(?<![A-Za-z0-9])_(?!\\s)([^_\\n]+?)(?<!\\s)_(?![A-Za-z0-9])|~(?!\\s)([^~\\n]+?)(?<!\\s)~|(https?:\\/\\/[^\\s]+)|<@([A-Za-z0-9_.-]+)>|(@[A-Za-z0-9_][\\w.-]*)/g;\n\n/**\n * Parse a plain authoring string into inline nodes, extracting inline `code`,\n * `bold`/`italic`/`strike`, links, and mentions. Emoji are left inside text\n * runs (they render fine; a dedicated emoji mark can be authored explicitly).\n * A `<@id>` mention carries its `id` and a placeholder label; the engine\n * resolves the label to the participant's display name at compile time.\n */\nexport function parseInline(text: string): InlineNode[] {\n if (text.length === 0) return [];\n const spans: InlineNode[] = [];\n const re = new RegExp(INLINE_TOKEN.source, \"g\");\n let lastIndex = 0;\n let match: RegExpExecArray | null;\n while ((match = re.exec(text)) !== null) {\n const matchText = match[0] ?? \"\";\n if (match.index > lastIndex) {\n spans.push({ type: \"text\", value: text.slice(lastIndex, match.index) });\n }\n if (match[1] !== undefined) {\n spans.push({ type: \"code\", value: match[1] });\n } else if (match[2] !== undefined) {\n spans.push({ type: \"bold\", value: match[2] });\n } else if (match[3] !== undefined) {\n spans.push({ type: \"italic\", value: match[3] });\n } else if (match[4] !== undefined) {\n spans.push({ type: \"strike\", value: match[4] });\n } else if (match[5] !== undefined) {\n spans.push({ type: \"link\", href: match[5] });\n } else if (match[6] !== undefined) {\n spans.push({ type: \"mention\", id: match[6], label: `@${match[6]}` });\n } else if (match[7] !== undefined) {\n spans.push({ type: \"mention\", label: match[7] });\n }\n lastIndex = match.index + matchText.length;\n }\n if (lastIndex < text.length) {\n spans.push({ type: \"text\", value: text.slice(lastIndex) });\n }\n return spans;\n}\n\n/** Convenience shape for authoring an in-message image. */\nexport interface ImageSugar {\n src: string;\n alt?: string;\n width?: number;\n height?: number;\n}\n\n/** `text` string → a single text content node. */\nexport function textToContentNode(text: string): TextNode {\n return { type: \"text\", spans: parseInline(text) };\n}\n\n/** `image` sugar → an image content node (drops undefined optionals). */\nexport function imageToContentNode(image: ImageSugar): ImageNode {\n const node: ImageNode = { type: \"image\", src: image.src };\n if (image.alt !== undefined) node.alt = image.alt;\n if (image.width !== undefined) node.width = image.width;\n if (image.height !== undefined) node.height = image.height;\n return node;\n}\n\n/** The sugar fields a message may carry instead of explicit `content`. */\nexport interface MessageBodySugar {\n /** Authored text (parsed into inline marks). */\n text?: string;\n /** In-message images, rendered after the text. */\n images?: ImageSugar[];\n /** Explicit content nodes; when present, wins over `text`/`images`. */\n content?: ContentNode[];\n}\n\n/**\n * Resolve a block's `text` sugar to `spans` (and recurse into attachments), so\n * skins only ever read resolved inline content. Non-text blocks pass through.\n */\nexport function normalizeContentNode(node: ContentNode): ContentNode {\n // Explicit casts: `ContentNode` includes the lenient `UnknownContentNode`\n // (index signature), so a plain `switch` widens the narrowed fields to\n // `unknown`. The runtime `type` check is authoritative.\n if (node.type === \"section\") {\n const s = node as SectionNode;\n return {\n type: \"section\",\n spans: s.spans ?? parseInline(s.text ?? \"\"),\n ...(s.accessory ? { accessory: s.accessory } : {}),\n ...(s.fields\n ? {\n fields: s.fields.map((f) => ({\n spans: f.spans ?? parseInline(f.text ?? \"\"),\n })),\n }\n : {}),\n };\n }\n if (node.type === \"context\") {\n const c = node as ContextNode;\n return {\n type: \"context\",\n elements: c.elements.map((el) =>\n el.type === \"text\"\n ? { type: \"text\", spans: el.spans ?? parseInline(el.text ?? \"\") }\n : el,\n ),\n };\n }\n if (node.type === \"attachment\") {\n const a = node as AttachmentNode;\n return {\n type: \"attachment\",\n ...(a.color ? { color: a.color } : {}),\n content: a.content.map(normalizeContentNode),\n };\n }\n return node;\n}\n\n/**\n * Resolve a message's body sugar to content nodes. Explicit `content` is\n * authoritative (block `text` sugar is normalized to spans); otherwise the text\n * node (if any) comes first, then images — matching the \"here's the toast:\n * [image]\" ordering in the spec example.\n */\nexport function toContentNodes(body: MessageBodySugar): ContentNode[] {\n if (body.content) return body.content.map(normalizeContentNode);\n const nodes: ContentNode[] = [];\n if (body.text !== undefined && body.text.length > 0) {\n nodes.push(textToContentNode(body.text));\n }\n if (body.images) {\n for (const image of body.images) nodes.push(imageToContentNode(image));\n }\n return nodes;\n}\n","import { z } from \"zod\";\nimport { contentSchema } from \"./content-registry.js\";\n\n/**\n * Per-step overrides shared by every step. The engine computes timing from the\n * pacing model; these win over the computed values. Use a dedicated `delay`\n * step type to insert explicit pauses on the timeline.\n */\nconst stepBaseShape = {\n /** Optional id so reactions/edits/deletes can target this step's message. */\n id: z.string().optional(),\n /** Reveal with no animation and no computed delay. */\n instant: z.boolean().optional(),\n};\n\n/** Authoring sugar for an in-message image (compiled to an image node). */\nexport const imageSugarSchema = z.object({\n src: z.string(),\n alt: z.string().optional(),\n width: z.number().positive().optional(),\n height: z.number().positive().optional(),\n});\n\n/** Message-body sugar fields; `content` (explicit nodes) wins when present. */\nconst bodyShape = {\n text: z.string().optional(),\n images: z.array(imageSugarSchema).optional(),\n content: contentSchema.optional(),\n};\n\n/** Optional typing indicator preceding a message. */\nconst messageTypingSchema = z.union([\n z.boolean(),\n z.object({ showTypingFor: z.number().nonnegative().optional() }),\n]);\n\n/** An incoming message, optionally preceded by a typing indicator. */\nexport const messageStepSchema = z.object({\n type: z.literal(\"message\"),\n from: z.string(),\n typing: messageTypingSchema.optional(),\n ...bodyShape,\n ...stepBaseShape,\n});\n\n/** A reaction landing on a target message (`$prev` or a message id). */\nexport const reactionStepSchema = z.object({\n type: z.literal(\"reaction\"),\n /** Message id to react to. Defaults to `$prev` (the most-recent message). */\n target: z.string().optional(),\n emoji: z.string(),\n /** Emoji shortcode without colons, e.g. `\"eyes\"` — shown in skin tooltips. */\n shortcode: z.string().optional(),\n from: z.string().optional(),\n /** Gap from when the target appears, before the reaction lands (ms). */\n delay: z.number().nonnegative().optional(),\n ...stepBaseShape,\n});\n\n/** A standalone typing indicator (no message necessarily follows). */\nexport const typingStepSchema = z.object({\n type: z.literal(\"typing\"),\n from: z.string(),\n showTypingFor: z.number().nonnegative().optional(),\n ...stepBaseShape,\n});\n\n/** The self participant typing into the composer, char by char. */\nexport const composerTypeStepSchema = z.object({\n type: z.literal(\"composerType\"),\n from: z.string(),\n text: z.string(),\n /** Override the computed typing duration (ms). */\n typingDuration: z.number().nonnegative().optional(),\n ...stepBaseShape,\n});\n\n/** Commit the composer's current text to the thread. */\nexport const sendStepSchema = z.object({\n type: z.literal(\"send\"),\n from: z.string().optional(),\n ...stepBaseShape,\n});\n\n/** Edit a previously sent message's body. */\nexport const editStepSchema = z.object({\n type: z.literal(\"edit\"),\n /** Message id to edit. Defaults to `$prev` (the most-recent message). */\n target: z.string().optional(),\n ...bodyShape,\n ...stepBaseShape,\n});\n\n/** Delete a previously sent message. */\nexport const deleteStepSchema = z.object({\n type: z.literal(\"delete\"),\n /** Message id to delete. Defaults to `$prev` (the most-recent message). */\n target: z.string().optional(),\n ...stepBaseShape,\n});\n\n/** A read receipt (optionally by a participant, optionally up to a message). */\nexport const readReceiptStepSchema = z.object({\n type: z.literal(\"readReceipt\"),\n by: z.string().optional(),\n target: z.string().optional(),\n ...stepBaseShape,\n});\n\n/**\n * A system / notice line — not a chat message. Skins render it distinctly: a\n * centered muted notice (iMessage/WhatsApp/Slack \"X joined #channel\"), an agent\n * tool-output line (Cursor/Claude Code `⎿ …`), a CI notice (Discord), etc. App\n * \"cards\" are NOT system steps — model those as a `message` from an `app`\n * participant carrying Block Kit content (header/section/context/actions/…).\n */\nexport const systemStepSchema = z.object({\n type: z.literal(\"system\"),\n from: z.string().optional(),\n ...bodyShape,\n ...stepBaseShape,\n});\n\n/** An explicit pause in the timeline (formerly `beat`). */\nexport const delayStepSchema = z.object({\n type: z.literal(\"delay\"),\n duration: z.number().nonnegative(),\n ...stepBaseShape,\n});\n\nexport const timelineStepSchema = z.discriminatedUnion(\"type\", [\n messageStepSchema,\n reactionStepSchema,\n typingStepSchema,\n composerTypeStepSchema,\n sendStepSchema,\n editStepSchema,\n deleteStepSchema,\n readReceiptStepSchema,\n systemStepSchema,\n delayStepSchema,\n]);\nexport type TimelineStep = z.infer<typeof timelineStepSchema>;\nexport type TimelineStepInput = z.input<typeof timelineStepSchema>;\n\nexport const timelineSchema = z.array(timelineStepSchema);\n\n/** The discriminant values of every timeline step. */\nexport const STEP_TYPES = [\n \"message\",\n \"reaction\",\n \"typing\",\n \"composerType\",\n \"send\",\n \"edit\",\n \"delete\",\n \"readReceipt\",\n \"system\",\n \"delay\",\n] as const;\nexport type StepType = (typeof STEP_TYPES)[number];\n","import { z } from \"zod\";\nimport { metaSchema } from \"./meta.js\";\nimport { participantsSchema } from \"./participants.js\";\nimport { pacingSchema } from \"./pacing.js\";\nimport { timelineSchema } from \"./timeline.js\";\n\n/**\n * The config schema version. Distinct from the `@typecaast/schema` package\n * version (related but versioned independently — see PLAN §22). A config newer\n * than the installed runtime fails parsing with a clear error.\n */\nexport const CONFIG_VERSION = 1;\n\n/** The complete Typecaast config: the single source of truth for a simulation. */\nexport const configSchema = z.object({\n version: z.literal(CONFIG_VERSION),\n meta: metaSchema,\n participants: participantsSchema,\n /** Optional; omitted pacing resolves to the full default model. */\n pacing: pacingSchema.default(() => pacingSchema.parse({})),\n timeline: timelineSchema,\n});\n\n/** A parsed config (defaults applied). */\nexport type Config = z.infer<typeof configSchema>;\n/** A config as authored (fields with defaults are optional). */\nexport type ConfigInput = z.input<typeof configSchema>;\n\n/**\n * Generate the JSON Schema for a Typecaast config (for editor autocomplete and\n * `$schema` references). Lazy so importing the package never eagerly runs the\n * conversion. Refinements (e.g. the lenient content-node guard) are not\n * representable in JSON Schema and are dropped.\n */\nexport function configJsonSchema(): Record<string, unknown> {\n return z.toJSONSchema(configSchema, {\n unrepresentable: \"any\",\n target: \"draft-7\",\n }) as Record<string, unknown>;\n}\n","import { CONFIG_VERSION, configSchema } from \"./config.js\";\n\n/** Diagnostic severity tiers (PLAN §23). */\nexport type Severity = \"error\" | \"warning\" | \"info\";\n\n/**\n * A single validation finding. Every diagnostic carries a stable `code`, the\n * offending `location` (step/message/path), and a `hint` for remediation.\n */\nexport interface Diagnostic {\n code: string;\n severity: Severity;\n message: string;\n /** Dotted/indexed path, e.g. `timeline[3].from` or `meta.canvas.width`. */\n location?: string;\n hint?: string;\n}\n\nfunction formatPath(path: ReadonlyArray<PropertyKey>): string {\n let out = \"\";\n for (const key of path) {\n if (typeof key === \"number\") out += `[${key}]`;\n else if (out === \"\") out += String(key);\n else out += `.${String(key)}`;\n }\n return out;\n}\n\n/** Read an optional `from`/`by`/`target` field off any step shape. */\nfunction field(step: unknown, key: string): string | undefined {\n const value = (step as Record<string, unknown>)[key];\n return typeof value === \"string\" ? value : undefined;\n}\n\n/**\n * Validate a parsed config value (already JSON-decoded). Returns all\n * diagnostics — schema errors, then semantic checks (reference integrity,\n * target resolution). Reusable by the CLI and the builder's lint panel.\n *\n * A version newer than the runtime short-circuits with a single hard error.\n */\nexport function validateConfig(raw: unknown): Diagnostic[] {\n const diagnostics: Diagnostic[] = [];\n\n if (raw && typeof raw === \"object\" && \"version\" in raw) {\n const version = (raw as { version: unknown }).version;\n if (typeof version === \"number\" && version > CONFIG_VERSION) {\n return [\n {\n code: \"E_VERSION\",\n severity: \"error\",\n message: `Config version ${version} is newer than this runtime supports (max ${CONFIG_VERSION}).`,\n location: \"version\",\n hint: \"Upgrade Typecaast (e.g. `npm i @typecaast/cli@latest`).\",\n },\n ];\n }\n }\n\n const result = configSchema.safeParse(raw);\n if (!result.success) {\n for (const issue of result.error.issues) {\n diagnostics.push({\n code: \"E_SCHEMA\",\n severity: \"error\",\n message: issue.message,\n location: formatPath(issue.path) || undefined,\n });\n }\n return diagnostics;\n }\n\n const config = result.data;\n\n // Duplicate participant ids.\n const ids = config.participants.map((p) => p.id);\n const idSet = new Set(ids);\n for (const dup of new Set(ids.filter((id, i) => ids.indexOf(id) !== i))) {\n diagnostics.push({\n code: \"E_DUP_PARTICIPANT\",\n severity: \"error\",\n message: `Duplicate participant id \"${dup}\".`,\n location: \"participants\",\n hint: \"Participant ids must be unique.\",\n });\n }\n\n const hasSelf = config.participants.some((p) => p.isSelf);\n let warnedNoSelf = false;\n const messageIds = new Set<string>();\n let priorMessages = 0;\n\n config.timeline.forEach((step, i) => {\n const loc = `timeline[${i}]`;\n\n const from = field(step, \"from\");\n if (from !== undefined && !idSet.has(from)) {\n diagnostics.push({\n code: \"E_REF_PARTICIPANT\",\n severity: \"error\",\n message: `Step references unknown participant \"${from}\".`,\n location: `${loc}.from`,\n hint: `Add a participant with id \"${from}\" or fix the reference.`,\n });\n }\n\n if (step.type === \"readReceipt\") {\n const by = field(step, \"by\");\n if (by !== undefined && !idSet.has(by)) {\n diagnostics.push({\n code: \"E_REF_PARTICIPANT\",\n severity: \"error\",\n message: `Read receipt references unknown participant \"${by}\".`,\n location: `${loc}.by`,\n hint: `Add a participant with id \"${by}\" or fix the reference.`,\n });\n }\n }\n\n if (\n (step.type === \"composerType\" || step.type === \"send\") &&\n !hasSelf &&\n !warnedNoSelf\n ) {\n warnedNoSelf = true;\n diagnostics.push({\n code: \"W_NO_SELF\",\n severity: \"warning\",\n message: \"The composer is used but no participant is marked as self.\",\n location: loc,\n hint: 'Mark a participant with `\"isSelf\": true`.',\n });\n }\n\n if (\n (step.type === \"message\" || step.type === \"system\") &&\n typeof step.id === \"string\"\n ) {\n messageIds.add(step.id);\n }\n\n if (\n step.type === \"reaction\" ||\n step.type === \"edit\" ||\n step.type === \"delete\"\n ) {\n const target = step.target;\n // Blank/`$prev` both mean \"the most-recent message\".\n if (!target || target === \"$prev\") {\n if (priorMessages === 0) {\n diagnostics.push({\n code: \"W_NO_PREV\",\n severity: \"warning\",\n message: \"Default target has no preceding message.\",\n location: `${loc}.target`,\n hint: \"Place this after a message, or set a target message id.\",\n });\n }\n } else if (!messageIds.has(target)) {\n diagnostics.push({\n code: \"W_TARGET\",\n severity: \"warning\",\n message: `Target \"${target}\" matches no preceding message id.`,\n location: `${loc}.target`,\n hint: 'Give the target message an `\"id\"`, or check the reference.',\n });\n }\n }\n\n if (step.type === \"message\" || step.type === \"system\") priorMessages++;\n });\n\n return diagnostics;\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/meta.ts","../src/participants.ts","../src/pacing.ts","../src/content-nodes.ts","../src/content-registry.ts","../src/content-sugar.ts","../src/timeline.ts","../src/config.ts","../src/validate.ts"],"names":["z"],"mappings":";;;;;AAGO,IAAM,UAAA,GAAaA,MAAE,MAAA,CAAO;AAAA,EACjC,OAAOA,KAAA,CAAE,MAAA,EAAO,CAAE,GAAA,GAAM,QAAA,EAAS;AAAA,EACjC,QAAQA,KAAA,CAAE,MAAA,EAAO,CAAE,GAAA,GAAM,QAAA;AAC3B,CAAC;AAgBM,IAAM,gBAAgBA,KAAA,CAAE,IAAA,CAAK,CAAC,QAAA,EAAU,OAAA,EAAS,OAAO,CAAC;AASzD,IAAM,qBAAqBA,KAAA,CAAE,IAAA,CAAK,CAAC,MAAA,EAAQ,QAAA,EAAU,OAAO,CAAC;AAQ7D,IAAM,kBAAkBA,KAAA,CAAE,IAAA,CAAK,CAAC,OAAA,EAAS,MAAA,EAAQ,MAAM,CAAC;AAQxD,IAAM,kBAAkBA,KAAA,CAAE,IAAA,CAAK,CAAC,QAAA,EAAU,KAAK,CAAC;AAIhD,IAAM,aAAA,GAAgBA,MAAE,MAAA,CAAO;AAAA,EACpC,EAAA,EAAIA,KAAA,CAAE,MAAA,EAAO,CAAE,IAAI,CAAC,CAAA;AAAA,EACpB,OAAA,EAASA,KAAA,CAAE,MAAA,CAAOA,KAAA,CAAE,MAAA,IAAUA,KAAA,CAAE,OAAA,EAAS,CAAA,CAAE,QAAA;AAC7C,CAAC;AAIM,IAAM,UAAA,GAAaA,MAAE,MAAA,CAAO;AA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AAa,IAAA,CAAK,SAAS,QAAA,KAC1C,OAAO,IAAA,CAAK,EAAA,KAAO,QAAA,EACnB;AACA,MAAA,UAAA,CAAW,GAAA,CAAI,KAAK,EAAE,CAAA;AAAA,IACxB;AAEA,IAAA,IACE,IAAA,CAAK,SAAS,UAAA,IACd,IAAA,CAAK,SAAS,MAAA,IACd,IAAA,CAAK,SAAS,QAAA,EACd;AACA,MAAA,MAAM,SAAS,IAAA,CAAK,MAAA;AAEpB,MAAA,IAAI,CAAC,MAAA,IAAU,MAAA,KAAW,OAAA,EAAS;AACjC,QAAA,IAAI,kBAAkB,CAAA,EAAG;AACvB,UAAA,WAAA,CAAY,IAAA,CAAK;AAAA,YACf,IAAA,EAAM,WAAA;AAAA,YACN,QAAA,EAAU,SAAA;AAAA,YACV,OAAA,EAAS,0CAAA;AAAA,YACT,QAAA,EAAU,GAAG,GAAG,CAAA,OAAA,CAAA;AAAA,YAChB,IAAA,EAAM;AAAA,WACP,CAAA;AAAA,QACH;AAAA,MACF,CAAA,MAAA,IAAW,CAAC,UAAA,CAAW,GAAA,CAAI,MAAM,CAAA,EAAG;AAClC,QAAA,WAAA,CAAY,IAAA,CAAK;AAAA,UACf,IAAA,EAAM,UAAA;AAAA,UACN,QAAA,EAAU,SAAA;AAAA,UACV,OAAA,EAAS,WAAW,MAAM,CAAA,kCAAA,CAAA;AAAA,UAC1B,QAAA,EAAU,GAAG,GAAG,CAAA,OAAA,CAAA;AAAA,UAChB,IAAA,EAAM;AAAA,SACP,CAAA;AAAA,MACH;AAAA,IACF;AAEA,IAAA,IAAI,IAAA,CAAK,IAAA,KAAS,SAAA,IAAa,IAAA,CAAK,SAAS,QAAA,EAAU,aAAA,EAAA;AAAA,EACzD,CAAC,CAAA;AAED,EAAA,OAAO,WAAA;AACT","file":"index.cjs","sourcesContent":["import { z } from \"zod\";\n\n/** A pixel dimension pair (authoring reference; the exact frame for video). */\nexport const sizeSchema = z.object({\n width: z.number().int().positive(),\n height: z.number().int().positive(),\n});\nexport type Size = z.infer<typeof sizeSchema>;\n\n/**\n * How the rendered conversation fills its container. The widget is\n * **container-driven** in the first two modes — its size never grows\n * with content; messages clip when they overflow the bottom-anchored\n * thread.\n * - `reflow`: fills the container in both axes; bubbles re-wrap to the\n * container width.\n * - `scale`: renders at the exact authored canvas size and CSS-scales\n * to fit (preserves the canonical layout — letterboxes if the\n * container's aspect doesn't match the canvas).\n * - `fixed`: pins the widget to the authored canvas px; clips. The only\n * non-container-driven mode.\n */\nexport const fitModeSchema = z.enum([\"reflow\", \"scale\", \"fixed\"]);\nexport type FitMode = z.infer<typeof fitModeSchema>;\n\n/**\n * Reply-box (composer) visibility:\n * - `auto`: shown only while someone is typing/sending (default).\n * - `always`: keep the message input visible the whole time.\n * - `never`: never show it.\n */\nexport const composerModeSchema = z.enum([\"auto\", \"always\", \"never\"]);\nexport type ComposerMode = z.infer<typeof composerModeSchema>;\n\n/**\n * Color theme. `auto` inherits the host page's `prefers-color-scheme` (live\n * preview) and falls back to `light`; video export resolves `auto` to a\n * concrete mode and defaults to `light` when unspecified.\n */\nexport const themeModeSchema = z.enum([\"light\", \"dark\", \"auto\"]);\nexport type ThemeMode = z.infer<typeof themeModeSchema>;\n\n/**\n * Asset resolution strategy.\n * - `inline`: embed images as data URLs (self-contained config; default).\n * - `url`: reference hosted images (smaller config; user hosts their own).\n */\nexport const assetModeSchema = z.enum([\"inline\", \"url\"]);\nexport type AssetMode = z.infer<typeof assetModeSchema>;\n\n/** Reference to a skin plus its skin-specific options (validated by the skin). */\nexport const skinRefSchema = z.object({\n id: z.string().min(1),\n options: z.record(z.string(), z.unknown()).optional(),\n});\nexport type SkinRef = z.infer<typeof skinRefSchema>;\n\n/** Top-level rendering/authoring metadata. */\nexport const metaSchema = z.object({\n /** Authoring reference size; fixed frame for video. */\n canvas: sizeSchema,\n fps: z.number().int().positive().default(30),\n fit: fitModeSchema.default(\"reflow\"),\n theme: themeModeSchema.default(\"auto\"),\n skin: skinRefSchema,\n /** Seed for all deterministic jitter (no `Math.random`). */\n seed: z.number().int().default(42),\n /** Canvas background: `\"transparent\"` or any CSS color. */\n background: z.string().default(\"transparent\"),\n assets: assetModeSchema.default(\"inline\"),\n /** Reply-box visibility (see `composerModeSchema`). */\n composer: composerModeSchema.default(\"auto\"),\n /**\n * Auto-replay when the timeline reaches the end. Honored by the builder\n * preview and by `<Typecaast>` when the consumer doesn't pass an explicit\n * `loop` prop.\n */\n loop: z.boolean().default(false),\n});\n\n/** `meta` as it appears after parsing (defaults applied). */\nexport type Meta = z.infer<typeof metaSchema>;\n/** `meta` as authored (fields with defaults are optional). */\nexport type MetaInput = z.input<typeof metaSchema>;\n","import { z } from \"zod\";\n\n/** Whether a participant is a human or an app/bot (changes how skins render it). */\nexport const participantKindSchema = z.enum([\"person\", \"app\"]);\nexport type ParticipantKind = z.infer<typeof participantKindSchema>;\n\n/** A speaker in the conversation. */\nexport const participantSchema = z.object({\n /** Stable id referenced by timeline steps (`from`, `target`, …). */\n id: z.string().min(1),\n name: z.string().min(1),\n /** Avatar asset (data URL or referenced URL per `meta.assets`). */\n avatar: z.string().optional(),\n /** Accent color (CSS color) some skins use for the author. */\n color: z.string().optional(),\n /** The viewer — rendered as the \"self\" side and the composer's author. */\n isSelf: z.boolean().optional(),\n kind: participantKindSchema.default(\"person\"),\n});\nexport type Participant = z.infer<typeof participantSchema>;\nexport type ParticipantInput = z.input<typeof participantSchema>;\n\nexport const participantsSchema = z.array(participantSchema);\n","import { z } from \"zod\";\n\n/**\n * Global auto-pacing defaults. Every value is overridable per step in the\n * timeline; the engine computes delays/durations from these and bakes in\n * seeded, deterministic jitter (`humanize`).\n */\nexport const pacingSchema = z.object({\n /** Gap before an incoming message ≈ reading time of the prior message. */\n readingWpm: z.number().positive().default(240),\n /** Chars/sec for composer typing + sender typing duration. */\n typingCps: z.number().positive().default(14),\n /** ±fraction of seeded jitter so pacing doesn't feel robotic (0–1). */\n humanize: z.number().min(0).max(1).default(0.15),\n /** Delay before the first event. */\n startDelayMs: z.number().nonnegative().default(400),\n});\nexport type Pacing = z.infer<typeof pacingSchema>;\nexport type PacingInput = z.input<typeof pacingSchema>;\n","import { z } from \"zod\";\n\n/**\n * Inline marks inside a text node. `text` runs carry plain content; the others\n * are the recognized marks (`code`, `link`, `mention`, `emoji`, and the\n * emphasis marks `bold`/`italic`/`strike`). New marks can be added without a\n * schema-version bump (unknown content node types are handled leniently; see\n * the registry). Emphasis marks are flat (no nesting, e.g. bold *and* italic on\n * the same run) — a deliberate v1 simplification matching Slack's common usage.\n */\nexport const inlineTextSchema = z.object({\n type: z.literal(\"text\"),\n value: z.string(),\n});\nexport const inlineCodeSchema = z.object({\n type: z.literal(\"code\"),\n value: z.string(),\n});\nexport const inlineBoldSchema = z.object({\n type: z.literal(\"bold\"),\n value: z.string(),\n});\nexport const inlineItalicSchema = z.object({\n type: z.literal(\"italic\"),\n value: z.string(),\n});\nexport const inlineStrikeSchema = z.object({\n type: z.literal(\"strike\"),\n value: z.string(),\n});\nexport const inlineLinkSchema = z.object({\n type: z.literal(\"link\"),\n href: z.string(),\n label: z.string().optional(),\n});\nexport const inlineMentionSchema = z.object({\n type: z.literal(\"mention\"),\n /** Display label as authored, e.g. `\"@PostHog\"`. */\n label: z.string(),\n /** Resolved participant id, filled when the mention binds to a participant. */\n id: z.string().optional(),\n});\nexport const inlineEmojiSchema = z.object({\n type: z.literal(\"emoji\"),\n /** The rendered glyph, e.g. `\"🦔\"`. */\n value: z.string(),\n /** Optional shortcode, e.g. `\"hedgehog\"`. */\n shortcode: z.string().optional(),\n});\n\nexport const inlineNodeSchema = z.discriminatedUnion(\"type\", [\n inlineTextSchema,\n inlineCodeSchema,\n inlineBoldSchema,\n inlineItalicSchema,\n inlineStrikeSchema,\n inlineLinkSchema,\n inlineMentionSchema,\n inlineEmojiSchema,\n]);\nexport type InlineNode = z.infer<typeof inlineNodeSchema>;\n\n/** A block of inline content. */\nexport const textNodeSchema = z.object({\n type: z.literal(\"text\"),\n spans: z.array(inlineNodeSchema),\n});\nexport type TextNode = z.infer<typeof textNodeSchema>;\n\n/** An in-message image (same hosting model as avatars, per `meta.assets`). */\nexport const imageNodeSchema = z.object({\n type: z.literal(\"image\"),\n src: z.string(),\n alt: z.string().optional(),\n width: z.number().positive().optional(),\n height: z.number().positive().optional(),\n});\nexport type ImageNode = z.infer<typeof imageNodeSchema>;\n\n// --- Block Kit content nodes -------------------------------------------------\n// Slack apps compose rich messages from \"blocks\". These model the common set\n// (header / section / context / divider / actions / image / attachment) so an\n// app message is a normal message from an `app` participant whose `content`\n// carries blocks — the same primitives a real Slack app would emit. Skins that\n// don't understand a block skip it (lenient registry), so they're Slack-leaning\n// but safe everywhere.\n\n/**\n * An interactive button (in an `actions` block or as a `section` accessory).\n * With `href` the skin renders a link opening in a new tab; without one it's\n * visibly inert. `style` controls emphasis — omitted = default (outlined),\n * matching Slack's `primary`/`danger`/default button styles.\n */\nexport const buttonElementSchema = z.object({\n type: z.literal(\"button\"),\n label: z.string(),\n href: z.string().optional(),\n style: z.enum([\"primary\", \"danger\"]).optional(),\n});\nexport type ButtonElement = z.infer<typeof buttonElementSchema>;\n\n/** A small image element (a `context` element or a `section` accessory). */\nexport const imageElementSchema = z.object({\n type: z.literal(\"image\"),\n src: z.string(),\n alt: z.string().optional(),\n});\nexport type ImageElement = z.infer<typeof imageElementSchema>;\n\n/** A large bold heading (Block Kit `header` — plain text, no inline marks). */\nexport const headerNodeSchema = z.object({\n type: z.literal(\"header\"),\n text: z.string(),\n});\nexport type HeaderNode = z.infer<typeof headerNodeSchema>;\n\n/**\n * A section block: a paragraph of inline content, with an optional `accessory`\n * (a button or image to its right) and optional `fields` (a two-column grid).\n * Text may be authored as `spans` (resolved) or `text` (sugar, parsed to spans\n * by `toContentNodes`).\n */\nexport const sectionFieldSchema = z.object({\n spans: z.array(inlineNodeSchema).optional(),\n text: z.string().optional(),\n});\nexport const sectionNodeSchema = z.object({\n type: z.literal(\"section\"),\n spans: z.array(inlineNodeSchema).optional(),\n text: z.string().optional(),\n accessory: z\n .discriminatedUnion(\"type\", [buttonElementSchema, imageElementSchema])\n .optional(),\n fields: z.array(sectionFieldSchema).optional(),\n});\nexport type SectionNode = z.infer<typeof sectionNodeSchema>;\n\n/** A context block: a row of small, muted text/image elements. */\nexport const contextTextElementSchema = z.object({\n type: z.literal(\"text\"),\n spans: z.array(inlineNodeSchema).optional(),\n text: z.string().optional(),\n});\nexport const contextElementSchema = z.discriminatedUnion(\"type\", [\n contextTextElementSchema,\n imageElementSchema,\n]);\nexport type ContextElement = z.infer<typeof contextElementSchema>;\nexport const contextNodeSchema = z.object({\n type: z.literal(\"context\"),\n elements: z.array(contextElementSchema),\n});\nexport type ContextNode = z.infer<typeof contextNodeSchema>;\n\n/** A horizontal rule between blocks. */\nexport const dividerNodeSchema = z.object({\n type: z.literal(\"divider\"),\n});\nexport type DividerNode = z.infer<typeof dividerNodeSchema>;\n\n/** A row of interactive buttons. */\nexport const actionsNodeSchema = z.object({\n type: z.literal(\"actions\"),\n elements: z.array(buttonElementSchema),\n});\nexport type ActionsNode = z.infer<typeof actionsNodeSchema>;\n\n/**\n * A multi-line preformatted code block (Slack's fenced ``` block) — a monospaced\n * box that preserves whitespace and newlines verbatim (used for tables, logs,\n * snippets). Distinct from the inline `code` mark; `text` is **literal** and is\n * never parsed for inline marks. `lang` is an optional language hint (unused by\n * the current skins, reserved for future syntax highlighting).\n */\nexport const codeBlockNodeSchema = z.object({\n type: z.literal(\"codeblock\"),\n text: z.string(),\n lang: z.string().optional(),\n});\nexport type CodeBlockNode = z.infer<typeof codeBlockNodeSchema>;\n\n/**\n * A legacy-style attachment: nested blocks rendered behind a colored left bar.\n * `color` is any CSS color (defaults to a neutral bar). Recursive — its Zod\n * schema lives in `content-registry.ts` (where the node union is built).\n */\nexport interface AttachmentNode {\n type: \"attachment\";\n color?: string;\n content: ContentNode[];\n}\n\n/**\n * A content node whose `type` the runtime doesn't recognize. It validates\n * leniently (only `type` is required) and is skipped by skins that don't handle\n * it — so future node types (`linkPreview`, `videoEmbed`, …) slot in without\n * breaking older runtimes or bumping the schema version.\n */\nexport interface UnknownContentNode {\n type: string;\n [key: string]: unknown;\n}\n\n/** The body of a message: an ordered list of content nodes. */\nexport type ContentNode =\n | TextNode\n | ImageNode\n | HeaderNode\n | SectionNode\n | ContextNode\n | DividerNode\n | ActionsNode\n | CodeBlockNode\n | AttachmentNode\n | UnknownContentNode;\n","import { z } from \"zod\";\nimport {\n actionsNodeSchema,\n codeBlockNodeSchema,\n contextNodeSchema,\n dividerNodeSchema,\n headerNodeSchema,\n imageNodeSchema,\n sectionNodeSchema,\n textNodeSchema,\n type AttachmentNode,\n type ContentNode,\n} from \"./content-nodes.js\";\n\n/**\n * A legacy-style attachment node — nested blocks behind a colored left bar.\n * Recursive (its `content` is the full node array), so it's defined here where\n * `contentSchema` is in scope and wrapped in `z.lazy` to defer the reference.\n */\nexport const attachmentNodeSchema: z.ZodType<AttachmentNode> = z.lazy(() =>\n z.object({\n type: z.literal(\"attachment\"),\n color: z.string().optional(),\n content: contentSchema,\n }),\n);\n\n/**\n * The content-type registry. Each message body node has a `type` resolved\n * through here. Built-ins cover text/image plus the Block Kit blocks\n * (header/section/context/divider/actions/attachment); additional types can be\n * registered (with their own strict schema) without a schema-version bump.\n *\n * Nodes whose `type` is **not** registered validate leniently (only `type` is\n * required) and are skipped by skins that don't handle them. Nodes whose `type`\n * **is** registered must satisfy that type's schema — so a malformed `text`\n * node is an error rather than silently passing through the lenient path.\n */\nconst registry = new Map<string, z.ZodTypeAny>([\n [\"text\", textNodeSchema],\n [\"image\", imageNodeSchema],\n [\"header\", headerNodeSchema],\n [\"section\", sectionNodeSchema],\n [\"context\", contextNodeSchema],\n [\"divider\", dividerNodeSchema],\n [\"actions\", actionsNodeSchema],\n [\"codeblock\", codeBlockNodeSchema],\n [\"attachment\", attachmentNodeSchema],\n]);\n\n/** Register (or override) the strict schema for a content node type. */\nexport function registerContentNodeType(\n type: string,\n schema: z.ZodTypeAny,\n): void {\n registry.set(type, schema);\n}\n\n/** The content node types the runtime validates strictly. */\nexport function knownContentNodeTypes(): string[] {\n return [...registry.keys()];\n}\n\nexport function isKnownContentNodeType(type: string): boolean {\n return registry.has(type);\n}\n\n/** Accepts any object with a string `type` that isn't a registered type. */\nconst lenientUnknownNodeSchema = z\n .looseObject({ type: z.string() })\n .refine((node) => !registry.has(node.type), {\n message: \"malformed content node for a registered type\",\n });\n\n/**\n * Build a content-node schema from the current registry state. Call this after\n * registering a new type to pick it up; `contentNodeSchema` below is the\n * default built from the v1 registry (`text` + `image`).\n */\nexport function buildContentNodeSchema(): z.ZodType<ContentNode> {\n return z.union([\n ...registry.values(),\n lenientUnknownNodeSchema,\n ]) as unknown as z.ZodType<ContentNode>;\n}\n\n/** Default content-node schema (text + image + lenient unknown). */\nexport const contentNodeSchema = buildContentNodeSchema();\n\n/** A message body: an ordered array of content nodes. */\nexport const contentSchema = z.array(contentNodeSchema);\n","import type {\n AttachmentNode,\n ContentNode,\n ContextNode,\n ImageNode,\n InlineNode,\n SectionNode,\n TextNode,\n} from \"./content-nodes.js\";\n\n/**\n * Matches an inline mark, in priority order: a backtick code span, Slack mrkdwn\n * emphasis (`*bold*`, `_italic_`, `~strike~`), an http(s) link, a `<@id>`\n * mention (Slack's encoded form — resolved to a display name at compile), or a\n * bare `@name` mention. Everything else becomes plain text runs.\n *\n * Emphasis delimiters must hug their content (no leading/trailing space), and\n * `_italic_` requires non-alphanumeric boundaries so `snake_case` and URLs with\n * underscores are left alone.\n */\nconst INLINE_TOKEN =\n /`([^`]+)`|\\*(?!\\s)([^*\\n]+?)(?<!\\s)\\*|(?<![A-Za-z0-9])_(?!\\s)([^_\\n]+?)(?<!\\s)_(?![A-Za-z0-9])|~(?!\\s)([^~\\n]+?)(?<!\\s)~|(https?:\\/\\/[^\\s]+)|<@([A-Za-z0-9_.-]+)>|(@[A-Za-z0-9_][\\w.-]*)/g;\n\n/**\n * Parse a plain authoring string into inline nodes, extracting inline `code`,\n * `bold`/`italic`/`strike`, links, and mentions. Emoji are left inside text\n * runs (they render fine; a dedicated emoji mark can be authored explicitly).\n * A `<@id>` mention carries its `id` and a placeholder label; the engine\n * resolves the label to the participant's display name at compile time.\n */\nexport function parseInline(text: string): InlineNode[] {\n if (text.length === 0) return [];\n const spans: InlineNode[] = [];\n const re = new RegExp(INLINE_TOKEN.source, \"g\");\n let lastIndex = 0;\n let match: RegExpExecArray | null;\n while ((match = re.exec(text)) !== null) {\n const matchText = match[0] ?? \"\";\n if (match.index > lastIndex) {\n spans.push({ type: \"text\", value: text.slice(lastIndex, match.index) });\n }\n if (match[1] !== undefined) {\n spans.push({ type: \"code\", value: match[1] });\n } else if (match[2] !== undefined) {\n spans.push({ type: \"bold\", value: match[2] });\n } else if (match[3] !== undefined) {\n spans.push({ type: \"italic\", value: match[3] });\n } else if (match[4] !== undefined) {\n spans.push({ type: \"strike\", value: match[4] });\n } else if (match[5] !== undefined) {\n spans.push({ type: \"link\", href: match[5] });\n } else if (match[6] !== undefined) {\n spans.push({ type: \"mention\", id: match[6], label: `@${match[6]}` });\n } else if (match[7] !== undefined) {\n spans.push({ type: \"mention\", label: match[7] });\n }\n lastIndex = match.index + matchText.length;\n }\n if (lastIndex < text.length) {\n spans.push({ type: \"text\", value: text.slice(lastIndex) });\n }\n return spans;\n}\n\n/** Convenience shape for authoring an in-message image. */\nexport interface ImageSugar {\n src: string;\n alt?: string;\n width?: number;\n height?: number;\n}\n\n/** `text` string → a single text content node. */\nexport function textToContentNode(text: string): TextNode {\n return { type: \"text\", spans: parseInline(text) };\n}\n\n/** `image` sugar → an image content node (drops undefined optionals). */\nexport function imageToContentNode(image: ImageSugar): ImageNode {\n const node: ImageNode = { type: \"image\", src: image.src };\n if (image.alt !== undefined) node.alt = image.alt;\n if (image.width !== undefined) node.width = image.width;\n if (image.height !== undefined) node.height = image.height;\n return node;\n}\n\n/** The sugar fields a message may carry instead of explicit `content`. */\nexport interface MessageBodySugar {\n /** Authored text (parsed into inline marks). */\n text?: string;\n /** In-message images, rendered after the text. */\n images?: ImageSugar[];\n /** Explicit content nodes; when present, wins over `text`/`images`. */\n content?: ContentNode[];\n}\n\n/**\n * Resolve a block's `text` sugar to `spans` (and recurse into attachments), so\n * skins only ever read resolved inline content. Non-text blocks pass through.\n */\nexport function normalizeContentNode(node: ContentNode): ContentNode {\n // Explicit casts: `ContentNode` includes the lenient `UnknownContentNode`\n // (index signature), so a plain `switch` widens the narrowed fields to\n // `unknown`. The runtime `type` check is authoritative.\n if (node.type === \"section\") {\n const s = node as SectionNode;\n return {\n type: \"section\",\n spans: s.spans ?? parseInline(s.text ?? \"\"),\n ...(s.accessory ? { accessory: s.accessory } : {}),\n ...(s.fields\n ? {\n fields: s.fields.map((f) => ({\n spans: f.spans ?? parseInline(f.text ?? \"\"),\n })),\n }\n : {}),\n };\n }\n if (node.type === \"context\") {\n const c = node as ContextNode;\n return {\n type: \"context\",\n elements: c.elements.map((el) =>\n el.type === \"text\"\n ? { type: \"text\", spans: el.spans ?? parseInline(el.text ?? \"\") }\n : el,\n ),\n };\n }\n if (node.type === \"attachment\") {\n const a = node as AttachmentNode;\n return {\n type: \"attachment\",\n ...(a.color ? { color: a.color } : {}),\n content: a.content.map(normalizeContentNode),\n };\n }\n return node;\n}\n\n/**\n * Resolve a message's body sugar to content nodes. Explicit `content` is\n * authoritative (block `text` sugar is normalized to spans); otherwise the text\n * node (if any) comes first, then images — matching the \"here's the toast:\n * [image]\" ordering in the spec example.\n */\nexport function toContentNodes(body: MessageBodySugar): ContentNode[] {\n if (body.content) return body.content.map(normalizeContentNode);\n const nodes: ContentNode[] = [];\n if (body.text !== undefined && body.text.length > 0) {\n nodes.push(textToContentNode(body.text));\n }\n if (body.images) {\n for (const image of body.images) nodes.push(imageToContentNode(image));\n }\n return nodes;\n}\n","import { z } from \"zod\";\nimport { contentSchema } from \"./content-registry.js\";\n\n/**\n * Per-step overrides shared by every step. The engine computes timing from the\n * pacing model; these win over the computed values. Use a dedicated `delay`\n * step type to insert explicit pauses on the timeline.\n */\nconst stepBaseShape = {\n /** Optional id so reactions/edits/deletes can target this step's message. */\n id: z.string().optional(),\n /** Reveal with no animation and no computed delay. */\n instant: z.boolean().optional(),\n};\n\n/** Authoring sugar for an in-message image (compiled to an image node). */\nexport const imageSugarSchema = z.object({\n src: z.string(),\n alt: z.string().optional(),\n width: z.number().positive().optional(),\n height: z.number().positive().optional(),\n});\n\n/** Message-body sugar fields; `content` (explicit nodes) wins when present. */\nconst bodyShape = {\n text: z.string().optional(),\n images: z.array(imageSugarSchema).optional(),\n content: contentSchema.optional(),\n};\n\n/** Optional typing indicator preceding a message. */\nconst messageTypingSchema = z.union([\n z.boolean(),\n z.object({ showTypingFor: z.number().nonnegative().optional() }),\n]);\n\n/** An incoming message, optionally preceded by a typing indicator. */\nexport const messageStepSchema = z.object({\n type: z.literal(\"message\"),\n from: z.string(),\n typing: messageTypingSchema.optional(),\n ...bodyShape,\n ...stepBaseShape,\n});\n\n/** A reaction landing on a target message (`$prev` or a message id). */\nexport const reactionStepSchema = z.object({\n type: z.literal(\"reaction\"),\n /** Message id to react to. Defaults to `$prev` (the most-recent message). */\n target: z.string().optional(),\n emoji: z.string(),\n /** Emoji shortcode without colons, e.g. `\"eyes\"` — shown in skin tooltips. */\n shortcode: z.string().optional(),\n from: z.string().optional(),\n /** Gap from when the target appears, before the reaction lands (ms). */\n delay: z.number().nonnegative().optional(),\n ...stepBaseShape,\n});\n\n/** A standalone typing indicator (no message necessarily follows). */\nexport const typingStepSchema = z.object({\n type: z.literal(\"typing\"),\n from: z.string(),\n showTypingFor: z.number().nonnegative().optional(),\n ...stepBaseShape,\n});\n\n/** The self participant typing into the composer, char by char. */\nexport const composerTypeStepSchema = z.object({\n type: z.literal(\"composerType\"),\n from: z.string(),\n text: z.string(),\n /** Override the computed typing duration (ms). */\n typingDuration: z.number().nonnegative().optional(),\n ...stepBaseShape,\n});\n\n/** Commit the composer's current text to the thread. */\nexport const sendStepSchema = z.object({\n type: z.literal(\"send\"),\n from: z.string().optional(),\n ...stepBaseShape,\n});\n\n/** Edit a previously sent message's body. */\nexport const editStepSchema = z.object({\n type: z.literal(\"edit\"),\n /** Message id to edit. Defaults to `$prev` (the most-recent message). */\n target: z.string().optional(),\n ...bodyShape,\n ...stepBaseShape,\n});\n\n/** Delete a previously sent message. */\nexport const deleteStepSchema = z.object({\n type: z.literal(\"delete\"),\n /** Message id to delete. Defaults to `$prev` (the most-recent message). */\n target: z.string().optional(),\n ...stepBaseShape,\n});\n\n/** A read receipt (optionally by a participant, optionally up to a message). */\nexport const readReceiptStepSchema = z.object({\n type: z.literal(\"readReceipt\"),\n by: z.string().optional(),\n target: z.string().optional(),\n ...stepBaseShape,\n});\n\n/**\n * A system / notice line — not a chat message. Skins render it distinctly: a\n * centered muted notice (iMessage/WhatsApp/Slack \"X joined #channel\"), an agent\n * tool-output line (Cursor/Claude Code `⎿ …`), a CI notice (Discord), etc. App\n * \"cards\" are NOT system steps — model those as a `message` from an `app`\n * participant carrying Block Kit content (header/section/context/actions/…).\n */\nexport const systemStepSchema = z.object({\n type: z.literal(\"system\"),\n from: z.string().optional(),\n ...bodyShape,\n ...stepBaseShape,\n});\n\n/** An explicit pause in the timeline (formerly `beat`). */\nexport const delayStepSchema = z.object({\n type: z.literal(\"delay\"),\n duration: z.number().nonnegative(),\n ...stepBaseShape,\n});\n\nexport const timelineStepSchema = z.discriminatedUnion(\"type\", [\n messageStepSchema,\n reactionStepSchema,\n typingStepSchema,\n composerTypeStepSchema,\n sendStepSchema,\n editStepSchema,\n deleteStepSchema,\n readReceiptStepSchema,\n systemStepSchema,\n delayStepSchema,\n]);\nexport type TimelineStep = z.infer<typeof timelineStepSchema>;\nexport type TimelineStepInput = z.input<typeof timelineStepSchema>;\n\nexport const timelineSchema = z.array(timelineStepSchema);\n\n/** The discriminant values of every timeline step. */\nexport const STEP_TYPES = [\n \"message\",\n \"reaction\",\n \"typing\",\n \"composerType\",\n \"send\",\n \"edit\",\n \"delete\",\n \"readReceipt\",\n \"system\",\n \"delay\",\n] as const;\nexport type StepType = (typeof STEP_TYPES)[number];\n","import { z } from \"zod\";\nimport { metaSchema } from \"./meta.js\";\nimport { participantsSchema } from \"./participants.js\";\nimport { pacingSchema } from \"./pacing.js\";\nimport { timelineSchema } from \"./timeline.js\";\n\n/**\n * The config schema version. Distinct from the `@typecaast/schema` package\n * version (related but versioned independently — see PLAN §22). A config newer\n * than the installed runtime fails parsing with a clear error.\n */\nexport const CONFIG_VERSION = 1;\n\n/** The complete Typecaast config: the single source of truth for a simulation. */\nexport const configSchema = z.object({\n version: z.literal(CONFIG_VERSION),\n meta: metaSchema,\n participants: participantsSchema,\n /** Optional; omitted pacing resolves to the full default model. */\n pacing: pacingSchema.default(() => pacingSchema.parse({})),\n timeline: timelineSchema,\n});\n\n/** A parsed config (defaults applied). */\nexport type Config = z.infer<typeof configSchema>;\n/** A config as authored (fields with defaults are optional). */\nexport type ConfigInput = z.input<typeof configSchema>;\n\n/**\n * Generate the JSON Schema for a Typecaast config (for editor autocomplete and\n * `$schema` references). Lazy so importing the package never eagerly runs the\n * conversion. Refinements (e.g. the lenient content-node guard) are not\n * representable in JSON Schema and are dropped.\n */\nexport function configJsonSchema(): Record<string, unknown> {\n return z.toJSONSchema(configSchema, {\n unrepresentable: \"any\",\n target: \"draft-7\",\n }) as Record<string, unknown>;\n}\n","import { CONFIG_VERSION, configSchema } from \"./config.js\";\n\n/** Diagnostic severity tiers (PLAN §23). */\nexport type Severity = \"error\" | \"warning\" | \"info\";\n\n/**\n * A single validation finding. Every diagnostic carries a stable `code`, the\n * offending `location` (step/message/path), and a `hint` for remediation.\n */\nexport interface Diagnostic {\n code: string;\n severity: Severity;\n message: string;\n /** Dotted/indexed path, e.g. `timeline[3].from` or `meta.canvas.width`. */\n location?: string;\n hint?: string;\n}\n\nfunction formatPath(path: ReadonlyArray<PropertyKey>): string {\n let out = \"\";\n for (const key of path) {\n if (typeof key === \"number\") out += `[${key}]`;\n else if (out === \"\") out += String(key);\n else out += `.${String(key)}`;\n }\n return out;\n}\n\n/** Read an optional `from`/`by`/`target` field off any step shape. */\nfunction field(step: unknown, key: string): string | undefined {\n const value = (step as Record<string, unknown>)[key];\n return typeof value === \"string\" ? value : undefined;\n}\n\n/**\n * Validate a parsed config value (already JSON-decoded). Returns all\n * diagnostics — schema errors, then semantic checks (reference integrity,\n * target resolution). Reusable by the CLI and the builder's lint panel.\n *\n * A version newer than the runtime short-circuits with a single hard error.\n */\nexport function validateConfig(raw: unknown): Diagnostic[] {\n const diagnostics: Diagnostic[] = [];\n\n if (raw && typeof raw === \"object\" && \"version\" in raw) {\n const version = (raw as { version: unknown }).version;\n if (typeof version === \"number\" && version > CONFIG_VERSION) {\n return [\n {\n code: \"E_VERSION\",\n severity: \"error\",\n message: `Config version ${version} is newer than this runtime supports (max ${CONFIG_VERSION}).`,\n location: \"version\",\n hint: \"Upgrade Typecaast (e.g. `npm i @typecaast/cli@latest`).\",\n },\n ];\n }\n }\n\n const result = configSchema.safeParse(raw);\n if (!result.success) {\n for (const issue of result.error.issues) {\n diagnostics.push({\n code: \"E_SCHEMA\",\n severity: \"error\",\n message: issue.message,\n location: formatPath(issue.path) || undefined,\n });\n }\n return diagnostics;\n }\n\n const config = result.data;\n\n // Duplicate participant ids.\n const ids = config.participants.map((p) => p.id);\n const idSet = new Set(ids);\n for (const dup of new Set(ids.filter((id, i) => ids.indexOf(id) !== i))) {\n diagnostics.push({\n code: \"E_DUP_PARTICIPANT\",\n severity: \"error\",\n message: `Duplicate participant id \"${dup}\".`,\n location: \"participants\",\n hint: \"Participant ids must be unique.\",\n });\n }\n\n const hasSelf = config.participants.some((p) => p.isSelf);\n let warnedNoSelf = false;\n const messageIds = new Set<string>();\n let priorMessages = 0;\n\n config.timeline.forEach((step, i) => {\n const loc = `timeline[${i}]`;\n\n const from = field(step, \"from\");\n if (from !== undefined && !idSet.has(from)) {\n diagnostics.push({\n code: \"E_REF_PARTICIPANT\",\n severity: \"error\",\n message: `Step references unknown participant \"${from}\".`,\n location: `${loc}.from`,\n hint: `Add a participant with id \"${from}\" or fix the reference.`,\n });\n }\n\n if (step.type === \"readReceipt\") {\n const by = field(step, \"by\");\n if (by !== undefined && !idSet.has(by)) {\n diagnostics.push({\n code: \"E_REF_PARTICIPANT\",\n severity: \"error\",\n message: `Read receipt references unknown participant \"${by}\".`,\n location: `${loc}.by`,\n hint: `Add a participant with id \"${by}\" or fix the reference.`,\n });\n }\n }\n\n if (\n (step.type === \"composerType\" || step.type === \"send\") &&\n !hasSelf &&\n !warnedNoSelf\n ) {\n warnedNoSelf = true;\n diagnostics.push({\n code: \"W_NO_SELF\",\n severity: \"warning\",\n message: \"The composer is used but no participant is marked as self.\",\n location: loc,\n hint: 'Mark a participant with `\"isSelf\": true`.',\n });\n }\n\n if (\n (step.type === \"message\" || step.type === \"system\") &&\n typeof step.id === \"string\"\n ) {\n messageIds.add(step.id);\n }\n\n if (\n step.type === \"reaction\" ||\n step.type === \"edit\" ||\n step.type === \"delete\"\n ) {\n const target = step.target;\n // Blank/`$prev` both mean \"the most-recent message\".\n if (!target || target === \"$prev\") {\n if (priorMessages === 0) {\n diagnostics.push({\n code: \"W_NO_PREV\",\n severity: \"warning\",\n message: \"Default target has no preceding message.\",\n location: `${loc}.target`,\n hint: \"Place this after a message, or set a target message id.\",\n });\n }\n } else if (!messageIds.has(target)) {\n diagnostics.push({\n code: \"W_TARGET\",\n severity: \"warning\",\n message: `Target \"${target}\" matches no preceding message id.`,\n location: `${loc}.target`,\n hint: 'Give the target message an `\"id\"`, or check the reference.',\n });\n }\n }\n\n if (step.type === \"message\" || step.type === \"system\") priorMessages++;\n });\n\n return diagnostics;\n}\n"]}
|
package/dist/index.d.cts
CHANGED
|
@@ -535,6 +535,19 @@ declare const actionsNodeSchema: z.ZodObject<{
|
|
|
535
535
|
}, z.core.$strip>>;
|
|
536
536
|
}, z.core.$strip>;
|
|
537
537
|
type ActionsNode = z.infer<typeof actionsNodeSchema>;
|
|
538
|
+
/**
|
|
539
|
+
* A multi-line preformatted code block (Slack's fenced ``` block) — a monospaced
|
|
540
|
+
* box that preserves whitespace and newlines verbatim (used for tables, logs,
|
|
541
|
+
* snippets). Distinct from the inline `code` mark; `text` is **literal** and is
|
|
542
|
+
* never parsed for inline marks. `lang` is an optional language hint (unused by
|
|
543
|
+
* the current skins, reserved for future syntax highlighting).
|
|
544
|
+
*/
|
|
545
|
+
declare const codeBlockNodeSchema: z.ZodObject<{
|
|
546
|
+
type: z.ZodLiteral<"codeblock">;
|
|
547
|
+
text: z.ZodString;
|
|
548
|
+
lang: z.ZodOptional<z.ZodString>;
|
|
549
|
+
}, z.core.$strip>;
|
|
550
|
+
type CodeBlockNode = z.infer<typeof codeBlockNodeSchema>;
|
|
538
551
|
/**
|
|
539
552
|
* A legacy-style attachment: nested blocks rendered behind a colored left bar.
|
|
540
553
|
* `color` is any CSS color (defaults to a neutral bar). Recursive — its Zod
|
|
@@ -556,7 +569,7 @@ interface UnknownContentNode {
|
|
|
556
569
|
[key: string]: unknown;
|
|
557
570
|
}
|
|
558
571
|
/** The body of a message: an ordered list of content nodes. */
|
|
559
|
-
type ContentNode = TextNode | ImageNode | HeaderNode | SectionNode | ContextNode | DividerNode | ActionsNode | AttachmentNode | UnknownContentNode;
|
|
572
|
+
type ContentNode = TextNode | ImageNode | HeaderNode | SectionNode | ContextNode | DividerNode | ActionsNode | CodeBlockNode | AttachmentNode | UnknownContentNode;
|
|
560
573
|
|
|
561
574
|
/**
|
|
562
575
|
* A legacy-style attachment node — nested blocks behind a colored left bar.
|
|
@@ -1098,4 +1111,4 @@ interface Diagnostic {
|
|
|
1098
1111
|
*/
|
|
1099
1112
|
declare function validateConfig(raw: unknown): Diagnostic[];
|
|
1100
1113
|
|
|
1101
|
-
export { type ActionsNode, type AssetMode, type AttachmentNode, type ButtonElement, CONFIG_VERSION, type ComposerMode, type Config, type ConfigInput, type ContentNode, type ContextElement, type ContextNode, type Diagnostic, type DividerNode, type FitMode, type HeaderNode, type ImageElement, type ImageNode, type ImageSugar, type InlineNode, type MessageBodySugar, type Meta, type MetaInput, type Pacing, type PacingInput, type Participant, type ParticipantInput, type ParticipantKind, STEP_TYPES, type SectionNode, type Severity, type Size, type SkinRef, type StepType, type TextNode, type ThemeMode, type TimelineStep, type TimelineStepInput, type UnknownContentNode, actionsNodeSchema, assetModeSchema, attachmentNodeSchema, buildContentNodeSchema, buttonElementSchema, composerModeSchema, composerTypeStepSchema, configJsonSchema, configSchema, contentNodeSchema, contentSchema, contextElementSchema, contextNodeSchema, contextTextElementSchema, delayStepSchema, deleteStepSchema, dividerNodeSchema, editStepSchema, fitModeSchema, headerNodeSchema, imageElementSchema, imageNodeSchema, imageSugarSchema, imageToContentNode, inlineBoldSchema, inlineCodeSchema, inlineEmojiSchema, inlineItalicSchema, inlineLinkSchema, inlineMentionSchema, inlineNodeSchema, inlineStrikeSchema, inlineTextSchema, isKnownContentNodeType, knownContentNodeTypes, messageStepSchema, metaSchema, normalizeContentNode, pacingSchema, parseInline, participantKindSchema, participantSchema, participantsSchema, reactionStepSchema, readReceiptStepSchema, registerContentNodeType, sectionFieldSchema, sectionNodeSchema, sendStepSchema, sizeSchema, skinRefSchema, systemStepSchema, textNodeSchema, textToContentNode, themeModeSchema, timelineSchema, timelineStepSchema, toContentNodes, typingStepSchema, validateConfig };
|
|
1114
|
+
export { type ActionsNode, type AssetMode, type AttachmentNode, type ButtonElement, CONFIG_VERSION, type CodeBlockNode, type ComposerMode, type Config, type ConfigInput, type ContentNode, type ContextElement, type ContextNode, type Diagnostic, type DividerNode, type FitMode, type HeaderNode, type ImageElement, type ImageNode, type ImageSugar, type InlineNode, type MessageBodySugar, type Meta, type MetaInput, type Pacing, type PacingInput, type Participant, type ParticipantInput, type ParticipantKind, STEP_TYPES, type SectionNode, type Severity, type Size, type SkinRef, type StepType, type TextNode, type ThemeMode, type TimelineStep, type TimelineStepInput, type UnknownContentNode, actionsNodeSchema, assetModeSchema, attachmentNodeSchema, buildContentNodeSchema, buttonElementSchema, codeBlockNodeSchema, composerModeSchema, composerTypeStepSchema, configJsonSchema, configSchema, contentNodeSchema, contentSchema, contextElementSchema, contextNodeSchema, contextTextElementSchema, delayStepSchema, deleteStepSchema, dividerNodeSchema, editStepSchema, fitModeSchema, headerNodeSchema, imageElementSchema, imageNodeSchema, imageSugarSchema, imageToContentNode, inlineBoldSchema, inlineCodeSchema, inlineEmojiSchema, inlineItalicSchema, inlineLinkSchema, inlineMentionSchema, inlineNodeSchema, inlineStrikeSchema, inlineTextSchema, isKnownContentNodeType, knownContentNodeTypes, messageStepSchema, metaSchema, normalizeContentNode, pacingSchema, parseInline, participantKindSchema, participantSchema, participantsSchema, reactionStepSchema, readReceiptStepSchema, registerContentNodeType, sectionFieldSchema, sectionNodeSchema, sendStepSchema, sizeSchema, skinRefSchema, systemStepSchema, textNodeSchema, textToContentNode, themeModeSchema, timelineSchema, timelineStepSchema, toContentNodes, typingStepSchema, validateConfig };
|
package/dist/index.d.ts
CHANGED
|
@@ -535,6 +535,19 @@ declare const actionsNodeSchema: z.ZodObject<{
|
|
|
535
535
|
}, z.core.$strip>>;
|
|
536
536
|
}, z.core.$strip>;
|
|
537
537
|
type ActionsNode = z.infer<typeof actionsNodeSchema>;
|
|
538
|
+
/**
|
|
539
|
+
* A multi-line preformatted code block (Slack's fenced ``` block) — a monospaced
|
|
540
|
+
* box that preserves whitespace and newlines verbatim (used for tables, logs,
|
|
541
|
+
* snippets). Distinct from the inline `code` mark; `text` is **literal** and is
|
|
542
|
+
* never parsed for inline marks. `lang` is an optional language hint (unused by
|
|
543
|
+
* the current skins, reserved for future syntax highlighting).
|
|
544
|
+
*/
|
|
545
|
+
declare const codeBlockNodeSchema: z.ZodObject<{
|
|
546
|
+
type: z.ZodLiteral<"codeblock">;
|
|
547
|
+
text: z.ZodString;
|
|
548
|
+
lang: z.ZodOptional<z.ZodString>;
|
|
549
|
+
}, z.core.$strip>;
|
|
550
|
+
type CodeBlockNode = z.infer<typeof codeBlockNodeSchema>;
|
|
538
551
|
/**
|
|
539
552
|
* A legacy-style attachment: nested blocks rendered behind a colored left bar.
|
|
540
553
|
* `color` is any CSS color (defaults to a neutral bar). Recursive — its Zod
|
|
@@ -556,7 +569,7 @@ interface UnknownContentNode {
|
|
|
556
569
|
[key: string]: unknown;
|
|
557
570
|
}
|
|
558
571
|
/** The body of a message: an ordered list of content nodes. */
|
|
559
|
-
type ContentNode = TextNode | ImageNode | HeaderNode | SectionNode | ContextNode | DividerNode | ActionsNode | AttachmentNode | UnknownContentNode;
|
|
572
|
+
type ContentNode = TextNode | ImageNode | HeaderNode | SectionNode | ContextNode | DividerNode | ActionsNode | CodeBlockNode | AttachmentNode | UnknownContentNode;
|
|
560
573
|
|
|
561
574
|
/**
|
|
562
575
|
* A legacy-style attachment node — nested blocks behind a colored left bar.
|
|
@@ -1098,4 +1111,4 @@ interface Diagnostic {
|
|
|
1098
1111
|
*/
|
|
1099
1112
|
declare function validateConfig(raw: unknown): Diagnostic[];
|
|
1100
1113
|
|
|
1101
|
-
export { type ActionsNode, type AssetMode, type AttachmentNode, type ButtonElement, CONFIG_VERSION, type ComposerMode, type Config, type ConfigInput, type ContentNode, type ContextElement, type ContextNode, type Diagnostic, type DividerNode, type FitMode, type HeaderNode, type ImageElement, type ImageNode, type ImageSugar, type InlineNode, type MessageBodySugar, type Meta, type MetaInput, type Pacing, type PacingInput, type Participant, type ParticipantInput, type ParticipantKind, STEP_TYPES, type SectionNode, type Severity, type Size, type SkinRef, type StepType, type TextNode, type ThemeMode, type TimelineStep, type TimelineStepInput, type UnknownContentNode, actionsNodeSchema, assetModeSchema, attachmentNodeSchema, buildContentNodeSchema, buttonElementSchema, composerModeSchema, composerTypeStepSchema, configJsonSchema, configSchema, contentNodeSchema, contentSchema, contextElementSchema, contextNodeSchema, contextTextElementSchema, delayStepSchema, deleteStepSchema, dividerNodeSchema, editStepSchema, fitModeSchema, headerNodeSchema, imageElementSchema, imageNodeSchema, imageSugarSchema, imageToContentNode, inlineBoldSchema, inlineCodeSchema, inlineEmojiSchema, inlineItalicSchema, inlineLinkSchema, inlineMentionSchema, inlineNodeSchema, inlineStrikeSchema, inlineTextSchema, isKnownContentNodeType, knownContentNodeTypes, messageStepSchema, metaSchema, normalizeContentNode, pacingSchema, parseInline, participantKindSchema, participantSchema, participantsSchema, reactionStepSchema, readReceiptStepSchema, registerContentNodeType, sectionFieldSchema, sectionNodeSchema, sendStepSchema, sizeSchema, skinRefSchema, systemStepSchema, textNodeSchema, textToContentNode, themeModeSchema, timelineSchema, timelineStepSchema, toContentNodes, typingStepSchema, validateConfig };
|
|
1114
|
+
export { type ActionsNode, type AssetMode, type AttachmentNode, type ButtonElement, CONFIG_VERSION, type CodeBlockNode, type ComposerMode, type Config, type ConfigInput, type ContentNode, type ContextElement, type ContextNode, type Diagnostic, type DividerNode, type FitMode, type HeaderNode, type ImageElement, type ImageNode, type ImageSugar, type InlineNode, type MessageBodySugar, type Meta, type MetaInput, type Pacing, type PacingInput, type Participant, type ParticipantInput, type ParticipantKind, STEP_TYPES, type SectionNode, type Severity, type Size, type SkinRef, type StepType, type TextNode, type ThemeMode, type TimelineStep, type TimelineStepInput, type UnknownContentNode, actionsNodeSchema, assetModeSchema, attachmentNodeSchema, buildContentNodeSchema, buttonElementSchema, codeBlockNodeSchema, composerModeSchema, composerTypeStepSchema, configJsonSchema, configSchema, contentNodeSchema, contentSchema, contextElementSchema, contextNodeSchema, contextTextElementSchema, delayStepSchema, deleteStepSchema, dividerNodeSchema, editStepSchema, fitModeSchema, headerNodeSchema, imageElementSchema, imageNodeSchema, imageSugarSchema, imageToContentNode, inlineBoldSchema, inlineCodeSchema, inlineEmojiSchema, inlineItalicSchema, inlineLinkSchema, inlineMentionSchema, inlineNodeSchema, inlineStrikeSchema, inlineTextSchema, isKnownContentNodeType, knownContentNodeTypes, messageStepSchema, metaSchema, normalizeContentNode, pacingSchema, parseInline, participantKindSchema, participantSchema, participantsSchema, reactionStepSchema, readReceiptStepSchema, registerContentNodeType, sectionFieldSchema, sectionNodeSchema, sendStepSchema, sizeSchema, skinRefSchema, systemStepSchema, textNodeSchema, textToContentNode, themeModeSchema, timelineSchema, timelineStepSchema, toContentNodes, typingStepSchema, validateConfig };
|
package/dist/index.js
CHANGED
|
@@ -164,6 +164,11 @@ var actionsNodeSchema = z.object({
|
|
|
164
164
|
type: z.literal("actions"),
|
|
165
165
|
elements: z.array(buttonElementSchema)
|
|
166
166
|
});
|
|
167
|
+
var codeBlockNodeSchema = z.object({
|
|
168
|
+
type: z.literal("codeblock"),
|
|
169
|
+
text: z.string(),
|
|
170
|
+
lang: z.string().optional()
|
|
171
|
+
});
|
|
167
172
|
var attachmentNodeSchema = z.lazy(
|
|
168
173
|
() => z.object({
|
|
169
174
|
type: z.literal("attachment"),
|
|
@@ -179,6 +184,7 @@ var registry = /* @__PURE__ */ new Map([
|
|
|
179
184
|
["context", contextNodeSchema],
|
|
180
185
|
["divider", dividerNodeSchema],
|
|
181
186
|
["actions", actionsNodeSchema],
|
|
187
|
+
["codeblock", codeBlockNodeSchema],
|
|
182
188
|
["attachment", attachmentNodeSchema]
|
|
183
189
|
]);
|
|
184
190
|
function registerContentNodeType(type, schema) {
|
|
@@ -543,6 +549,6 @@ function validateConfig(raw) {
|
|
|
543
549
|
return diagnostics;
|
|
544
550
|
}
|
|
545
551
|
|
|
546
|
-
export { CONFIG_VERSION, STEP_TYPES, actionsNodeSchema, assetModeSchema, attachmentNodeSchema, buildContentNodeSchema, buttonElementSchema, composerModeSchema, composerTypeStepSchema, configJsonSchema, configSchema, contentNodeSchema, contentSchema, contextElementSchema, contextNodeSchema, contextTextElementSchema, delayStepSchema, deleteStepSchema, dividerNodeSchema, editStepSchema, fitModeSchema, headerNodeSchema, imageElementSchema, imageNodeSchema, imageSugarSchema, imageToContentNode, inlineBoldSchema, inlineCodeSchema, inlineEmojiSchema, inlineItalicSchema, inlineLinkSchema, inlineMentionSchema, inlineNodeSchema, inlineStrikeSchema, inlineTextSchema, isKnownContentNodeType, knownContentNodeTypes, messageStepSchema, metaSchema, normalizeContentNode, pacingSchema, parseInline, participantKindSchema, participantSchema, participantsSchema, reactionStepSchema, readReceiptStepSchema, registerContentNodeType, sectionFieldSchema, sectionNodeSchema, sendStepSchema, sizeSchema, skinRefSchema, systemStepSchema, textNodeSchema, textToContentNode, themeModeSchema, timelineSchema, timelineStepSchema, toContentNodes, typingStepSchema, validateConfig };
|
|
552
|
+
export { CONFIG_VERSION, STEP_TYPES, actionsNodeSchema, assetModeSchema, attachmentNodeSchema, buildContentNodeSchema, buttonElementSchema, codeBlockNodeSchema, composerModeSchema, composerTypeStepSchema, configJsonSchema, configSchema, contentNodeSchema, contentSchema, contextElementSchema, contextNodeSchema, contextTextElementSchema, delayStepSchema, deleteStepSchema, dividerNodeSchema, editStepSchema, fitModeSchema, headerNodeSchema, imageElementSchema, imageNodeSchema, imageSugarSchema, imageToContentNode, inlineBoldSchema, inlineCodeSchema, inlineEmojiSchema, inlineItalicSchema, inlineLinkSchema, inlineMentionSchema, inlineNodeSchema, inlineStrikeSchema, inlineTextSchema, isKnownContentNodeType, knownContentNodeTypes, messageStepSchema, metaSchema, normalizeContentNode, pacingSchema, parseInline, participantKindSchema, participantSchema, participantsSchema, reactionStepSchema, readReceiptStepSchema, registerContentNodeType, sectionFieldSchema, sectionNodeSchema, sendStepSchema, sizeSchema, skinRefSchema, systemStepSchema, textNodeSchema, textToContentNode, themeModeSchema, timelineSchema, timelineStepSchema, toContentNodes, typingStepSchema, validateConfig };
|
|
547
553
|
//# sourceMappingURL=index.js.map
|
|
548
554
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/meta.ts","../src/participants.ts","../src/pacing.ts","../src/content-nodes.ts","../src/content-registry.ts","../src/content-sugar.ts","../src/timeline.ts","../src/config.ts","../src/validate.ts"],"names":["z"],"mappings":";;;AAGO,IAAM,UAAA,GAAa,EAAE,MAAA,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,IAAA,CAAK;AAAA,UACf,IAAA,EAAM,UAAA;AAAA,UACN,QAAA,EAAU,SAAA;AAAA,UACV,OAAA,EAAS,WAAW,MAAM,CAAA,kCAAA,CAAA;AAAA,UAC1B,QAAA,EAAU,GAAG,GAAG,CAAA,OAAA,CAAA;AAAA,UAChB,IAAA,EAAM;AAAA,SACP,CAAA;AAAA,MACH;AAAA,IACF;AAEA,IAAA,IAAI,IAAA,CAAK,IAAA,KAAS,SAAA,IAAa,IAAA,CAAK,SAAS,QAAA,EAAU,aAAA,EAAA;AAAA,EACzD,CAAC,CAAA;AAED,EAAA,OAAO,WAAA;AACT","file":"index.js","sourcesContent":["import { z } from \"zod\";\n\n/** A pixel dimension pair (authoring reference; the exact frame for video). */\nexport const sizeSchema = z.object({\n width: z.number().int().positive(),\n height: z.number().int().positive(),\n});\nexport type Size = z.infer<typeof sizeSchema>;\n\n/**\n * How the rendered conversation fills its container. The widget is\n * **container-driven** in the first two modes — its size never grows\n * with content; messages clip when they overflow the bottom-anchored\n * thread.\n * - `reflow`: fills the container in both axes; bubbles re-wrap to the\n * container width.\n * - `scale`: renders at the exact authored canvas size and CSS-scales\n * to fit (preserves the canonical layout — letterboxes if the\n * container's aspect doesn't match the canvas).\n * - `fixed`: pins the widget to the authored canvas px; clips. The only\n * non-container-driven mode.\n */\nexport const fitModeSchema = z.enum([\"reflow\", \"scale\", \"fixed\"]);\nexport type FitMode = z.infer<typeof fitModeSchema>;\n\n/**\n * Reply-box (composer) visibility:\n * - `auto`: shown only while someone is typing/sending (default).\n * - `always`: keep the message input visible the whole time.\n * - `never`: never show it.\n */\nexport const composerModeSchema = z.enum([\"auto\", \"always\", \"never\"]);\nexport type ComposerMode = z.infer<typeof composerModeSchema>;\n\n/**\n * Color theme. `auto` inherits the host page's `prefers-color-scheme` (live\n * preview) and falls back to `light`; video export resolves `auto` to a\n * concrete mode and defaults to `light` when unspecified.\n */\nexport const themeModeSchema = z.enum([\"light\", \"dark\", \"auto\"]);\nexport type ThemeMode = z.infer<typeof themeModeSchema>;\n\n/**\n * Asset resolution strategy.\n * - `inline`: embed images as data URLs (self-contained config; default).\n * - `url`: reference hosted images (smaller config; user hosts their own).\n */\nexport const assetModeSchema = z.enum([\"inline\", \"url\"]);\nexport type AssetMode = z.infer<typeof assetModeSchema>;\n\n/** Reference to a skin plus its skin-specific options (validated by the skin). */\nexport const skinRefSchema = z.object({\n id: z.string().min(1),\n options: z.record(z.string(), z.unknown()).optional(),\n});\nexport type SkinRef = z.infer<typeof skinRefSchema>;\n\n/** Top-level rendering/authoring metadata. */\nexport const metaSchema = z.object({\n /** Authoring reference size; fixed frame for video. */\n canvas: sizeSchema,\n fps: z.number().int().positive().default(30),\n fit: fitModeSchema.default(\"reflow\"),\n theme: themeModeSchema.default(\"auto\"),\n skin: skinRefSchema,\n /** Seed for all deterministic jitter (no `Math.random`). */\n seed: z.number().int().default(42),\n /** Canvas background: `\"transparent\"` or any CSS color. */\n background: z.string().default(\"transparent\"),\n assets: assetModeSchema.default(\"inline\"),\n /** Reply-box visibility (see `composerModeSchema`). */\n composer: composerModeSchema.default(\"auto\"),\n /**\n * Auto-replay when the timeline reaches the end. Honored by the builder\n * preview and by `<Typecaast>` when the consumer doesn't pass an explicit\n * `loop` prop.\n */\n loop: z.boolean().default(false),\n});\n\n/** `meta` as it appears after parsing (defaults applied). */\nexport type Meta = z.infer<typeof metaSchema>;\n/** `meta` as authored (fields with defaults are optional). */\nexport type MetaInput = z.input<typeof metaSchema>;\n","import { z } from \"zod\";\n\n/** Whether a participant is a human or an app/bot (changes how skins render it). */\nexport const participantKindSchema = z.enum([\"person\", \"app\"]);\nexport type ParticipantKind = z.infer<typeof participantKindSchema>;\n\n/** A speaker in the conversation. */\nexport const participantSchema = z.object({\n /** Stable id referenced by timeline steps (`from`, `target`, …). */\n id: z.string().min(1),\n name: z.string().min(1),\n /** Avatar asset (data URL or referenced URL per `meta.assets`). */\n avatar: z.string().optional(),\n /** Accent color (CSS color) some skins use for the author. */\n color: z.string().optional(),\n /** The viewer — rendered as the \"self\" side and the composer's author. */\n isSelf: z.boolean().optional(),\n kind: participantKindSchema.default(\"person\"),\n});\nexport type Participant = z.infer<typeof participantSchema>;\nexport type ParticipantInput = z.input<typeof participantSchema>;\n\nexport const participantsSchema = z.array(participantSchema);\n","import { z } from \"zod\";\n\n/**\n * Global auto-pacing defaults. Every value is overridable per step in the\n * timeline; the engine computes delays/durations from these and bakes in\n * seeded, deterministic jitter (`humanize`).\n */\nexport const pacingSchema = z.object({\n /** Gap before an incoming message ≈ reading time of the prior message. */\n readingWpm: z.number().positive().default(240),\n /** Chars/sec for composer typing + sender typing duration. */\n typingCps: z.number().positive().default(14),\n /** ±fraction of seeded jitter so pacing doesn't feel robotic (0–1). */\n humanize: z.number().min(0).max(1).default(0.15),\n /** Delay before the first event. */\n startDelayMs: z.number().nonnegative().default(400),\n});\nexport type Pacing = z.infer<typeof pacingSchema>;\nexport type PacingInput = z.input<typeof pacingSchema>;\n","import { z } from \"zod\";\n\n/**\n * Inline marks inside a text node. `text` runs carry plain content; the others\n * are the recognized marks (`code`, `link`, `mention`, `emoji`, and the\n * emphasis marks `bold`/`italic`/`strike`). New marks can be added without a\n * schema-version bump (unknown content node types are handled leniently; see\n * the registry). Emphasis marks are flat (no nesting, e.g. bold *and* italic on\n * the same run) — a deliberate v1 simplification matching Slack's common usage.\n */\nexport const inlineTextSchema = z.object({\n type: z.literal(\"text\"),\n value: z.string(),\n});\nexport const inlineCodeSchema = z.object({\n type: z.literal(\"code\"),\n value: z.string(),\n});\nexport const inlineBoldSchema = z.object({\n type: z.literal(\"bold\"),\n value: z.string(),\n});\nexport const inlineItalicSchema = z.object({\n type: z.literal(\"italic\"),\n value: z.string(),\n});\nexport const inlineStrikeSchema = z.object({\n type: z.literal(\"strike\"),\n value: z.string(),\n});\nexport const inlineLinkSchema = z.object({\n type: z.literal(\"link\"),\n href: z.string(),\n label: z.string().optional(),\n});\nexport const inlineMentionSchema = z.object({\n type: z.literal(\"mention\"),\n /** Display label as authored, e.g. `\"@PostHog\"`. */\n label: z.string(),\n /** Resolved participant id, filled when the mention binds to a participant. */\n id: z.string().optional(),\n});\nexport const inlineEmojiSchema = z.object({\n type: z.literal(\"emoji\"),\n /** The rendered glyph, e.g. `\"🦔\"`. */\n value: z.string(),\n /** Optional shortcode, e.g. `\"hedgehog\"`. */\n shortcode: z.string().optional(),\n});\n\nexport const inlineNodeSchema = z.discriminatedUnion(\"type\", [\n inlineTextSchema,\n inlineCodeSchema,\n inlineBoldSchema,\n inlineItalicSchema,\n inlineStrikeSchema,\n inlineLinkSchema,\n inlineMentionSchema,\n inlineEmojiSchema,\n]);\nexport type InlineNode = z.infer<typeof inlineNodeSchema>;\n\n/** A block of inline content. */\nexport const textNodeSchema = z.object({\n type: z.literal(\"text\"),\n spans: z.array(inlineNodeSchema),\n});\nexport type TextNode = z.infer<typeof textNodeSchema>;\n\n/** An in-message image (same hosting model as avatars, per `meta.assets`). */\nexport const imageNodeSchema = z.object({\n type: z.literal(\"image\"),\n src: z.string(),\n alt: z.string().optional(),\n width: z.number().positive().optional(),\n height: z.number().positive().optional(),\n});\nexport type ImageNode = z.infer<typeof imageNodeSchema>;\n\n// --- Block Kit content nodes -------------------------------------------------\n// Slack apps compose rich messages from \"blocks\". These model the common set\n// (header / section / context / divider / actions / image / attachment) so an\n// app message is a normal message from an `app` participant whose `content`\n// carries blocks — the same primitives a real Slack app would emit. Skins that\n// don't understand a block skip it (lenient registry), so they're Slack-leaning\n// but safe everywhere.\n\n/**\n * An interactive button (in an `actions` block or as a `section` accessory).\n * With `href` the skin renders a link opening in a new tab; without one it's\n * visibly inert. `style` controls emphasis — omitted = default (outlined),\n * matching Slack's `primary`/`danger`/default button styles.\n */\nexport const buttonElementSchema = z.object({\n type: z.literal(\"button\"),\n label: z.string(),\n href: z.string().optional(),\n style: z.enum([\"primary\", \"danger\"]).optional(),\n});\nexport type ButtonElement = z.infer<typeof buttonElementSchema>;\n\n/** A small image element (a `context` element or a `section` accessory). */\nexport const imageElementSchema = z.object({\n type: z.literal(\"image\"),\n src: z.string(),\n alt: z.string().optional(),\n});\nexport type ImageElement = z.infer<typeof imageElementSchema>;\n\n/** A large bold heading (Block Kit `header` — plain text, no inline marks). */\nexport const headerNodeSchema = z.object({\n type: z.literal(\"header\"),\n text: z.string(),\n});\nexport type HeaderNode = z.infer<typeof headerNodeSchema>;\n\n/**\n * A section block: a paragraph of inline content, with an optional `accessory`\n * (a button or image to its right) and optional `fields` (a two-column grid).\n * Text may be authored as `spans` (resolved) or `text` (sugar, parsed to spans\n * by `toContentNodes`).\n */\nexport const sectionFieldSchema = z.object({\n spans: z.array(inlineNodeSchema).optional(),\n text: z.string().optional(),\n});\nexport const sectionNodeSchema = z.object({\n type: z.literal(\"section\"),\n spans: z.array(inlineNodeSchema).optional(),\n text: z.string().optional(),\n accessory: z\n .discriminatedUnion(\"type\", [buttonElementSchema, imageElementSchema])\n .optional(),\n fields: z.array(sectionFieldSchema).optional(),\n});\nexport type SectionNode = z.infer<typeof sectionNodeSchema>;\n\n/** A context block: a row of small, muted text/image elements. */\nexport const contextTextElementSchema = z.object({\n type: z.literal(\"text\"),\n spans: z.array(inlineNodeSchema).optional(),\n text: z.string().optional(),\n});\nexport const contextElementSchema = z.discriminatedUnion(\"type\", [\n contextTextElementSchema,\n imageElementSchema,\n]);\nexport type ContextElement = z.infer<typeof contextElementSchema>;\nexport const contextNodeSchema = z.object({\n type: z.literal(\"context\"),\n elements: z.array(contextElementSchema),\n});\nexport type ContextNode = z.infer<typeof contextNodeSchema>;\n\n/** A horizontal rule between blocks. */\nexport const dividerNodeSchema = z.object({\n type: z.literal(\"divider\"),\n});\nexport type DividerNode = z.infer<typeof dividerNodeSchema>;\n\n/** A row of interactive buttons. */\nexport const actionsNodeSchema = z.object({\n type: z.literal(\"actions\"),\n elements: z.array(buttonElementSchema),\n});\nexport type ActionsNode = z.infer<typeof actionsNodeSchema>;\n\n/**\n * A legacy-style attachment: nested blocks rendered behind a colored left bar.\n * `color` is any CSS color (defaults to a neutral bar). Recursive — its Zod\n * schema lives in `content-registry.ts` (where the node union is built).\n */\nexport interface AttachmentNode {\n type: \"attachment\";\n color?: string;\n content: ContentNode[];\n}\n\n/**\n * A content node whose `type` the runtime doesn't recognize. It validates\n * leniently (only `type` is required) and is skipped by skins that don't handle\n * it — so future node types (`linkPreview`, `videoEmbed`, …) slot in without\n * breaking older runtimes or bumping the schema version.\n */\nexport interface UnknownContentNode {\n type: string;\n [key: string]: unknown;\n}\n\n/** The body of a message: an ordered list of content nodes. */\nexport type ContentNode =\n | TextNode\n | ImageNode\n | HeaderNode\n | SectionNode\n | ContextNode\n | DividerNode\n | ActionsNode\n | AttachmentNode\n | UnknownContentNode;\n","import { z } from \"zod\";\nimport {\n actionsNodeSchema,\n contextNodeSchema,\n dividerNodeSchema,\n headerNodeSchema,\n imageNodeSchema,\n sectionNodeSchema,\n textNodeSchema,\n type AttachmentNode,\n type ContentNode,\n} from \"./content-nodes.js\";\n\n/**\n * A legacy-style attachment node — nested blocks behind a colored left bar.\n * Recursive (its `content` is the full node array), so it's defined here where\n * `contentSchema` is in scope and wrapped in `z.lazy` to defer the reference.\n */\nexport const attachmentNodeSchema: z.ZodType<AttachmentNode> = z.lazy(() =>\n z.object({\n type: z.literal(\"attachment\"),\n color: z.string().optional(),\n content: contentSchema,\n }),\n);\n\n/**\n * The content-type registry. Each message body node has a `type` resolved\n * through here. Built-ins cover text/image plus the Block Kit blocks\n * (header/section/context/divider/actions/attachment); additional types can be\n * registered (with their own strict schema) without a schema-version bump.\n *\n * Nodes whose `type` is **not** registered validate leniently (only `type` is\n * required) and are skipped by skins that don't handle them. Nodes whose `type`\n * **is** registered must satisfy that type's schema — so a malformed `text`\n * node is an error rather than silently passing through the lenient path.\n */\nconst registry = new Map<string, z.ZodTypeAny>([\n [\"text\", textNodeSchema],\n [\"image\", imageNodeSchema],\n [\"header\", headerNodeSchema],\n [\"section\", sectionNodeSchema],\n [\"context\", contextNodeSchema],\n [\"divider\", dividerNodeSchema],\n [\"actions\", actionsNodeSchema],\n [\"attachment\", attachmentNodeSchema],\n]);\n\n/** Register (or override) the strict schema for a content node type. */\nexport function registerContentNodeType(\n type: string,\n schema: z.ZodTypeAny,\n): void {\n registry.set(type, schema);\n}\n\n/** The content node types the runtime validates strictly. */\nexport function knownContentNodeTypes(): string[] {\n return [...registry.keys()];\n}\n\nexport function isKnownContentNodeType(type: string): boolean {\n return registry.has(type);\n}\n\n/** Accepts any object with a string `type` that isn't a registered type. */\nconst lenientUnknownNodeSchema = z\n .looseObject({ type: z.string() })\n .refine((node) => !registry.has(node.type), {\n message: \"malformed content node for a registered type\",\n });\n\n/**\n * Build a content-node schema from the current registry state. Call this after\n * registering a new type to pick it up; `contentNodeSchema` below is the\n * default built from the v1 registry (`text` + `image`).\n */\nexport function buildContentNodeSchema(): z.ZodType<ContentNode> {\n return z.union([\n ...registry.values(),\n lenientUnknownNodeSchema,\n ]) as unknown as z.ZodType<ContentNode>;\n}\n\n/** Default content-node schema (text + image + lenient unknown). */\nexport const contentNodeSchema = buildContentNodeSchema();\n\n/** A message body: an ordered array of content nodes. */\nexport const contentSchema = z.array(contentNodeSchema);\n","import type {\n AttachmentNode,\n ContentNode,\n ContextNode,\n ImageNode,\n InlineNode,\n SectionNode,\n TextNode,\n} from \"./content-nodes.js\";\n\n/**\n * Matches an inline mark, in priority order: a backtick code span, Slack mrkdwn\n * emphasis (`*bold*`, `_italic_`, `~strike~`), an http(s) link, a `<@id>`\n * mention (Slack's encoded form — resolved to a display name at compile), or a\n * bare `@name` mention. Everything else becomes plain text runs.\n *\n * Emphasis delimiters must hug their content (no leading/trailing space), and\n * `_italic_` requires non-alphanumeric boundaries so `snake_case` and URLs with\n * underscores are left alone.\n */\nconst INLINE_TOKEN =\n /`([^`]+)`|\\*(?!\\s)([^*\\n]+?)(?<!\\s)\\*|(?<![A-Za-z0-9])_(?!\\s)([^_\\n]+?)(?<!\\s)_(?![A-Za-z0-9])|~(?!\\s)([^~\\n]+?)(?<!\\s)~|(https?:\\/\\/[^\\s]+)|<@([A-Za-z0-9_.-]+)>|(@[A-Za-z0-9_][\\w.-]*)/g;\n\n/**\n * Parse a plain authoring string into inline nodes, extracting inline `code`,\n * `bold`/`italic`/`strike`, links, and mentions. Emoji are left inside text\n * runs (they render fine; a dedicated emoji mark can be authored explicitly).\n * A `<@id>` mention carries its `id` and a placeholder label; the engine\n * resolves the label to the participant's display name at compile time.\n */\nexport function parseInline(text: string): InlineNode[] {\n if (text.length === 0) return [];\n const spans: InlineNode[] = [];\n const re = new RegExp(INLINE_TOKEN.source, \"g\");\n let lastIndex = 0;\n let match: RegExpExecArray | null;\n while ((match = re.exec(text)) !== null) {\n const matchText = match[0] ?? \"\";\n if (match.index > lastIndex) {\n spans.push({ type: \"text\", value: text.slice(lastIndex, match.index) });\n }\n if (match[1] !== undefined) {\n spans.push({ type: \"code\", value: match[1] });\n } else if (match[2] !== undefined) {\n spans.push({ type: \"bold\", value: match[2] });\n } else if (match[3] !== undefined) {\n spans.push({ type: \"italic\", value: match[3] });\n } else if (match[4] !== undefined) {\n spans.push({ type: \"strike\", value: match[4] });\n } else if (match[5] !== undefined) {\n spans.push({ type: \"link\", href: match[5] });\n } else if (match[6] !== undefined) {\n spans.push({ type: \"mention\", id: match[6], label: `@${match[6]}` });\n } else if (match[7] !== undefined) {\n spans.push({ type: \"mention\", label: match[7] });\n }\n lastIndex = match.index + matchText.length;\n }\n if (lastIndex < text.length) {\n spans.push({ type: \"text\", value: text.slice(lastIndex) });\n }\n return spans;\n}\n\n/** Convenience shape for authoring an in-message image. */\nexport interface ImageSugar {\n src: string;\n alt?: string;\n width?: number;\n height?: number;\n}\n\n/** `text` string → a single text content node. */\nexport function textToContentNode(text: string): TextNode {\n return { type: \"text\", spans: parseInline(text) };\n}\n\n/** `image` sugar → an image content node (drops undefined optionals). */\nexport function imageToContentNode(image: ImageSugar): ImageNode {\n const node: ImageNode = { type: \"image\", src: image.src };\n if (image.alt !== undefined) node.alt = image.alt;\n if (image.width !== undefined) node.width = image.width;\n if (image.height !== undefined) node.height = image.height;\n return node;\n}\n\n/** The sugar fields a message may carry instead of explicit `content`. */\nexport interface MessageBodySugar {\n /** Authored text (parsed into inline marks). */\n text?: string;\n /** In-message images, rendered after the text. */\n images?: ImageSugar[];\n /** Explicit content nodes; when present, wins over `text`/`images`. */\n content?: ContentNode[];\n}\n\n/**\n * Resolve a block's `text` sugar to `spans` (and recurse into attachments), so\n * skins only ever read resolved inline content. Non-text blocks pass through.\n */\nexport function normalizeContentNode(node: ContentNode): ContentNode {\n // Explicit casts: `ContentNode` includes the lenient `UnknownContentNode`\n // (index signature), so a plain `switch` widens the narrowed fields to\n // `unknown`. The runtime `type` check is authoritative.\n if (node.type === \"section\") {\n const s = node as SectionNode;\n return {\n type: \"section\",\n spans: s.spans ?? parseInline(s.text ?? \"\"),\n ...(s.accessory ? { accessory: s.accessory } : {}),\n ...(s.fields\n ? {\n fields: s.fields.map((f) => ({\n spans: f.spans ?? parseInline(f.text ?? \"\"),\n })),\n }\n : {}),\n };\n }\n if (node.type === \"context\") {\n const c = node as ContextNode;\n return {\n type: \"context\",\n elements: c.elements.map((el) =>\n el.type === \"text\"\n ? { type: \"text\", spans: el.spans ?? parseInline(el.text ?? \"\") }\n : el,\n ),\n };\n }\n if (node.type === \"attachment\") {\n const a = node as AttachmentNode;\n return {\n type: \"attachment\",\n ...(a.color ? { color: a.color } : {}),\n content: a.content.map(normalizeContentNode),\n };\n }\n return node;\n}\n\n/**\n * Resolve a message's body sugar to content nodes. Explicit `content` is\n * authoritative (block `text` sugar is normalized to spans); otherwise the text\n * node (if any) comes first, then images — matching the \"here's the toast:\n * [image]\" ordering in the spec example.\n */\nexport function toContentNodes(body: MessageBodySugar): ContentNode[] {\n if (body.content) return body.content.map(normalizeContentNode);\n const nodes: ContentNode[] = [];\n if (body.text !== undefined && body.text.length > 0) {\n nodes.push(textToContentNode(body.text));\n }\n if (body.images) {\n for (const image of body.images) nodes.push(imageToContentNode(image));\n }\n return nodes;\n}\n","import { z } from \"zod\";\nimport { contentSchema } from \"./content-registry.js\";\n\n/**\n * Per-step overrides shared by every step. The engine computes timing from the\n * pacing model; these win over the computed values. Use a dedicated `delay`\n * step type to insert explicit pauses on the timeline.\n */\nconst stepBaseShape = {\n /** Optional id so reactions/edits/deletes can target this step's message. */\n id: z.string().optional(),\n /** Reveal with no animation and no computed delay. */\n instant: z.boolean().optional(),\n};\n\n/** Authoring sugar for an in-message image (compiled to an image node). */\nexport const imageSugarSchema = z.object({\n src: z.string(),\n alt: z.string().optional(),\n width: z.number().positive().optional(),\n height: z.number().positive().optional(),\n});\n\n/** Message-body sugar fields; `content` (explicit nodes) wins when present. */\nconst bodyShape = {\n text: z.string().optional(),\n images: z.array(imageSugarSchema).optional(),\n content: contentSchema.optional(),\n};\n\n/** Optional typing indicator preceding a message. */\nconst messageTypingSchema = z.union([\n z.boolean(),\n z.object({ showTypingFor: z.number().nonnegative().optional() }),\n]);\n\n/** An incoming message, optionally preceded by a typing indicator. */\nexport const messageStepSchema = z.object({\n type: z.literal(\"message\"),\n from: z.string(),\n typing: messageTypingSchema.optional(),\n ...bodyShape,\n ...stepBaseShape,\n});\n\n/** A reaction landing on a target message (`$prev` or a message id). */\nexport const reactionStepSchema = z.object({\n type: z.literal(\"reaction\"),\n /** Message id to react to. Defaults to `$prev` (the most-recent message). */\n target: z.string().optional(),\n emoji: z.string(),\n /** Emoji shortcode without colons, e.g. `\"eyes\"` — shown in skin tooltips. */\n shortcode: z.string().optional(),\n from: z.string().optional(),\n /** Gap from when the target appears, before the reaction lands (ms). */\n delay: z.number().nonnegative().optional(),\n ...stepBaseShape,\n});\n\n/** A standalone typing indicator (no message necessarily follows). */\nexport const typingStepSchema = z.object({\n type: z.literal(\"typing\"),\n from: z.string(),\n showTypingFor: z.number().nonnegative().optional(),\n ...stepBaseShape,\n});\n\n/** The self participant typing into the composer, char by char. */\nexport const composerTypeStepSchema = z.object({\n type: z.literal(\"composerType\"),\n from: z.string(),\n text: z.string(),\n /** Override the computed typing duration (ms). */\n typingDuration: z.number().nonnegative().optional(),\n ...stepBaseShape,\n});\n\n/** Commit the composer's current text to the thread. */\nexport const sendStepSchema = z.object({\n type: z.literal(\"send\"),\n from: z.string().optional(),\n ...stepBaseShape,\n});\n\n/** Edit a previously sent message's body. */\nexport const editStepSchema = z.object({\n type: z.literal(\"edit\"),\n /** Message id to edit. Defaults to `$prev` (the most-recent message). */\n target: z.string().optional(),\n ...bodyShape,\n ...stepBaseShape,\n});\n\n/** Delete a previously sent message. */\nexport const deleteStepSchema = z.object({\n type: z.literal(\"delete\"),\n /** Message id to delete. Defaults to `$prev` (the most-recent message). */\n target: z.string().optional(),\n ...stepBaseShape,\n});\n\n/** A read receipt (optionally by a participant, optionally up to a message). */\nexport const readReceiptStepSchema = z.object({\n type: z.literal(\"readReceipt\"),\n by: z.string().optional(),\n target: z.string().optional(),\n ...stepBaseShape,\n});\n\n/**\n * A system / notice line — not a chat message. Skins render it distinctly: a\n * centered muted notice (iMessage/WhatsApp/Slack \"X joined #channel\"), an agent\n * tool-output line (Cursor/Claude Code `⎿ …`), a CI notice (Discord), etc. App\n * \"cards\" are NOT system steps — model those as a `message` from an `app`\n * participant carrying Block Kit content (header/section/context/actions/…).\n */\nexport const systemStepSchema = z.object({\n type: z.literal(\"system\"),\n from: z.string().optional(),\n ...bodyShape,\n ...stepBaseShape,\n});\n\n/** An explicit pause in the timeline (formerly `beat`). */\nexport const delayStepSchema = z.object({\n type: z.literal(\"delay\"),\n duration: z.number().nonnegative(),\n ...stepBaseShape,\n});\n\nexport const timelineStepSchema = z.discriminatedUnion(\"type\", [\n messageStepSchema,\n reactionStepSchema,\n typingStepSchema,\n composerTypeStepSchema,\n sendStepSchema,\n editStepSchema,\n deleteStepSchema,\n readReceiptStepSchema,\n systemStepSchema,\n delayStepSchema,\n]);\nexport type TimelineStep = z.infer<typeof timelineStepSchema>;\nexport type TimelineStepInput = z.input<typeof timelineStepSchema>;\n\nexport const timelineSchema = z.array(timelineStepSchema);\n\n/** The discriminant values of every timeline step. */\nexport const STEP_TYPES = [\n \"message\",\n \"reaction\",\n \"typing\",\n \"composerType\",\n \"send\",\n \"edit\",\n \"delete\",\n \"readReceipt\",\n \"system\",\n \"delay\",\n] as const;\nexport type StepType = (typeof STEP_TYPES)[number];\n","import { z } from \"zod\";\nimport { metaSchema } from \"./meta.js\";\nimport { participantsSchema } from \"./participants.js\";\nimport { pacingSchema } from \"./pacing.js\";\nimport { timelineSchema } from \"./timeline.js\";\n\n/**\n * The config schema version. Distinct from the `@typecaast/schema` package\n * version (related but versioned independently — see PLAN §22). A config newer\n * than the installed runtime fails parsing with a clear error.\n */\nexport const CONFIG_VERSION = 1;\n\n/** The complete Typecaast config: the single source of truth for a simulation. */\nexport const configSchema = z.object({\n version: z.literal(CONFIG_VERSION),\n meta: metaSchema,\n participants: participantsSchema,\n /** Optional; omitted pacing resolves to the full default model. */\n pacing: pacingSchema.default(() => pacingSchema.parse({})),\n timeline: timelineSchema,\n});\n\n/** A parsed config (defaults applied). */\nexport type Config = z.infer<typeof configSchema>;\n/** A config as authored (fields with defaults are optional). */\nexport type ConfigInput = z.input<typeof configSchema>;\n\n/**\n * Generate the JSON Schema for a Typecaast config (for editor autocomplete and\n * `$schema` references). Lazy so importing the package never eagerly runs the\n * conversion. Refinements (e.g. the lenient content-node guard) are not\n * representable in JSON Schema and are dropped.\n */\nexport function configJsonSchema(): Record<string, unknown> {\n return z.toJSONSchema(configSchema, {\n unrepresentable: \"any\",\n target: \"draft-7\",\n }) as Record<string, unknown>;\n}\n","import { CONFIG_VERSION, configSchema } from \"./config.js\";\n\n/** Diagnostic severity tiers (PLAN §23). */\nexport type Severity = \"error\" | \"warning\" | \"info\";\n\n/**\n * A single validation finding. Every diagnostic carries a stable `code`, the\n * offending `location` (step/message/path), and a `hint` for remediation.\n */\nexport interface Diagnostic {\n code: string;\n severity: Severity;\n message: string;\n /** Dotted/indexed path, e.g. `timeline[3].from` or `meta.canvas.width`. */\n location?: string;\n hint?: string;\n}\n\nfunction formatPath(path: ReadonlyArray<PropertyKey>): string {\n let out = \"\";\n for (const key of path) {\n if (typeof key === \"number\") out += `[${key}]`;\n else if (out === \"\") out += String(key);\n else out += `.${String(key)}`;\n }\n return out;\n}\n\n/** Read an optional `from`/`by`/`target` field off any step shape. */\nfunction field(step: unknown, key: string): string | undefined {\n const value = (step as Record<string, unknown>)[key];\n return typeof value === \"string\" ? value : undefined;\n}\n\n/**\n * Validate a parsed config value (already JSON-decoded). Returns all\n * diagnostics — schema errors, then semantic checks (reference integrity,\n * target resolution). Reusable by the CLI and the builder's lint panel.\n *\n * A version newer than the runtime short-circuits with a single hard error.\n */\nexport function validateConfig(raw: unknown): Diagnostic[] {\n const diagnostics: Diagnostic[] = [];\n\n if (raw && typeof raw === \"object\" && \"version\" in raw) {\n const version = (raw as { version: unknown }).version;\n if (typeof version === \"number\" && version > CONFIG_VERSION) {\n return [\n {\n code: \"E_VERSION\",\n severity: \"error\",\n message: `Config version ${version} is newer than this runtime supports (max ${CONFIG_VERSION}).`,\n location: \"version\",\n hint: \"Upgrade Typecaast (e.g. `npm i @typecaast/cli@latest`).\",\n },\n ];\n }\n }\n\n const result = configSchema.safeParse(raw);\n if (!result.success) {\n for (const issue of result.error.issues) {\n diagnostics.push({\n code: \"E_SCHEMA\",\n severity: \"error\",\n message: issue.message,\n location: formatPath(issue.path) || undefined,\n });\n }\n return diagnostics;\n }\n\n const config = result.data;\n\n // Duplicate participant ids.\n const ids = config.participants.map((p) => p.id);\n const idSet = new Set(ids);\n for (const dup of new Set(ids.filter((id, i) => ids.indexOf(id) !== i))) {\n diagnostics.push({\n code: \"E_DUP_PARTICIPANT\",\n severity: \"error\",\n message: `Duplicate participant id \"${dup}\".`,\n location: \"participants\",\n hint: \"Participant ids must be unique.\",\n });\n }\n\n const hasSelf = config.participants.some((p) => p.isSelf);\n let warnedNoSelf = false;\n const messageIds = new Set<string>();\n let priorMessages = 0;\n\n config.timeline.forEach((step, i) => {\n const loc = `timeline[${i}]`;\n\n const from = field(step, \"from\");\n if (from !== undefined && !idSet.has(from)) {\n diagnostics.push({\n code: \"E_REF_PARTICIPANT\",\n severity: \"error\",\n message: `Step references unknown participant \"${from}\".`,\n location: `${loc}.from`,\n hint: `Add a participant with id \"${from}\" or fix the reference.`,\n });\n }\n\n if (step.type === \"readReceipt\") {\n const by = field(step, \"by\");\n if (by !== undefined && !idSet.has(by)) {\n diagnostics.push({\n code: \"E_REF_PARTICIPANT\",\n severity: \"error\",\n message: `Read receipt references unknown participant \"${by}\".`,\n location: `${loc}.by`,\n hint: `Add a participant with id \"${by}\" or fix the reference.`,\n });\n }\n }\n\n if (\n (step.type === \"composerType\" || step.type === \"send\") &&\n !hasSelf &&\n !warnedNoSelf\n ) {\n warnedNoSelf = true;\n diagnostics.push({\n code: \"W_NO_SELF\",\n severity: \"warning\",\n message: \"The composer is used but no participant is marked as self.\",\n location: loc,\n hint: 'Mark a participant with `\"isSelf\": true`.',\n });\n }\n\n if (\n (step.type === \"message\" || step.type === \"system\") &&\n typeof step.id === \"string\"\n ) {\n messageIds.add(step.id);\n }\n\n if (\n step.type === \"reaction\" ||\n step.type === \"edit\" ||\n step.type === \"delete\"\n ) {\n const target = step.target;\n // Blank/`$prev` both mean \"the most-recent message\".\n if (!target || target === \"$prev\") {\n if (priorMessages === 0) {\n diagnostics.push({\n code: \"W_NO_PREV\",\n severity: \"warning\",\n message: \"Default target has no preceding message.\",\n location: `${loc}.target`,\n hint: \"Place this after a message, or set a target message id.\",\n });\n }\n } else if (!messageIds.has(target)) {\n diagnostics.push({\n code: \"W_TARGET\",\n severity: \"warning\",\n message: `Target \"${target}\" matches no preceding message id.`,\n location: `${loc}.target`,\n hint: 'Give the target message an `\"id\"`, or check the reference.',\n });\n }\n }\n\n if (step.type === \"message\" || step.type === \"system\") priorMessages++;\n });\n\n return diagnostics;\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/meta.ts","../src/participants.ts","../src/pacing.ts","../src/content-nodes.ts","../src/content-registry.ts","../src/content-sugar.ts","../src/timeline.ts","../src/config.ts","../src/validate.ts"],"names":["z"],"mappings":";;;AAGO,IAAM,UAAA,GAAa,EAAE,MAAA,CAAO;AAAA,EACjC,OAAO,CAAA,CAAE,MAAA,EAAO,CAAE,GAAA,GAAM,QAAA,EAAS;AAAA,EACjC,QAAQ,CAAA,CAAE,MAAA,EAAO,CAAE,GAAA,GAAM,QAAA;AAC3B,CAAC;AAgBM,IAAM,gBAAgB,CAAA,CAAE,IAAA,CAAK,CAAC,QAAA,EAAU,OAAA,EAAS,OAAO,CAAC;AASzD,IAAM,qBAAqB,CAAA,CAAE,IAAA,CAAK,CAAC,MAAA,EAAQ,QAAA,EAAU,OAAO,CAAC;AAQ7D,IAAM,kBAAkB,CAAA,CAAE,IAAA,CAAK,CAAC,OAAA,EAAS,MAAA,EAAQ,MAAM,CAAC;AAQxD,IAAM,kBAAkB,CAAA,CAAE,IAAA,CAAK,CAAC,QAAA,EAAU,KAAK,CAAC;AAIhD,IAAM,aAAA,GAAgB,EAAE,MAAA,CAAO;AAAA,EACpC,EAAA,EAAI,CAAA,CAAE,MAAA,EAAO,CAAE,IAAI,CAAC,CAAA;AAAA,EACpB,OAAA,EAAS,CAAA,CAAE,MAAA,CAAO,CAAA,CAAE,MAAA,IAAU,CAAA,CAAE,OAAA,EAAS,CAAA,CAAE,QAAA;AAC7C,CAAC;AAIM,IAAM,UAAA,GAAa,EAAE,MAAA,CAAO;AAAA;AAAA,EAEjC,MAAA,EAAQ,UAAA;AAAA,EACR,GAAA,EAAK,EAAE,MAAA,EAAO,CAAE,KAAI,CAAE,QAAA,EAAS,CAAE,OAAA,CAAQ,EAAE,CAAA;AAAA,EAC3C,GAAA,EAAK,aAAA,CAAc,OAAA,CAAQ,QAAQ,CAAA;AAAA,EACnC,KAAA,EAAO,eAAA,CAAgB,OAAA,CAAQ,MAAM,CAAA;AAAA,EACrC,IAAA,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AAEpB,MAAA,IAAI,CAAC,MAAA,IAAU,MAAA,KAAW,OAAA,EAAS;AACjC,QAAA,IAAI,kBAAkB,CAAA,EAAG;AACvB,UAAA,WAAA,CAAY,IAAA,CAAK;AAAA,YACf,IAAA,EAAM,WAAA;AAAA,YACN,QAAA,EAAU,SAAA;AAAA,YACV,OAAA,EAAS,0CAAA;AAAA,YACT,QAAA,EAAU,GAAG,GAAG,CAAA,OAAA,CAAA;AAAA,YAChB,IAAA,EAAM;AAAA,WACP,CAAA;AAAA,QACH;AAAA,MACF,CAAA,MAAA,IAAW,CAAC,UAAA,CAAW,GAAA,CAAI,MAAM,CAAA,EAAG;AAClC,QAAA,WAAA,CAAY,IAAA,CAAK;AAAA,UACf,IAAA,EAAM,UAAA;AAAA,UACN,QAAA,EAAU,SAAA;AAAA,UACV,OAAA,EAAS,WAAW,MAAM,CAAA,kCAAA,CAAA;AAAA,UAC1B,QAAA,EAAU,GAAG,GAAG,CAAA,OAAA,CAAA;AAAA,UAChB,IAAA,EAAM;AAAA,SACP,CAAA;AAAA,MACH;AAAA,IACF;AAEA,IAAA,IAAI,IAAA,CAAK,IAAA,KAAS,SAAA,IAAa,IAAA,CAAK,SAAS,QAAA,EAAU,aAAA,EAAA;AAAA,EACzD,CAAC,CAAA;AAED,EAAA,OAAO,WAAA;AACT","file":"index.js","sourcesContent":["import { z } from \"zod\";\n\n/** A pixel dimension pair (authoring reference; the exact frame for video). */\nexport const sizeSchema = z.object({\n width: z.number().int().positive(),\n height: z.number().int().positive(),\n});\nexport type Size = z.infer<typeof sizeSchema>;\n\n/**\n * How the rendered conversation fills its container. The widget is\n * **container-driven** in the first two modes — its size never grows\n * with content; messages clip when they overflow the bottom-anchored\n * thread.\n * - `reflow`: fills the container in both axes; bubbles re-wrap to the\n * container width.\n * - `scale`: renders at the exact authored canvas size and CSS-scales\n * to fit (preserves the canonical layout — letterboxes if the\n * container's aspect doesn't match the canvas).\n * - `fixed`: pins the widget to the authored canvas px; clips. The only\n * non-container-driven mode.\n */\nexport const fitModeSchema = z.enum([\"reflow\", \"scale\", \"fixed\"]);\nexport type FitMode = z.infer<typeof fitModeSchema>;\n\n/**\n * Reply-box (composer) visibility:\n * - `auto`: shown only while someone is typing/sending (default).\n * - `always`: keep the message input visible the whole time.\n * - `never`: never show it.\n */\nexport const composerModeSchema = z.enum([\"auto\", \"always\", \"never\"]);\nexport type ComposerMode = z.infer<typeof composerModeSchema>;\n\n/**\n * Color theme. `auto` inherits the host page's `prefers-color-scheme` (live\n * preview) and falls back to `light`; video export resolves `auto` to a\n * concrete mode and defaults to `light` when unspecified.\n */\nexport const themeModeSchema = z.enum([\"light\", \"dark\", \"auto\"]);\nexport type ThemeMode = z.infer<typeof themeModeSchema>;\n\n/**\n * Asset resolution strategy.\n * - `inline`: embed images as data URLs (self-contained config; default).\n * - `url`: reference hosted images (smaller config; user hosts their own).\n */\nexport const assetModeSchema = z.enum([\"inline\", \"url\"]);\nexport type AssetMode = z.infer<typeof assetModeSchema>;\n\n/** Reference to a skin plus its skin-specific options (validated by the skin). */\nexport const skinRefSchema = z.object({\n id: z.string().min(1),\n options: z.record(z.string(), z.unknown()).optional(),\n});\nexport type SkinRef = z.infer<typeof skinRefSchema>;\n\n/** Top-level rendering/authoring metadata. */\nexport const metaSchema = z.object({\n /** Authoring reference size; fixed frame for video. */\n canvas: sizeSchema,\n fps: z.number().int().positive().default(30),\n fit: fitModeSchema.default(\"reflow\"),\n theme: themeModeSchema.default(\"auto\"),\n skin: skinRefSchema,\n /** Seed for all deterministic jitter (no `Math.random`). */\n seed: z.number().int().default(42),\n /** Canvas background: `\"transparent\"` or any CSS color. */\n background: z.string().default(\"transparent\"),\n assets: assetModeSchema.default(\"inline\"),\n /** Reply-box visibility (see `composerModeSchema`). */\n composer: composerModeSchema.default(\"auto\"),\n /**\n * Auto-replay when the timeline reaches the end. Honored by the builder\n * preview and by `<Typecaast>` when the consumer doesn't pass an explicit\n * `loop` prop.\n */\n loop: z.boolean().default(false),\n});\n\n/** `meta` as it appears after parsing (defaults applied). */\nexport type Meta = z.infer<typeof metaSchema>;\n/** `meta` as authored (fields with defaults are optional). */\nexport type MetaInput = z.input<typeof metaSchema>;\n","import { z } from \"zod\";\n\n/** Whether a participant is a human or an app/bot (changes how skins render it). */\nexport const participantKindSchema = z.enum([\"person\", \"app\"]);\nexport type ParticipantKind = z.infer<typeof participantKindSchema>;\n\n/** A speaker in the conversation. */\nexport const participantSchema = z.object({\n /** Stable id referenced by timeline steps (`from`, `target`, …). */\n id: z.string().min(1),\n name: z.string().min(1),\n /** Avatar asset (data URL or referenced URL per `meta.assets`). */\n avatar: z.string().optional(),\n /** Accent color (CSS color) some skins use for the author. */\n color: z.string().optional(),\n /** The viewer — rendered as the \"self\" side and the composer's author. */\n isSelf: z.boolean().optional(),\n kind: participantKindSchema.default(\"person\"),\n});\nexport type Participant = z.infer<typeof participantSchema>;\nexport type ParticipantInput = z.input<typeof participantSchema>;\n\nexport const participantsSchema = z.array(participantSchema);\n","import { z } from \"zod\";\n\n/**\n * Global auto-pacing defaults. Every value is overridable per step in the\n * timeline; the engine computes delays/durations from these and bakes in\n * seeded, deterministic jitter (`humanize`).\n */\nexport const pacingSchema = z.object({\n /** Gap before an incoming message ≈ reading time of the prior message. */\n readingWpm: z.number().positive().default(240),\n /** Chars/sec for composer typing + sender typing duration. */\n typingCps: z.number().positive().default(14),\n /** ±fraction of seeded jitter so pacing doesn't feel robotic (0–1). */\n humanize: z.number().min(0).max(1).default(0.15),\n /** Delay before the first event. */\n startDelayMs: z.number().nonnegative().default(400),\n});\nexport type Pacing = z.infer<typeof pacingSchema>;\nexport type PacingInput = z.input<typeof pacingSchema>;\n","import { z } from \"zod\";\n\n/**\n * Inline marks inside a text node. `text` runs carry plain content; the others\n * are the recognized marks (`code`, `link`, `mention`, `emoji`, and the\n * emphasis marks `bold`/`italic`/`strike`). New marks can be added without a\n * schema-version bump (unknown content node types are handled leniently; see\n * the registry). Emphasis marks are flat (no nesting, e.g. bold *and* italic on\n * the same run) — a deliberate v1 simplification matching Slack's common usage.\n */\nexport const inlineTextSchema = z.object({\n type: z.literal(\"text\"),\n value: z.string(),\n});\nexport const inlineCodeSchema = z.object({\n type: z.literal(\"code\"),\n value: z.string(),\n});\nexport const inlineBoldSchema = z.object({\n type: z.literal(\"bold\"),\n value: z.string(),\n});\nexport const inlineItalicSchema = z.object({\n type: z.literal(\"italic\"),\n value: z.string(),\n});\nexport const inlineStrikeSchema = z.object({\n type: z.literal(\"strike\"),\n value: z.string(),\n});\nexport const inlineLinkSchema = z.object({\n type: z.literal(\"link\"),\n href: z.string(),\n label: z.string().optional(),\n});\nexport const inlineMentionSchema = z.object({\n type: z.literal(\"mention\"),\n /** Display label as authored, e.g. `\"@PostHog\"`. */\n label: z.string(),\n /** Resolved participant id, filled when the mention binds to a participant. */\n id: z.string().optional(),\n});\nexport const inlineEmojiSchema = z.object({\n type: z.literal(\"emoji\"),\n /** The rendered glyph, e.g. `\"🦔\"`. */\n value: z.string(),\n /** Optional shortcode, e.g. `\"hedgehog\"`. */\n shortcode: z.string().optional(),\n});\n\nexport const inlineNodeSchema = z.discriminatedUnion(\"type\", [\n inlineTextSchema,\n inlineCodeSchema,\n inlineBoldSchema,\n inlineItalicSchema,\n inlineStrikeSchema,\n inlineLinkSchema,\n inlineMentionSchema,\n inlineEmojiSchema,\n]);\nexport type InlineNode = z.infer<typeof inlineNodeSchema>;\n\n/** A block of inline content. */\nexport const textNodeSchema = z.object({\n type: z.literal(\"text\"),\n spans: z.array(inlineNodeSchema),\n});\nexport type TextNode = z.infer<typeof textNodeSchema>;\n\n/** An in-message image (same hosting model as avatars, per `meta.assets`). */\nexport const imageNodeSchema = z.object({\n type: z.literal(\"image\"),\n src: z.string(),\n alt: z.string().optional(),\n width: z.number().positive().optional(),\n height: z.number().positive().optional(),\n});\nexport type ImageNode = z.infer<typeof imageNodeSchema>;\n\n// --- Block Kit content nodes -------------------------------------------------\n// Slack apps compose rich messages from \"blocks\". These model the common set\n// (header / section / context / divider / actions / image / attachment) so an\n// app message is a normal message from an `app` participant whose `content`\n// carries blocks — the same primitives a real Slack app would emit. Skins that\n// don't understand a block skip it (lenient registry), so they're Slack-leaning\n// but safe everywhere.\n\n/**\n * An interactive button (in an `actions` block or as a `section` accessory).\n * With `href` the skin renders a link opening in a new tab; without one it's\n * visibly inert. `style` controls emphasis — omitted = default (outlined),\n * matching Slack's `primary`/`danger`/default button styles.\n */\nexport const buttonElementSchema = z.object({\n type: z.literal(\"button\"),\n label: z.string(),\n href: z.string().optional(),\n style: z.enum([\"primary\", \"danger\"]).optional(),\n});\nexport type ButtonElement = z.infer<typeof buttonElementSchema>;\n\n/** A small image element (a `context` element or a `section` accessory). */\nexport const imageElementSchema = z.object({\n type: z.literal(\"image\"),\n src: z.string(),\n alt: z.string().optional(),\n});\nexport type ImageElement = z.infer<typeof imageElementSchema>;\n\n/** A large bold heading (Block Kit `header` — plain text, no inline marks). */\nexport const headerNodeSchema = z.object({\n type: z.literal(\"header\"),\n text: z.string(),\n});\nexport type HeaderNode = z.infer<typeof headerNodeSchema>;\n\n/**\n * A section block: a paragraph of inline content, with an optional `accessory`\n * (a button or image to its right) and optional `fields` (a two-column grid).\n * Text may be authored as `spans` (resolved) or `text` (sugar, parsed to spans\n * by `toContentNodes`).\n */\nexport const sectionFieldSchema = z.object({\n spans: z.array(inlineNodeSchema).optional(),\n text: z.string().optional(),\n});\nexport const sectionNodeSchema = z.object({\n type: z.literal(\"section\"),\n spans: z.array(inlineNodeSchema).optional(),\n text: z.string().optional(),\n accessory: z\n .discriminatedUnion(\"type\", [buttonElementSchema, imageElementSchema])\n .optional(),\n fields: z.array(sectionFieldSchema).optional(),\n});\nexport type SectionNode = z.infer<typeof sectionNodeSchema>;\n\n/** A context block: a row of small, muted text/image elements. */\nexport const contextTextElementSchema = z.object({\n type: z.literal(\"text\"),\n spans: z.array(inlineNodeSchema).optional(),\n text: z.string().optional(),\n});\nexport const contextElementSchema = z.discriminatedUnion(\"type\", [\n contextTextElementSchema,\n imageElementSchema,\n]);\nexport type ContextElement = z.infer<typeof contextElementSchema>;\nexport const contextNodeSchema = z.object({\n type: z.literal(\"context\"),\n elements: z.array(contextElementSchema),\n});\nexport type ContextNode = z.infer<typeof contextNodeSchema>;\n\n/** A horizontal rule between blocks. */\nexport const dividerNodeSchema = z.object({\n type: z.literal(\"divider\"),\n});\nexport type DividerNode = z.infer<typeof dividerNodeSchema>;\n\n/** A row of interactive buttons. */\nexport const actionsNodeSchema = z.object({\n type: z.literal(\"actions\"),\n elements: z.array(buttonElementSchema),\n});\nexport type ActionsNode = z.infer<typeof actionsNodeSchema>;\n\n/**\n * A multi-line preformatted code block (Slack's fenced ``` block) — a monospaced\n * box that preserves whitespace and newlines verbatim (used for tables, logs,\n * snippets). Distinct from the inline `code` mark; `text` is **literal** and is\n * never parsed for inline marks. `lang` is an optional language hint (unused by\n * the current skins, reserved for future syntax highlighting).\n */\nexport const codeBlockNodeSchema = z.object({\n type: z.literal(\"codeblock\"),\n text: z.string(),\n lang: z.string().optional(),\n});\nexport type CodeBlockNode = z.infer<typeof codeBlockNodeSchema>;\n\n/**\n * A legacy-style attachment: nested blocks rendered behind a colored left bar.\n * `color` is any CSS color (defaults to a neutral bar). Recursive — its Zod\n * schema lives in `content-registry.ts` (where the node union is built).\n */\nexport interface AttachmentNode {\n type: \"attachment\";\n color?: string;\n content: ContentNode[];\n}\n\n/**\n * A content node whose `type` the runtime doesn't recognize. It validates\n * leniently (only `type` is required) and is skipped by skins that don't handle\n * it — so future node types (`linkPreview`, `videoEmbed`, …) slot in without\n * breaking older runtimes or bumping the schema version.\n */\nexport interface UnknownContentNode {\n type: string;\n [key: string]: unknown;\n}\n\n/** The body of a message: an ordered list of content nodes. */\nexport type ContentNode =\n | TextNode\n | ImageNode\n | HeaderNode\n | SectionNode\n | ContextNode\n | DividerNode\n | ActionsNode\n | CodeBlockNode\n | AttachmentNode\n | UnknownContentNode;\n","import { z } from \"zod\";\nimport {\n actionsNodeSchema,\n codeBlockNodeSchema,\n contextNodeSchema,\n dividerNodeSchema,\n headerNodeSchema,\n imageNodeSchema,\n sectionNodeSchema,\n textNodeSchema,\n type AttachmentNode,\n type ContentNode,\n} from \"./content-nodes.js\";\n\n/**\n * A legacy-style attachment node — nested blocks behind a colored left bar.\n * Recursive (its `content` is the full node array), so it's defined here where\n * `contentSchema` is in scope and wrapped in `z.lazy` to defer the reference.\n */\nexport const attachmentNodeSchema: z.ZodType<AttachmentNode> = z.lazy(() =>\n z.object({\n type: z.literal(\"attachment\"),\n color: z.string().optional(),\n content: contentSchema,\n }),\n);\n\n/**\n * The content-type registry. Each message body node has a `type` resolved\n * through here. Built-ins cover text/image plus the Block Kit blocks\n * (header/section/context/divider/actions/attachment); additional types can be\n * registered (with their own strict schema) without a schema-version bump.\n *\n * Nodes whose `type` is **not** registered validate leniently (only `type` is\n * required) and are skipped by skins that don't handle them. Nodes whose `type`\n * **is** registered must satisfy that type's schema — so a malformed `text`\n * node is an error rather than silently passing through the lenient path.\n */\nconst registry = new Map<string, z.ZodTypeAny>([\n [\"text\", textNodeSchema],\n [\"image\", imageNodeSchema],\n [\"header\", headerNodeSchema],\n [\"section\", sectionNodeSchema],\n [\"context\", contextNodeSchema],\n [\"divider\", dividerNodeSchema],\n [\"actions\", actionsNodeSchema],\n [\"codeblock\", codeBlockNodeSchema],\n [\"attachment\", attachmentNodeSchema],\n]);\n\n/** Register (or override) the strict schema for a content node type. */\nexport function registerContentNodeType(\n type: string,\n schema: z.ZodTypeAny,\n): void {\n registry.set(type, schema);\n}\n\n/** The content node types the runtime validates strictly. */\nexport function knownContentNodeTypes(): string[] {\n return [...registry.keys()];\n}\n\nexport function isKnownContentNodeType(type: string): boolean {\n return registry.has(type);\n}\n\n/** Accepts any object with a string `type` that isn't a registered type. */\nconst lenientUnknownNodeSchema = z\n .looseObject({ type: z.string() })\n .refine((node) => !registry.has(node.type), {\n message: \"malformed content node for a registered type\",\n });\n\n/**\n * Build a content-node schema from the current registry state. Call this after\n * registering a new type to pick it up; `contentNodeSchema` below is the\n * default built from the v1 registry (`text` + `image`).\n */\nexport function buildContentNodeSchema(): z.ZodType<ContentNode> {\n return z.union([\n ...registry.values(),\n lenientUnknownNodeSchema,\n ]) as unknown as z.ZodType<ContentNode>;\n}\n\n/** Default content-node schema (text + image + lenient unknown). */\nexport const contentNodeSchema = buildContentNodeSchema();\n\n/** A message body: an ordered array of content nodes. */\nexport const contentSchema = z.array(contentNodeSchema);\n","import type {\n AttachmentNode,\n ContentNode,\n ContextNode,\n ImageNode,\n InlineNode,\n SectionNode,\n TextNode,\n} from \"./content-nodes.js\";\n\n/**\n * Matches an inline mark, in priority order: a backtick code span, Slack mrkdwn\n * emphasis (`*bold*`, `_italic_`, `~strike~`), an http(s) link, a `<@id>`\n * mention (Slack's encoded form — resolved to a display name at compile), or a\n * bare `@name` mention. Everything else becomes plain text runs.\n *\n * Emphasis delimiters must hug their content (no leading/trailing space), and\n * `_italic_` requires non-alphanumeric boundaries so `snake_case` and URLs with\n * underscores are left alone.\n */\nconst INLINE_TOKEN =\n /`([^`]+)`|\\*(?!\\s)([^*\\n]+?)(?<!\\s)\\*|(?<![A-Za-z0-9])_(?!\\s)([^_\\n]+?)(?<!\\s)_(?![A-Za-z0-9])|~(?!\\s)([^~\\n]+?)(?<!\\s)~|(https?:\\/\\/[^\\s]+)|<@([A-Za-z0-9_.-]+)>|(@[A-Za-z0-9_][\\w.-]*)/g;\n\n/**\n * Parse a plain authoring string into inline nodes, extracting inline `code`,\n * `bold`/`italic`/`strike`, links, and mentions. Emoji are left inside text\n * runs (they render fine; a dedicated emoji mark can be authored explicitly).\n * A `<@id>` mention carries its `id` and a placeholder label; the engine\n * resolves the label to the participant's display name at compile time.\n */\nexport function parseInline(text: string): InlineNode[] {\n if (text.length === 0) return [];\n const spans: InlineNode[] = [];\n const re = new RegExp(INLINE_TOKEN.source, \"g\");\n let lastIndex = 0;\n let match: RegExpExecArray | null;\n while ((match = re.exec(text)) !== null) {\n const matchText = match[0] ?? \"\";\n if (match.index > lastIndex) {\n spans.push({ type: \"text\", value: text.slice(lastIndex, match.index) });\n }\n if (match[1] !== undefined) {\n spans.push({ type: \"code\", value: match[1] });\n } else if (match[2] !== undefined) {\n spans.push({ type: \"bold\", value: match[2] });\n } else if (match[3] !== undefined) {\n spans.push({ type: \"italic\", value: match[3] });\n } else if (match[4] !== undefined) {\n spans.push({ type: \"strike\", value: match[4] });\n } else if (match[5] !== undefined) {\n spans.push({ type: \"link\", href: match[5] });\n } else if (match[6] !== undefined) {\n spans.push({ type: \"mention\", id: match[6], label: `@${match[6]}` });\n } else if (match[7] !== undefined) {\n spans.push({ type: \"mention\", label: match[7] });\n }\n lastIndex = match.index + matchText.length;\n }\n if (lastIndex < text.length) {\n spans.push({ type: \"text\", value: text.slice(lastIndex) });\n }\n return spans;\n}\n\n/** Convenience shape for authoring an in-message image. */\nexport interface ImageSugar {\n src: string;\n alt?: string;\n width?: number;\n height?: number;\n}\n\n/** `text` string → a single text content node. */\nexport function textToContentNode(text: string): TextNode {\n return { type: \"text\", spans: parseInline(text) };\n}\n\n/** `image` sugar → an image content node (drops undefined optionals). */\nexport function imageToContentNode(image: ImageSugar): ImageNode {\n const node: ImageNode = { type: \"image\", src: image.src };\n if (image.alt !== undefined) node.alt = image.alt;\n if (image.width !== undefined) node.width = image.width;\n if (image.height !== undefined) node.height = image.height;\n return node;\n}\n\n/** The sugar fields a message may carry instead of explicit `content`. */\nexport interface MessageBodySugar {\n /** Authored text (parsed into inline marks). */\n text?: string;\n /** In-message images, rendered after the text. */\n images?: ImageSugar[];\n /** Explicit content nodes; when present, wins over `text`/`images`. */\n content?: ContentNode[];\n}\n\n/**\n * Resolve a block's `text` sugar to `spans` (and recurse into attachments), so\n * skins only ever read resolved inline content. Non-text blocks pass through.\n */\nexport function normalizeContentNode(node: ContentNode): ContentNode {\n // Explicit casts: `ContentNode` includes the lenient `UnknownContentNode`\n // (index signature), so a plain `switch` widens the narrowed fields to\n // `unknown`. The runtime `type` check is authoritative.\n if (node.type === \"section\") {\n const s = node as SectionNode;\n return {\n type: \"section\",\n spans: s.spans ?? parseInline(s.text ?? \"\"),\n ...(s.accessory ? { accessory: s.accessory } : {}),\n ...(s.fields\n ? {\n fields: s.fields.map((f) => ({\n spans: f.spans ?? parseInline(f.text ?? \"\"),\n })),\n }\n : {}),\n };\n }\n if (node.type === \"context\") {\n const c = node as ContextNode;\n return {\n type: \"context\",\n elements: c.elements.map((el) =>\n el.type === \"text\"\n ? { type: \"text\", spans: el.spans ?? parseInline(el.text ?? \"\") }\n : el,\n ),\n };\n }\n if (node.type === \"attachment\") {\n const a = node as AttachmentNode;\n return {\n type: \"attachment\",\n ...(a.color ? { color: a.color } : {}),\n content: a.content.map(normalizeContentNode),\n };\n }\n return node;\n}\n\n/**\n * Resolve a message's body sugar to content nodes. Explicit `content` is\n * authoritative (block `text` sugar is normalized to spans); otherwise the text\n * node (if any) comes first, then images — matching the \"here's the toast:\n * [image]\" ordering in the spec example.\n */\nexport function toContentNodes(body: MessageBodySugar): ContentNode[] {\n if (body.content) return body.content.map(normalizeContentNode);\n const nodes: ContentNode[] = [];\n if (body.text !== undefined && body.text.length > 0) {\n nodes.push(textToContentNode(body.text));\n }\n if (body.images) {\n for (const image of body.images) nodes.push(imageToContentNode(image));\n }\n return nodes;\n}\n","import { z } from \"zod\";\nimport { contentSchema } from \"./content-registry.js\";\n\n/**\n * Per-step overrides shared by every step. The engine computes timing from the\n * pacing model; these win over the computed values. Use a dedicated `delay`\n * step type to insert explicit pauses on the timeline.\n */\nconst stepBaseShape = {\n /** Optional id so reactions/edits/deletes can target this step's message. */\n id: z.string().optional(),\n /** Reveal with no animation and no computed delay. */\n instant: z.boolean().optional(),\n};\n\n/** Authoring sugar for an in-message image (compiled to an image node). */\nexport const imageSugarSchema = z.object({\n src: z.string(),\n alt: z.string().optional(),\n width: z.number().positive().optional(),\n height: z.number().positive().optional(),\n});\n\n/** Message-body sugar fields; `content` (explicit nodes) wins when present. */\nconst bodyShape = {\n text: z.string().optional(),\n images: z.array(imageSugarSchema).optional(),\n content: contentSchema.optional(),\n};\n\n/** Optional typing indicator preceding a message. */\nconst messageTypingSchema = z.union([\n z.boolean(),\n z.object({ showTypingFor: z.number().nonnegative().optional() }),\n]);\n\n/** An incoming message, optionally preceded by a typing indicator. */\nexport const messageStepSchema = z.object({\n type: z.literal(\"message\"),\n from: z.string(),\n typing: messageTypingSchema.optional(),\n ...bodyShape,\n ...stepBaseShape,\n});\n\n/** A reaction landing on a target message (`$prev` or a message id). */\nexport const reactionStepSchema = z.object({\n type: z.literal(\"reaction\"),\n /** Message id to react to. Defaults to `$prev` (the most-recent message). */\n target: z.string().optional(),\n emoji: z.string(),\n /** Emoji shortcode without colons, e.g. `\"eyes\"` — shown in skin tooltips. */\n shortcode: z.string().optional(),\n from: z.string().optional(),\n /** Gap from when the target appears, before the reaction lands (ms). */\n delay: z.number().nonnegative().optional(),\n ...stepBaseShape,\n});\n\n/** A standalone typing indicator (no message necessarily follows). */\nexport const typingStepSchema = z.object({\n type: z.literal(\"typing\"),\n from: z.string(),\n showTypingFor: z.number().nonnegative().optional(),\n ...stepBaseShape,\n});\n\n/** The self participant typing into the composer, char by char. */\nexport const composerTypeStepSchema = z.object({\n type: z.literal(\"composerType\"),\n from: z.string(),\n text: z.string(),\n /** Override the computed typing duration (ms). */\n typingDuration: z.number().nonnegative().optional(),\n ...stepBaseShape,\n});\n\n/** Commit the composer's current text to the thread. */\nexport const sendStepSchema = z.object({\n type: z.literal(\"send\"),\n from: z.string().optional(),\n ...stepBaseShape,\n});\n\n/** Edit a previously sent message's body. */\nexport const editStepSchema = z.object({\n type: z.literal(\"edit\"),\n /** Message id to edit. Defaults to `$prev` (the most-recent message). */\n target: z.string().optional(),\n ...bodyShape,\n ...stepBaseShape,\n});\n\n/** Delete a previously sent message. */\nexport const deleteStepSchema = z.object({\n type: z.literal(\"delete\"),\n /** Message id to delete. Defaults to `$prev` (the most-recent message). */\n target: z.string().optional(),\n ...stepBaseShape,\n});\n\n/** A read receipt (optionally by a participant, optionally up to a message). */\nexport const readReceiptStepSchema = z.object({\n type: z.literal(\"readReceipt\"),\n by: z.string().optional(),\n target: z.string().optional(),\n ...stepBaseShape,\n});\n\n/**\n * A system / notice line — not a chat message. Skins render it distinctly: a\n * centered muted notice (iMessage/WhatsApp/Slack \"X joined #channel\"), an agent\n * tool-output line (Cursor/Claude Code `⎿ …`), a CI notice (Discord), etc. App\n * \"cards\" are NOT system steps — model those as a `message` from an `app`\n * participant carrying Block Kit content (header/section/context/actions/…).\n */\nexport const systemStepSchema = z.object({\n type: z.literal(\"system\"),\n from: z.string().optional(),\n ...bodyShape,\n ...stepBaseShape,\n});\n\n/** An explicit pause in the timeline (formerly `beat`). */\nexport const delayStepSchema = z.object({\n type: z.literal(\"delay\"),\n duration: z.number().nonnegative(),\n ...stepBaseShape,\n});\n\nexport const timelineStepSchema = z.discriminatedUnion(\"type\", [\n messageStepSchema,\n reactionStepSchema,\n typingStepSchema,\n composerTypeStepSchema,\n sendStepSchema,\n editStepSchema,\n deleteStepSchema,\n readReceiptStepSchema,\n systemStepSchema,\n delayStepSchema,\n]);\nexport type TimelineStep = z.infer<typeof timelineStepSchema>;\nexport type TimelineStepInput = z.input<typeof timelineStepSchema>;\n\nexport const timelineSchema = z.array(timelineStepSchema);\n\n/** The discriminant values of every timeline step. */\nexport const STEP_TYPES = [\n \"message\",\n \"reaction\",\n \"typing\",\n \"composerType\",\n \"send\",\n \"edit\",\n \"delete\",\n \"readReceipt\",\n \"system\",\n \"delay\",\n] as const;\nexport type StepType = (typeof STEP_TYPES)[number];\n","import { z } from \"zod\";\nimport { metaSchema } from \"./meta.js\";\nimport { participantsSchema } from \"./participants.js\";\nimport { pacingSchema } from \"./pacing.js\";\nimport { timelineSchema } from \"./timeline.js\";\n\n/**\n * The config schema version. Distinct from the `@typecaast/schema` package\n * version (related but versioned independently — see PLAN §22). A config newer\n * than the installed runtime fails parsing with a clear error.\n */\nexport const CONFIG_VERSION = 1;\n\n/** The complete Typecaast config: the single source of truth for a simulation. */\nexport const configSchema = z.object({\n version: z.literal(CONFIG_VERSION),\n meta: metaSchema,\n participants: participantsSchema,\n /** Optional; omitted pacing resolves to the full default model. */\n pacing: pacingSchema.default(() => pacingSchema.parse({})),\n timeline: timelineSchema,\n});\n\n/** A parsed config (defaults applied). */\nexport type Config = z.infer<typeof configSchema>;\n/** A config as authored (fields with defaults are optional). */\nexport type ConfigInput = z.input<typeof configSchema>;\n\n/**\n * Generate the JSON Schema for a Typecaast config (for editor autocomplete and\n * `$schema` references). Lazy so importing the package never eagerly runs the\n * conversion. Refinements (e.g. the lenient content-node guard) are not\n * representable in JSON Schema and are dropped.\n */\nexport function configJsonSchema(): Record<string, unknown> {\n return z.toJSONSchema(configSchema, {\n unrepresentable: \"any\",\n target: \"draft-7\",\n }) as Record<string, unknown>;\n}\n","import { CONFIG_VERSION, configSchema } from \"./config.js\";\n\n/** Diagnostic severity tiers (PLAN §23). */\nexport type Severity = \"error\" | \"warning\" | \"info\";\n\n/**\n * A single validation finding. Every diagnostic carries a stable `code`, the\n * offending `location` (step/message/path), and a `hint` for remediation.\n */\nexport interface Diagnostic {\n code: string;\n severity: Severity;\n message: string;\n /** Dotted/indexed path, e.g. `timeline[3].from` or `meta.canvas.width`. */\n location?: string;\n hint?: string;\n}\n\nfunction formatPath(path: ReadonlyArray<PropertyKey>): string {\n let out = \"\";\n for (const key of path) {\n if (typeof key === \"number\") out += `[${key}]`;\n else if (out === \"\") out += String(key);\n else out += `.${String(key)}`;\n }\n return out;\n}\n\n/** Read an optional `from`/`by`/`target` field off any step shape. */\nfunction field(step: unknown, key: string): string | undefined {\n const value = (step as Record<string, unknown>)[key];\n return typeof value === \"string\" ? value : undefined;\n}\n\n/**\n * Validate a parsed config value (already JSON-decoded). Returns all\n * diagnostics — schema errors, then semantic checks (reference integrity,\n * target resolution). Reusable by the CLI and the builder's lint panel.\n *\n * A version newer than the runtime short-circuits with a single hard error.\n */\nexport function validateConfig(raw: unknown): Diagnostic[] {\n const diagnostics: Diagnostic[] = [];\n\n if (raw && typeof raw === \"object\" && \"version\" in raw) {\n const version = (raw as { version: unknown }).version;\n if (typeof version === \"number\" && version > CONFIG_VERSION) {\n return [\n {\n code: \"E_VERSION\",\n severity: \"error\",\n message: `Config version ${version} is newer than this runtime supports (max ${CONFIG_VERSION}).`,\n location: \"version\",\n hint: \"Upgrade Typecaast (e.g. `npm i @typecaast/cli@latest`).\",\n },\n ];\n }\n }\n\n const result = configSchema.safeParse(raw);\n if (!result.success) {\n for (const issue of result.error.issues) {\n diagnostics.push({\n code: \"E_SCHEMA\",\n severity: \"error\",\n message: issue.message,\n location: formatPath(issue.path) || undefined,\n });\n }\n return diagnostics;\n }\n\n const config = result.data;\n\n // Duplicate participant ids.\n const ids = config.participants.map((p) => p.id);\n const idSet = new Set(ids);\n for (const dup of new Set(ids.filter((id, i) => ids.indexOf(id) !== i))) {\n diagnostics.push({\n code: \"E_DUP_PARTICIPANT\",\n severity: \"error\",\n message: `Duplicate participant id \"${dup}\".`,\n location: \"participants\",\n hint: \"Participant ids must be unique.\",\n });\n }\n\n const hasSelf = config.participants.some((p) => p.isSelf);\n let warnedNoSelf = false;\n const messageIds = new Set<string>();\n let priorMessages = 0;\n\n config.timeline.forEach((step, i) => {\n const loc = `timeline[${i}]`;\n\n const from = field(step, \"from\");\n if (from !== undefined && !idSet.has(from)) {\n diagnostics.push({\n code: \"E_REF_PARTICIPANT\",\n severity: \"error\",\n message: `Step references unknown participant \"${from}\".`,\n location: `${loc}.from`,\n hint: `Add a participant with id \"${from}\" or fix the reference.`,\n });\n }\n\n if (step.type === \"readReceipt\") {\n const by = field(step, \"by\");\n if (by !== undefined && !idSet.has(by)) {\n diagnostics.push({\n code: \"E_REF_PARTICIPANT\",\n severity: \"error\",\n message: `Read receipt references unknown participant \"${by}\".`,\n location: `${loc}.by`,\n hint: `Add a participant with id \"${by}\" or fix the reference.`,\n });\n }\n }\n\n if (\n (step.type === \"composerType\" || step.type === \"send\") &&\n !hasSelf &&\n !warnedNoSelf\n ) {\n warnedNoSelf = true;\n diagnostics.push({\n code: \"W_NO_SELF\",\n severity: \"warning\",\n message: \"The composer is used but no participant is marked as self.\",\n location: loc,\n hint: 'Mark a participant with `\"isSelf\": true`.',\n });\n }\n\n if (\n (step.type === \"message\" || step.type === \"system\") &&\n typeof step.id === \"string\"\n ) {\n messageIds.add(step.id);\n }\n\n if (\n step.type === \"reaction\" ||\n step.type === \"edit\" ||\n step.type === \"delete\"\n ) {\n const target = step.target;\n // Blank/`$prev` both mean \"the most-recent message\".\n if (!target || target === \"$prev\") {\n if (priorMessages === 0) {\n diagnostics.push({\n code: \"W_NO_PREV\",\n severity: \"warning\",\n message: \"Default target has no preceding message.\",\n location: `${loc}.target`,\n hint: \"Place this after a message, or set a target message id.\",\n });\n }\n } else if (!messageIds.has(target)) {\n diagnostics.push({\n code: \"W_TARGET\",\n severity: \"warning\",\n message: `Target \"${target}\" matches no preceding message id.`,\n location: `${loc}.target`,\n hint: 'Give the target message an `\"id\"`, or check the reference.',\n });\n }\n }\n\n if (step.type === \"message\" || step.type === \"system\") priorMessages++;\n });\n\n return diagnostics;\n}\n"]}
|
package/package.json
CHANGED
package/typecaast.schema.json
CHANGED
|
@@ -1459,6 +1459,26 @@
|
|
|
1459
1459
|
],
|
|
1460
1460
|
"additionalProperties": false
|
|
1461
1461
|
},
|
|
1462
|
+
{
|
|
1463
|
+
"type": "object",
|
|
1464
|
+
"properties": {
|
|
1465
|
+
"type": {
|
|
1466
|
+
"type": "string",
|
|
1467
|
+
"const": "codeblock"
|
|
1468
|
+
},
|
|
1469
|
+
"text": {
|
|
1470
|
+
"type": "string"
|
|
1471
|
+
},
|
|
1472
|
+
"lang": {
|
|
1473
|
+
"type": "string"
|
|
1474
|
+
}
|
|
1475
|
+
},
|
|
1476
|
+
"required": [
|
|
1477
|
+
"type",
|
|
1478
|
+
"text"
|
|
1479
|
+
],
|
|
1480
|
+
"additionalProperties": false
|
|
1481
|
+
},
|
|
1462
1482
|
{
|
|
1463
1483
|
"type": "object",
|
|
1464
1484
|
"properties": {
|