Clone any viral video with AI agents. Not just a script, the whole workflow: swap the face, the words, the B-roll, ship 100 variants in one command, and get your 100M views.
TypeScript agentic-aiaiai-agentsai-videocompilerdslffmpeggenerative-aillmmarkup-languagemonorepoplugin-systemprogramming-languagetext-to-videotypescriptvideovideo-automationvideo-clonevideo-editingvideo-generation
feat: preview B-roll and speaker footage from picked media
rponeacec2d84f36e
diff --git a/test/playground-discover.test.ts b/test/playground-discover.test.tsindex 4542c6ba..913c2c21 100644--- a/test/playground-discover.test.ts+++ b/test/playground-discover.test.ts@@ -24,6 +24,7 @@ test("a stylesheet is read as a list of things to preview", () => {assert.deepEqual(found.subjects.map((subject) => [subject.path, subject.component.id]),[+ ["broll.product", "broll"],["caption.dialogue", "caption"],["caption.alice", "caption"],["caption.bob", "caption"],@@ -31,11 +32,15 @@ test("a stylesheet is read as a list of things to preview", () => {],);- // Reported rather than dropped. These are real Recipes with no preview yet,- // and naming them is the difference between a gap and a silent omission.+ // Reported rather than dropped. These are real Recipes with no preview, and+ // naming them is the difference between a gap and a silent omission.+ //+ // speech.full is here for a reason worth knowing: no Surface in the compiler+ // reads it. projectSpeechVisual takes no appearance at all, so the Recipe is+ // declared and unused, and the playground cannot honour what nothing honours.assert.deepEqual(found.unmatched.map((entry) => entry.path),- ["font.inter-semibold", "font.inter-black", "speech.full", "broll.product", "caption.short-cues"],+ ["font.inter-semibold", "font.inter-black", "speech.full", "caption.short-cues"],);});diff --git a/test/playground-preview.test.ts b/test/playground-preview.test.tsindex 85803702..4e55d652 100644--- a/test/playground-preview.test.ts+++ b/test/playground-preview.test.ts@@ -6,6 +6,7 @@ import { sealComposition } from "@narratage/composition";import { sealProgramSpace } from "@narratage/program-space";import { REGISTRY, matchRecipe } from "../tools/playground/src/registry/index.js";+import { registerArtifact } from "../tools/playground/src/preview/artifacts.js";/*** Every adapter, through the whole compiler path it will run in the browser.@@ -23,10 +24,41 @@ const programSpace = sealProgramSpace({});const canvas = { width: 1080, height: 1920, clearColor: "#09090b" };+/** A named Artifact with no bytes — enough to build with, not to draw. */+const VIDEO = registerArtifact({+ digest: `sha256:${"a1".repeat(32)}`,+ size: 1024,+ mediaType: "video/mp4",+ durationSec: 4,+} as Parameters<typeof registerArtifact>[0]);++/**+ * Fills in whatever media a component needs.+ *+ * Components that draw supplied footage contribute nothing until they have+ * some — an empty picker is not an error — so their defaults have to be+ * completed before there is a document to judge.+ */+function withMedia(content: unknown): unknown {+ const bag = structuredClone(content) as Record<string, unknown>;+ for (const value of Object.values(bag)) {+ if (!Array.isArray(value)) continue;+ for (const entry of value as Record<string, unknown>[]) {+ if ("media" in entry) entry["media"] = VIDEO.digest;+ }+ }+ return bag;+}+for (const component of REGISTRY) {test(`${component.id} compiles its defaults into a legal document`, () => {const { parameters, content } = component.defaults();- const tracks = component.build({ parameters, content, programSpace, canvas });+ const tracks = component.build({+ parameters,+ content: withMedia(content) as typeof content,+ programSpace,+ canvas,+ });assert.ok(tracks.length > 0, "an adapter must contribute at least one Track");const document = compileHyperframesDocument(sealComposition({contract: "svml.composition@1",@@ -52,10 +84,21 @@ for (const component of REGISTRY) {contract: "svml.composition@1",id: component.id,canvas,- tracks: component.build({ parameters, content, programSpace: short, canvas }),+ tracks: component.build({+ parameters,+ content: withMedia(content) as typeof content,+ programSpace: short,+ canvas,+ }),}), short);});});++ test(`${component.id} draws nothing rather than failing before its media arrives`, () => {+ // An empty picker is a state to pass through, not an error to report.+ const { parameters, content } = component.defaults();+ assert.doesNotThrow(() => component.build({ parameters, content, programSpace, canvas }));+ });}test("a Recipe is matched by its exact property key set, not its path prefix", () => {diff --git a/tools/playground-registry.test.mjs b/tools/playground-registry.test.mjsindex 516e0fac..2029d179 100644--- a/tools/playground-registry.test.mjs+++ b/tools/playground-registry.test.mjs@@ -22,6 +22,7 @@ import { REGISTRY } from "./playground/src/registry/index.ts";const SURFACES = {caption: "../packages/caption/src/surface.ts","text-track": "../packages/text-track/src/surface.ts",+ broll: "../packages/broll/src/surface.ts",};/** Pulls the `expected` array literal a Surface compares Recipe keys against. */diff --git a/tools/playground/src/preview/artifacts.ts b/tools/playground/src/preview/artifacts.tsnew file mode 100644index 00000000..d674c8ff--- /dev/null+++ b/tools/playground/src/preview/artifacts.ts@@ -0,0 +1,85 @@+import type { MediaArtifactRef } from "../svml.js";++/**+ * Media the playground has been given, addressed the way the Runtime addresses+ * it.+ *+ * `assertHyperframesDocument` cross-checks every `svml-artifact://` placeholder+ * against the document's declared Artifacts and runs `isDigest` on each, so a+ * stub digest would be rejected. These are real SHA-256 digests of the actual+ * bytes, computed with Web Crypto — which is asynchronous, hence registering a+ * file is too.+ */++const refs = new Map<string, MediaArtifactRef>();+const urls = new Map<string, string>();++function hex(buffer: ArrayBuffer): string {+ return [...new Uint8Array(buffer)].map((byte) => byte.toString(16).padStart(2, "0")).join("");+}++/** Reads a media file's own duration, which MediaArtifactRef requires. */+async function durationOf(file: File, url: string): Promise<number> {+ if (file.type.startsWith("image/")) return 0;+ const kind = file.type.startsWith("audio/") ? "audio" : "video";+ return await new Promise<number>((resolve) => {+ const probe = document.createElement(kind);+ probe.preload = "metadata";+ const done = (value: number): void => { probe.removeAttribute("src"); resolve(value); };+ probe.addEventListener("loadedmetadata", () => {+ done(Number.isFinite(probe.duration) ? probe.duration : 0);+ }, { once: true });+ // A file the browser cannot decode still has to produce a legal Artifact,+ // so the preview can show the failure rather than refusing to build.+ probe.addEventListener("error", () => done(0), { once: true });+ probe.src = url;+ });+}++/**+ * Records an Artifact the playground can name but has no bytes for.+ *+ * A component only needs the reference to build a legal Composition; the bytes+ * are needed to draw it. Keeping the two separable is what lets an adapter be+ * exercised outside a browser, and it is also the honest model for a digest+ * that arrives from somewhere other than a file picker.+ */+export function registerArtifact(ref: MediaArtifactRef, objectUrl?: string): MediaArtifactRef {+ refs.set(ref.digest, ref);+ if (objectUrl !== undefined) urls.set(ref.digest, objectUrl);+ return ref;+}++export async function registerFile(file: File): Promise<MediaArtifactRef> {+ const bytes = await file.arrayBuffer();+ const digest = `sha256:${hex(await crypto.subtle.digest("SHA-256", bytes))}`;+ const existing = refs.get(digest);+ if (existing !== undefined) return existing;++ const mediaType = file.type || "application/octet-stream";+ const url = URL.createObjectURL(new Blob([bytes], { type: mediaType }));+ return registerArtifact({+ digest,+ size: bytes.byteLength,+ mediaType,+ durationSec: await durationOf(file, url),+ } as MediaArtifactRef, url);+}++export function artifactRef(digest: string | undefined): MediaArtifactRef | undefined {+ return digest === undefined ? undefined : refs.get(digest);+}++export function artifactUrl(digest: string): string | undefined {+ return urls.get(digest);+}++export function artifactLabel(digest: string | undefined): string {+ if (digest === undefined) return "no media";+ const ref = refs.get(digest);+ if (ref === undefined) return `${digest.slice(0, 15)}… (missing)`;+ const size = ref.size < 1024 * 1024+ ? `${Math.round(ref.size / 1024)} KB`+ : `${(ref.size / 1024 / 1024).toFixed(1)} MB`;+ return `${ref.mediaType} · ${size}`;+}diff --git a/tools/playground/src/preview/render.ts b/tools/playground/src/preview/render.tsindex d042f0de..d75ae4d3 100644--- a/tools/playground/src/preview/render.ts+++ b/tools/playground/src/preview/render.ts@@ -5,6 +5,7 @@ import {sealComposition,} from "../svml.js";import type { Composition, ProgramSpace, Track } from "../svml.js";+import { artifactUrl } from "./artifacts.js";import { injectRuntimeShim } from "./runtime-shim.js";/** A grey card standing in for an Artifact the playground has not been given. */@@ -20,8 +21,6 @@ export type PreviewInput = {readonly canvas: Composition["canvas"];readonly programSpace: ProgramSpace;readonly tracks: readonly Track[];- /** Digest to object URL. A miss is a warning, never a failed preview. */- readonly resolveArtifact?: (digest: string) => string | undefined;};export type PreviewOutput = {@@ -51,9 +50,11 @@ export function renderPreview(input: PreviewInput): PreviewOutput {const warnings: string[] = [];const html = materializeHyperframesHtml(document, (artifact) => {- const resolved = input.resolveArtifact?.(artifact.digest);+ const resolved = artifactUrl(artifact.digest);if (resolved !== undefined) return resolved;- warnings.push(`No media set for ${artifact.digest.slice(0, 19)}…`);+ // A missing Artifact must not blank the frame: a playground where one+ // unset image hides everything else teaches nothing.+ warnings.push(`No media registered for ${artifact.digest.slice(0, 19)}…`);return MISSING_MEDIA;});diff --git a/tools/playground/src/registry/broll.ts b/tools/playground/src/registry/broll.tsnew file mode 100644index 00000000..6b229ac6--- /dev/null+++ b/tools/playground/src/registry/broll.ts@@ -0,0 +1,172 @@+import { artifactRef } from "../preview/artifacts.js";+import { compileBrollProduct, programSpaceFrameCount, sealBrollProgram } from "../svml.js";+import type { BrollItem, BrollMotion, CanonicalValue } from "../svml.js";+import { fields, list, number, text } from "./types.js";+import type { PreviewComponent } from "./types.js";++/**+ * The B-roll Recipe key set, copied from packages/broll/src/surface.ts.+ * tools/playground-registry.test.mjs fails if the two ever diverge.+ */+const RECIPE_KEYS = [+ "background", "enter", "exit", "fit", "height",+ "radius", "stack-order", "width", "x", "y",+] as const;++const OPERATORS = ["fade", "pop", "slide-up", "slide-down"] as const;++function numeric(properties: Readonly<Record<string, CanonicalValue>>, key: string): number {+ const value = Number(properties[key]);+ return Number.isFinite(value) ? value : 0;+}++/** SVS writes motion as `<operator> <frames>f`, e.g. `slide-up 8f`. */+function parseMotion(value: CanonicalValue | undefined): { operator: string; frames: number } {+ const found = /^(fade|pop|slide-up|slide-down)\s+([1-9][0-9]*)f$/u.exec(String(value ?? "").trim());+ return found === null+ ? { operator: "fade", frames: 6 }+ : { operator: found[1]!, frames: Number(found[2]) };+}++function motion(operator: string, frames: number): BrollMotion | undefined {+ if (frames <= 0) return undefined;+ return { operator: operator as BrollMotion["operator"], durationFrames: frames };+}++export const brollComponent: PreviewComponent = {+ id: "broll",+ label: "B-roll",+ recipeKeys: RECIPE_KEYS,++ parameters: {+ kind: "object",+ fields: {+ stackOrder: { schema: { kind: "number", integer: true, minimum: 0 } },+ x: { schema: { kind: "number", minimum: 0, maximum: 1 } },+ y: { schema: { kind: "number", minimum: 0, maximum: 1 } },+ width: { schema: { kind: "number", minimum: 0, maximum: 1 } },+ height: { schema: { kind: "number", minimum: 0, maximum: 1 } },+ fit: { schema: { kind: "string", enum: ["contain", "cover"] } },+ background: { schema: { kind: "string" } },+ radius: { schema: { kind: "number", minimum: 0 } },+ enterOperator: { schema: { kind: "string", enum: [...OPERATORS] } },+ enterFrames: { schema: { kind: "number", integer: true, minimum: 0 } },+ exitOperator: { schema: { kind: "string", enum: [...OPERATORS] } },+ exitFrames: { schema: { kind: "number", integer: true, minimum: 0 } },+ },+ },++ content: {+ kind: "object",+ fields: {+ items: {+ schema: {+ kind: "array",+ minItems: 1,+ items: {+ kind: "object",+ fields: {+ media: { schema: { kind: "blob", mediaTypes: ["image/*", "video/*"] } },+ startSec: { schema: { kind: "number", minimum: 0 } },+ endSec: { schema: { kind: "number", minimum: 0 } },+ },+ },+ },+ },+ },+ },++ hints: {+ background: "color",+ x: "unit-fraction",+ y: "unit-fraction",+ width: "unit-fraction",+ height: "unit-fraction",+ },++ defaults: () => ({+ parameters: {+ stackOrder: 40,+ x: 0.08, y: 0.2, width: 0.84, height: 0.48,+ fit: "contain",+ background: "#111116",+ radius: 28,+ enterOperator: "slide-up", enterFrames: 8,+ exitOperator: "fade", exitFrames: 6,+ },+ content: {+ items: [{ media: "", startSec: 0, endSec: 4 }],+ },+ }),++ fromRecipe: (properties) => {+ const enter = parseMotion(properties["enter"]);+ const exit = parseMotion(properties["exit"]);+ return {+ stackOrder: numeric(properties, "stack-order"),+ x: numeric(properties, "x"),+ y: numeric(properties, "y"),+ width: numeric(properties, "width"),+ height: numeric(properties, "height"),+ fit: String(properties["fit"] ?? "contain"),+ background: String(properties["background"] ?? "#00000000"),+ radius: numeric(properties, "radius"),+ enterOperator: enter.operator, enterFrames: enter.frames,+ exitOperator: exit.operator, exitFrames: exit.frames,+ };+ },++ build: ({ parameters, content, programSpace }) => {+ const p = fields(parameters);+ const totalFrames = programSpaceFrameCount(programSpace);+ const fps = programSpace.frameRate.numerator / programSpace.frameRate.denominator;+ const enter = motion(text(p["enterOperator"], "enterOperator"), number(p["enterFrames"], "enterFrames"));+ const exit = motion(text(p["exitOperator"], "exitOperator"), number(p["exitFrames"], "exitFrames"));++ const items: BrollItem[] = list(fields(content)["items"], "items").flatMap((entry, index) => {+ const item = fields(entry);+ const digest = item["media"];+ const artifact = artifactRef(typeof digest === "string" && digest !== "" ? digest : undefined);+ // An Item with no media yet is skipped rather than faked: compileBroll+ // would reject a stub digest, and a stand-in would misreport the frame.+ if (artifact === undefined) return [];+ const startFrame = Math.max(0, Math.min(totalFrames - 1, Math.round(number(item["startSec"], "startSec") * fps)));+ const endFrameExclusive = Math.max(+ startFrame + 1,+ Math.min(totalFrames, Math.round(number(item["endSec"], "endSec") * fps)),+ );+ const span = endFrameExclusive - startFrame;+ return [{+ id: `item-${index + 1}`,+ artifact,+ span: { startFrame, endFrameExclusive },+ z: number(p["stackOrder"], "stackOrder"),+ tieBreak: `broll:${index + 1}`,+ box: {+ xPercent: number(p["x"], "x") * 100,+ yPercent: number(p["y"], "y") * 100,+ widthPercent: number(p["width"], "width") * 100,+ heightPercent: number(p["height"], "height") * 100,+ },+ fit: text(p["fit"], "fit") as "contain" | "cover",+ // Not a choice: B-roll requires freeze for a still and forbids it for a+ // moving one, so the media decides and a control would only offer a way+ // to be wrong.+ playback: artifact.mediaType.startsWith("image/") ? "freeze" : "native",+ backgroundColor: text(p["background"], "background"),+ borderRadiusPx: number(p["radius"], "radius"),+ // Motion must fit inside the Present it decorates.+ ...(enter !== undefined && enter.durationFrames < span ? { enter } : {}),+ ...(exit !== undefined && exit.durationFrames < span ? { exit } : {}),+ }];+ });++ if (items.length === 0) return [];+ return [compileBrollProduct(programSpace, sealBrollProgram({+ contract: "svml.broll-program@1",+ id: "broll",+ items,+ transitions: [],+ })).visualTrack];+ },+};diff --git a/tools/playground/src/registry/index.ts b/tools/playground/src/registry/index.tsindex ef72c12d..4606bb89 100644--- a/tools/playground/src/registry/index.ts+++ b/tools/playground/src/registry/index.ts@@ -1,13 +1,18 @@import type { CanonicalValue } from "../svml.js";+import { brollComponent } from "./broll.js";import { captionComponent } from "./caption.js";+import { speechComponent } from "./speech.js";import { textTrackComponent } from "./text-track.js";import type { PreviewComponent } from "./types.js";export type { BuildInput, FieldHint, PreviewComponent } from "./types.js";+/** Every component that puts pixels on the frame. */export const REGISTRY: readonly PreviewComponent[] = [captionComponent,textTrackComponent,+ brollComponent,+ speechComponent,];export function componentById(id: string): PreviewComponent | undefined {diff --git a/tools/playground/src/registry/speech.ts b/tools/playground/src/registry/speech.tsnew file mode 100644index 00000000..dcc072ac--- /dev/null+++ b/tools/playground/src/registry/speech.ts@@ -0,0 +1,89 @@+import { artifactRef } from "../preview/artifacts.js";+import { projectSpeechVisual } from "../svml.js";+import type { MediaArtifactRef, SpeechBasis } from "../svml.js";+import { fields, list, number } from "./types.js";+import type { PreviewComponent } from "./types.js";++/**+ * The speaker's own footage, full bleed.+ *+ * `projectSpeechVisual` takes no appearance at all — it always emits a+ * full-frame `object-fit: cover` element at stacking order 0. So this component+ * has clips and nothing else, which is the honest shape: `speech.full` exists in+ * the golden stylesheet but no Surface reads it, and inventing knobs here would+ * imply a control the compiler does not have.+ */+export const speechComponent: PreviewComponent = {+ id: "speech",+ label: "Speaker footage",++ parameters: { kind: "object", fields: {} },++ content: {+ kind: "object",+ fields: {+ clips: {+ schema: {+ kind: "array",+ minItems: 1,+ items: {+ kind: "object",+ fields: {+ media: { schema: { kind: "blob", mediaTypes: ["image/*", "video/*"] } },+ startSec: { schema: { kind: "number", minimum: 0 } },+ endSec: { schema: { kind: "number", minimum: 0 } },+ },+ },+ },+ },+ },+ },++ defaults: () => ({+ parameters: {},+ content: { clips: [{ media: "", startSec: 0, endSec: 4 }] },+ }),++ build: ({ content, programSpace }) => {+ type Clip = SpeechBasis["visualTrack"]["clips"][number];+ const clips: Clip[] = list(fields(content)["clips"], "clips").flatMap((entry, index): Clip[] => {+ const clip = fields(entry);+ const digest = clip["media"];+ const artifact = artifactRef(typeof digest === "string" && digest !== "" ? digest : undefined);+ // A clip with no media yet contributes nothing rather than a stub digest,+ // which projectSpeechVisual would reject.+ if (artifact === undefined) return [];+ const startSec = number(clip["startSec"], "startSec");+ const endSec = Math.min(+ programSpace.durationSec,+ Math.max(startSec + 1 / 30, number(clip["endSec"], "endSec")),+ );+ // Indexed by position, not by how many survived: two clips must never+ // share a segment id, or their Presents collide.+ return [{ segmentId: `segment-${index + 1}`, artifact, startSec, endSec }];+ });+ if (clips.length === 0) return [];++ // assertSpeechBasisIdentity requires an audio Artifact whose duration equals+ // the ProgramSpace's. projectSpeechVisual never reads it — only the visual+ // clips and the segments — so the first clip's own digest stands in at the+ // program's duration rather than a fabricated one.+ const audio: MediaArtifactRef = {+ ...clips[0]!.artifact,+ durationSec: programSpace.durationSec,+ };++ const basis: SpeechBasis = {+ contract: "svml.speech-basis@1",+ programSpace,+ audio,+ visualTrack: { clips },+ segments: clips.map((clip) => ({+ segmentId: clip.segmentId,+ startSec: clip.startSec,+ endSec: clip.endSec,+ })),+ };+ return [projectSpeechVisual(basis)];+ },+};diff --git a/tools/playground/src/svml.ts b/tools/playground/src/svml.tsindex a13c06e6..17e08e05 100644--- a/tools/playground/src/svml.ts+++ b/tools/playground/src/svml.ts@@ -59,3 +59,11 @@ export type { ParsedSvsSheet, SvsRecipe } from "@narratage/svs";export { maskSourceHeader, parseSourceHeader } from "@narratage/source";export type { SourceHeader } from "@narratage/source";++export type { MediaArtifactRef } from "@narratage/media";++export { compileBrollProduct, sealBrollProgram } from "@narratage/broll";+export type { BrollItem, BrollMotion, BrollProgram } from "@narratage/broll";++export { projectSpeechVisual } from "@narratage/speech-basis";+export type { SpeechBasis } from "@narratage/speech";diff --git a/tools/playground/src/ui/form.ts b/tools/playground/src/ui/form.tsindex 1201fdb5..31a28f75 100644--- a/tools/playground/src/ui/form.ts+++ b/tools/playground/src/ui/form.ts@@ -1,3 +1,4 @@+import { artifactLabel, registerFile } from "../preview/artifacts.js";import type { CanonicalValue, ValueSchema } from "../svml.js";import type { FieldHint } from "../registry/index.js";@@ -14,6 +15,12 @@ export const FORM_CSS = `.form-control input[type=range] { flex: 1; min-width: 0; accent-color: var(--accent); }.form-control input[type=color] { width: 28px; height: 24px; padding: 0; border: 1px solid var(--line); background: none; border-radius: 4px; }.form-control .narrow { flex: 0 0 68px; }+.form-control .form-file { flex: 0 0 auto; font-size: 11px; color: var(--muted); max-width: 130px; }+.form-control .form-file::file-selector-button {+ border: 1px solid var(--line); border-radius: 5px; background: #1c1c21;+ color: var(--text); font: inherit; font-size: 11px; padding: 2px 7px; margin-right: 6px; cursor: pointer;+}+.form-control .form-file-label { font-size: 11px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }.form-group { border: 1px solid var(--line); border-radius: 6px; padding: 8px 10px; margin: 5px 0; }.form-group > legend { color: var(--accent); font-size: 11px; letter-spacing: .04em; text-transform: uppercase; padding: 0 5px; }.form-item { border-top: 1px dashed var(--line); padding-top: 7px; margin-top: 7px; }@@ -200,11 +207,49 @@ function scalarControl(return input;}+ if (schema.kind === "blob") return blobControl(current, schema.mediaTypes, onChange);+const unsupported = document.createElement("span");unsupported.textContent = `(${schema.kind})`;return unsupported;}+/**+ * Media picker.+ *+ * The form value is the digest, and the bytes stay in the Artifact registry, so+ * a component's parameters remain a plain canonical value that a test can build+ * without a browser.+ */+function blobControl(+ current: CanonicalValue | undefined,+ mediaTypes: readonly string[] | undefined,+ onChange: (next: CanonicalValue) => void,+): HTMLElement {+ const holder = document.createElement("div");+ holder.className = "form-control";+ const picker = document.createElement("input");+ picker.type = "file";+ picker.className = "form-file";+ if (mediaTypes !== undefined) picker.accept = mediaTypes.join(",");+ const label = document.createElement("span");+ label.className = "form-file-label";+ label.textContent = artifactLabel(typeof current === "string" && current !== "" ? current : undefined);+ picker.addEventListener("change", () => {+ const file = picker.files?.[0];+ if (file === undefined) return;+ label.textContent = "hashing…";+ void registerFile(file).then((ref) => {+ label.textContent = artifactLabel(ref.digest);+ onChange(ref.digest);+ }).catch((error: unknown) => {+ label.textContent = error instanceof Error ? error.message : String(error);+ });+ });+ holder.append(picker, label);+ return holder;+}+function blank(schema: ValueSchema): CanonicalValue {if (schema.kind === "object") {return Object.fromEntries(Object.entries(schema.fields)