Skip to content

armgit / hypit

Public Imported from GitHub
0

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.

feat: replace playgrounds with Hypit Studio

kashorin8e12e95c4848
diff --git a/package.json b/package.json
index 1b3b0264..557a16ab 100644
--- a/package.json
+++ b/package.json
@@ -20,8 +20,7 @@
"test:image-opencv": "HYPIT_OPENCV_TESTS=1 HYPIT_OPENCV_PYTHON=services/image-opencv/.venv/bin/python node --import tsx --test packages/provider-image-opencv-local/test/provider.test.ts",
"smoke:kie": "node --import tsx packages/provider-kie/test/live-smoke.ts",
"hypit": "node bin/hypit.mjs",
- "caption:playground": "pnpm --filter @hypit/caption-playground exec node --import tsx start.ts",
- "svml:playground": "pnpm --filter @hypit/svml-playground exec node --import tsx start.ts",
+ "studio": "pnpm --filter @hypit/studio exec node --import tsx start.ts",
"build:media-lambda": "pnpm --filter @hypit/media-lambda build",
"build:media-lambda-layer": "pnpm --filter @hypit/media-lambda build:layer"
},
diff --git a/packages/caption-playground/index.html b/packages/caption-playground/index.html
deleted file mode 100644
index 5a51e5ec..00000000
--- a/packages/caption-playground/index.html
+++ /dev/null
@@ -1,10 +0,0 @@
-<!doctype html>
-<html lang="en">
- <head>
- <meta charset="utf-8" />
- <meta name="viewport" content="width=device-width,initial-scale=1" />
- <link rel="icon" href="data:," />
- <title>Caption Playground · Hypit</title>
- </head>
- <body><div id="app"></div><script type="module" src="/src/main.ts"></script></body>
-</html>
diff --git a/packages/caption-playground/package.json b/packages/caption-playground/package.json
deleted file mode 100644
index 03ae1014..00000000
--- a/packages/caption-playground/package.json
+++ /dev/null
@@ -1,21 +0,0 @@
-{
- "name": "@hypit/caption-playground",
- "version": "0.0.0-dev",
- "private": true,
- "type": "module",
- "dependencies": {
- "@hypit/caption": "workspace:*",
- "@hypit/caption-fine": "workspace:*",
- "@hypit/composition": "workspace:*",
- "@hypit/fonts-open": "workspace:*",
- "@hypit/workspace": "workspace:*",
- "@hypit/hyperframes": "workspace:*",
- "@hypit/narrative": "workspace:*",
- "@hypit/package-loader-node": "workspace:*",
- "@hypit/program-space": "workspace:*",
- "@hypit/protocol": "workspace:*",
- "@hypit/svs": "workspace:*",
- "@hypit/video-cli": "workspace:*",
- "vite": "5.4.21"
- }
-}
diff --git a/packages/caption-playground/src/main.ts b/packages/caption-playground/src/main.ts
deleted file mode 100644
index f5182206..00000000
--- a/packages/caption-playground/src/main.ts
+++ /dev/null
@@ -1,324 +0,0 @@
-import type { CaptionProgram, TimedCaptionProjection } from "@hypit/caption";
-import { resolveCaptionProgram } from "@hypit/caption";
-import { renderFineCaption } from "@hypit/caption-fine";
-import type { CaptionDisplayAtom, CaptionDisplaySequence } from "@hypit/narrative";
-import type { CanonicalValue, ValueSchema } from "@hypit/protocol";
-import { sealProgramSpace } from "@hypit/program-space";
-
-import type {
- CaptionPlaygroundFailure,
- CaptionPlaygroundFont,
- CaptionPlaygroundSnapshot,
- FontPatch,
- RecipePatch,
-} from "./shared.js";
-import { renderPreview } from "./preview/render.js";
-import { createStage } from "./ui/stage.js";
-import "./style.css";
-
-const app = document.querySelector<HTMLElement>("#app")!;
-app.innerHTML = `
- <header class="topbar">
- <div><strong>Caption Playground</strong><span>real SVML · real SVS · exact fonts</span></div>
- <div class="status" data-status>Compiling…</div>
- </header>
- <main><div data-stage></div><aside data-controls></aside></main>`;
-const stage = createStage();
-app.querySelector<HTMLElement>("[data-stage]")!.append(stage.element);
-const controls = app.querySelector<HTMLElement>("[data-controls]")!;
-const status = app.querySelector<HTMLElement>("[data-status]")!;
-
-let snapshot: CaptionPlaygroundSnapshot | undefined;
-let requestInFlight = false;
-const loadedFontCss = new Set<string>();
-
-function cueProjection(display: CaptionDisplaySequence, program: CaptionProgram, fps: number): TimedCaptionProjection {
- const atomByWord = new Map(display.atoms.flatMap((atom) => atom.wordIds.map((wordId) => [wordId, atom] as const)));
- const cues: TimedCaptionProjection["cues"][number][] = [];
- let cursor = 0;
- for (const run of program.runs) {
- const style = program.styles.find((item) => item.id === run.styleId)!;
- const atoms: CaptionDisplayAtom[] = [];
- for (const wordId of run.wordIds) {
- const atom = atomByWord.get(wordId)!;
- if (atoms.at(-1)?.id !== atom.id) atoms.push(atom);
- }
- const groups: CaptionDisplayAtom[][] = [];
- for (const atom of atoms) {
- const group = groups.at(-1);
- const count = group?.reduce((sum, item) => sum + item.wordIds.length, 0) ?? 0;
- if (group === undefined || (count > 0 && count + atom.wordIds.length > style.planning.cue.maximumWords)) {
- groups.push([atom]);
- } else {
- group.push(atom);
- }
- }
- for (const group of groups) {
- const words = group.reduce((sum, atom) => sum + atom.wordIds.length, 0);
- const duration = Math.max(1, Math.round(words * 0.42 * fps));
- const start = cursor;
- const end = cursor + duration;
- let atomCursor = start;
- let consumedWords = 0;
- const timedAtoms = group.map((atom, index) => {
- consumedWords += atom.wordIds.length;
- const atomEnd = index === group.length - 1
- ? end
- : start + Math.round(duration * consumedWords / words);
- const value = { atomId: atom.id, startFrame: atomCursor, endFrameExclusive: atomEnd };
- atomCursor = atomEnd;
- return value;
- });
- cues.push({
- id: `caption-playground:cue:${cues.length + 1}`,
- styleId: run.styleId,
- startFrame: start,
- endFrameExclusive: end,
- atoms: timedAtoms,
- fields: [],
- });
- cursor = end;
- }
- }
- return { displaySequenceId: display.id, cues };
-}
-
-function showPreview(value: CaptionPlaygroundSnapshot): void {
- const program = resolveCaptionProgram(value.display, "caption-playground", value.style, []);
- const projection = cueProjection(value.display, program, value.preview.fps);
- const frameCount = projection.cues.at(-1)?.endFrameExclusive ?? 1;
- const space = sealProgramSpace({
- durationSec: frameCount / value.preview.fps,
- frameRate: { numerator: value.preview.fps, denominator: 1 },
- });
- stage.show(renderPreview({
- id: "caption-playground",
- canvas: { width: value.preview.width, height: value.preview.height, clearColor: "#121216" },
- programSpace: space,
- tracks: [renderFineCaption(projection, program, value.display, space)],
- }));
-}
-
-function groupFor(name: string): string {
- if (name.startsWith("cue-") || name === "cue-min-words" || name === "cue-max-words") return "Cue planning & motion";
- if (["x", "y", "width", "anchor-x", "anchor-y", "stack-order", "align", "direction"].includes(name)) return "Placement & layout";
- if (["size", "line-height", "letter-spacing", "word-gap", "text-transform"].includes(name)) return "Typography";
- if (name.startsWith("active-box")) return "Active word box";
- if (name.startsWith("active-underline") || name === "underline" || name.startsWith("underline-")) return "Underline";
- if (name.startsWith("active-")) return "Active word paint & response";
- if (name.startsWith("karaoke")) return "Karaoke";
- if (name.startsWith("atom-")) return "Atom reveal & motion";
- if (name.startsWith("loop")) return "Loop motion";
- if (["background", "border-color", "border-width", "padding", "radius"].includes(name)) return "Cue box";
- return "Base glyph paint";
-}
-
-function fieldSchema(schema: ValueSchema, name: string): { readonly schema: ValueSchema; readonly optional: boolean } {
- if (schema.kind !== "object") throw new Error("Fine Caption Recipe schema is not an object");
- const field = schema.fields[name];
- if (field === undefined) throw new Error(`No schema for ${name}`);
- return { schema: field.schema, optional: field.optional === true };
-}
-
-function editor(name: string, value: CanonicalValue | undefined, schema: ValueSchema, optional: boolean): HTMLElement {
- const row = document.createElement("label");
- row.className = "property";
- row.innerHTML = `<span>${name}</span>`;
- const enabled = document.createElement("input");
- enabled.type = "checkbox";
- enabled.className = "property-toggle";
- enabled.checked = value !== undefined;
- if (optional) row.prepend(enabled);
- const control = schema.kind === "string" && schema.enum !== undefined
- ? document.createElement("select")
- : document.createElement("input");
- if (control instanceof HTMLSelectElement && schema.kind === "string") {
- for (const item of schema.enum ?? []) control.add(new Option(item, item));
- control.value = typeof value === "string" ? value : schema.enum?.[0] ?? "";
- } else if (control instanceof HTMLInputElement) {
- control.type = schema.kind === "number" ? "number" : "text";
- if (schema.kind === "number") {
- control.step = schema.integer === true ? "1" : "any";
- if (schema.minimum !== undefined) control.min = String(schema.minimum);
- if (schema.maximum !== undefined) control.max = String(schema.maximum);
- }
- control.value = value === undefined ? "" : String(value);
- }
- control.disabled = optional && value === undefined;
- row.append(control);
- const save = async (): Promise<void> => {
- if (snapshot === undefined || requestInFlight) return;
- const parsed: CanonicalValue = schema.kind === "number" ? Number(control.value) : control.value;
- if (schema.kind === "number" && !Number.isFinite(parsed)) return;
- await patch("/__caption/recipe", {
- name,
- value: parsed,
- } satisfies RecipePatch);
- };
- control.addEventListener("change", () => void save());
- enabled.addEventListener("change", () => {
- if (snapshot === undefined) return;
- control.disabled = !enabled.checked;
- if (!enabled.checked) {
- void patch("/__caption/recipe", {
- name,
- remove: true,
- } satisfies RecipePatch);
- } else {
- if (!control.value) {
- if (schema.kind === "number") control.value = "0";
- else if (schema.kind === "string" && schema.enum !== undefined) control.value = schema.enum[0] ?? "";
- else control.value = "none";
- }
- void save();
- }
- });
- return row;
-}
-
-function loadFontCss(font: CaptionPlaygroundFont): void {
- if (loadedFontCss.has(font.id)) return;
- loadedFontCss.add(font.id);
- const link = document.createElement("link");
- link.rel = "stylesheet";
- link.href = `/__caption/font-css/${font.id}`;
- document.head.append(link);
-}
-
-function fontPanel(value: CaptionPlaygroundSnapshot): HTMLElement {
- const section = document.createElement("section");
- section.className = "font-panel";
- section.innerHTML = `
- <div class="section-heading"><div><h2>Exact font</h2><p>${value.font.file} · ${value.font.id}</p></div></div>
- <div class="font-current"><select data-weight></select><select data-style></select></div>
- <input class="font-search" type="search" placeholder="Search 109 redistributable font families…" />
- <div class="font-grid"></div>`;
- const grid = section.querySelector<HTMLElement>(".font-grid")!;
- const search = section.querySelector<HTMLInputElement>(".font-search")!;
- const weight = section.querySelector<HTMLSelectElement>("[data-weight]")!;
- const style = section.querySelector<HTMLSelectElement>("[data-style]")!;
- const selected = value.fonts.find((font) => font.id === value.font.family);
- for (const item of selected?.weights ?? [value.font.weight]) weight.add(new Option(String(item), String(item)));
- weight.value = String(value.font.weight);
- for (const item of selected?.styles ?? [value.font.style]) style.add(new Option(item, item));
- style.value = value.font.style;
-
- const choose = (family: CaptionPlaygroundFont, selectedWeight = family.previewWeight, selectedStyle = family.previewStyle): void => {
- void patch("/__caption/font", {
- family: family.id,
- weight: selectedWeight,
- style: selectedStyle,
- } satisfies FontPatch);
- };
- weight.addEventListener("change", () => selected && choose(selected, Number(weight.value), style.value as "normal" | "italic"));
- style.addEventListener("change", () => selected && choose(selected, Number(weight.value), style.value as "normal" | "italic"));
-
- const cards = value.fonts.map((font) => {
- const button = document.createElement("button");
- button.type = "button";
- button.className = `font-card${font.id === value.font.family ? " selected" : ""}`;
- button.dataset.search = `${font.label} ${font.id} ${font.category}`.toLowerCase();
- button.innerHTML = `<strong>${font.label}</strong><span>Aa 45% — Caption ✨</span><small>${font.category}</small>`;
- const sample = button.querySelector<HTMLElement>("span")!;
- sample.style.fontFamily = `caption-gallery-${font.id}, sans-serif`;
- sample.style.fontWeight = String(font.previewWeight);
- sample.style.fontStyle = font.previewStyle;
- button.addEventListener("click", () => choose(font));
- grid.append(button);
- return { font, button };
- });
- const observer = new IntersectionObserver((entries) => {
- for (const entry of entries) {
- if (!entry.isIntersecting) continue;
- const found = cards.find((item) => item.button === entry.target);
- if (found !== undefined) loadFontCss(found.font);
- observer.unobserve(entry.target);
- }
- }, { root: grid, rootMargin: "180px" });
- cards.forEach(({ button }) => observer.observe(button));
- search.addEventListener("input", () => {
- const query = search.value.trim().toLowerCase();
- cards.forEach(({ button }) => { button.hidden = query.length > 0 && !button.dataset.search!.includes(query); });
- });
- return section;
-}
-
-function renderControls(value: CaptionPlaygroundSnapshot): void {
- controls.replaceChildren(fontPanel(value));
- const byGroup = new Map<string, string[]>();
- if (value.recipe.schema.kind !== "object") return;
- for (const name of Object.keys(value.recipe.schema.fields)) {
- const group = groupFor(name);
- const values = byGroup.get(group) ?? [];
- values.push(name);
- byGroup.set(group, values);
- }
- for (const [group, names] of byGroup) {
- const details = document.createElement("details");
- details.open = ["Cue planning & motion", "Placement & layout", "Typography", "Base glyph paint", "Cue box"].includes(group);
- const summary = document.createElement("summary");
- summary.textContent = group;
- details.append(summary);
- const body = document.createElement("div");
- body.className = "property-grid";
- for (const name of names) {
- const declared = fieldSchema(value.recipe.schema, name);
- body.append(editor(name, value.recipe.values[name], declared.schema, declared.optional));
- }
- details.append(body);
- controls.append(details);
- }
-}
-
-function applySnapshot(value: CaptionPlaygroundSnapshot): void {
- snapshot = value;
- status.className = "status ok";
- status.textContent = `Watching ${value.recipe.file} · revision ${value.revision}`;
- try { showPreview(value); } catch (error) { stage.showError(error instanceof Error ? error.message : String(error)); }
- renderControls(value);
-}
-
-async function patch(path: string, value: RecipePatch | FontPatch): Promise<void> {
- requestInFlight = true;
- status.className = "status";
- status.textContent = "Writing source…";
- try {
- const response = await fetch(path, {
- method: "PATCH",
- headers: { "content-type": "application/json" },
- body: JSON.stringify(value),
- });
- const result = await response.json() as CaptionPlaygroundSnapshot | { readonly error: string; readonly snapshot?: CaptionPlaygroundSnapshot };
- if (!response.ok) {
- if ("snapshot" in result && result.snapshot !== undefined) applySnapshot(result.snapshot);
- throw new Error("error" in result ? result.error : `HTTP ${response.status}`);
- }
- applySnapshot(result as CaptionPlaygroundSnapshot);
- } catch (error) {
- stage.showError(error instanceof Error ? error.message : String(error));
- status.className = "status error";
- status.textContent = "Source update failed";
- } finally {
- requestInFlight = false;
- }
-}
-
-const response = await fetch("/__caption/session");
-const initial = await response.json() as CaptionPlaygroundSnapshot | CaptionPlaygroundFailure;
-if (response.ok && "style" in initial) applySnapshot(initial);
-else {
- const message = "error" in initial ? initial.error : "Caption compiler failed";
- stage.showError(message);
- status.className = "status error";
- status.textContent = "Compile failed";
-}
-
-type Hot = { on(event: string, listener: (value: unknown) => void): void };
-const hot = (import.meta as ImportMeta & { hot?: Hot }).hot;
-hot?.on("caption:snapshot", (value) => applySnapshot(value as CaptionPlaygroundSnapshot));
-hot?.on("caption:error", (value) => {
- const failure = value as CaptionPlaygroundFailure;
- stage.showError(failure.error);
- status.className = "status error";
- status.textContent = `Compile failed · revision ${failure.revision}`;
-});
diff --git a/packages/caption-playground/src/preview/render.ts b/packages/caption-playground/src/preview/render.ts
deleted file mode 100644
index ef24cb87..00000000
--- a/packages/caption-playground/src/preview/render.ts
+++ /dev/null
@@ -1,36 +0,0 @@
-import {
- compileHyperframesDocument,
- materializeHyperframesHtml,
- programSpaceFrameCount,
- sealComposition,
-} from "../svml.js";
-import type { Composition, ProgramSpace, Track } from "../svml.js";
-import { injectRuntimeShim } from "./runtime-shim.js";
-
-export type PreviewOutput = {
- readonly srcdoc: string;
- readonly frameCount: number;
- readonly fps: number;
- readonly canvas: { readonly width: number; readonly height: number };
-};
-
-export function renderPreview(input: {
- readonly id: string;
- readonly canvas: Composition["canvas"];
- readonly programSpace: ProgramSpace;
- readonly tracks: readonly Track[];
-}): PreviewOutput {
- const document = compileHyperframesDocument(sealComposition({
- id: input.id,
- canvas: input.canvas,
- tracks: input.tracks,
- }), input.programSpace);
- const html = materializeHyperframesHtml(document, (artifact) =>
- `/__caption/artifact/${artifact.digest}`);
- return {
- srcdoc: injectRuntimeShim(html),
- frameCount: programSpaceFrameCount(input.programSpace),
- fps: input.programSpace.frameRate.numerator / input.programSpace.frameRate.denominator,
- canvas: document.canvas,
- };
-}
diff --git a/packages/caption-playground/src/preview/runtime-shim.ts b/packages/caption-playground/src/preview/runtime-shim.ts
deleted file mode 100644
index 130a1e19..00000000
--- a/packages/caption-playground/src/preview/runtime-shim.ts
+++ /dev/null
@@ -1,39 +0,0 @@
-export const RUNTIME_SHIM = String.raw`
-<script>
-(function () {
- var root = document.querySelector('[data-composition-id]');
- var fpsAttr = (root && root.getAttribute('data-fps')) || '30';
- var slash = fpsAttr.indexOf('/');
- var fps = slash === -1 ? parseFloat(fpsAttr) : parseFloat(fpsAttr.slice(0, slash)) / parseFloat(fpsAttr.slice(slash + 1));
- if (root) {
- root.style.width = (root.getAttribute('data-width') || '0') + 'px';
- root.style.height = (root.getAttribute('data-height') || '0') + 'px';
- }
- function seek(seconds) {
- var clips = document.querySelectorAll('.hypit-visual-present');
- for (var i = 0; i < clips.length; i++) {
- var clip = clips[i];
- var start = parseFloat(clip.getAttribute('data-start') || '0') || 0;
- var duration = parseFloat(clip.getAttribute('data-duration') || '0') || 0;
- var local = seconds - start;
- var inside = local >= 0 && local < duration;
- clip.style.visibility = inside ? 'visible' : 'hidden';
- var animations = clip.getAnimations({ subtree: true });
- for (var a = 0; a < animations.length; a++) {
- try {
- animations[a].pause();
- animations[a].currentTime = Math.max(0, Math.min(duration, local)) * 1000;
- } catch (error) { /* animation will be sought again */ }
- }
- }
- }
- window.__svmlSeekFrame = function (frame) { seek(frame / fps); };
- seek(0);
- window.addEventListener('load', function () { seek(0); });
-})();
-</script>`;
-
-export function injectRuntimeShim(html: string): string {
- const at = html.lastIndexOf("</body>");
- return at < 0 ? html + RUNTIME_SHIM : html.slice(0, at) + RUNTIME_SHIM + html.slice(at);
-}
diff --git a/packages/caption-playground/src/server.ts b/packages/caption-playground/src/server.ts
deleted file mode 100644
index f6156c95..00000000
--- a/packages/caption-playground/src/server.ts
+++ /dev/null
@@ -1,407 +0,0 @@
-import { readFileSync } from "node:fs";
-import { readFile, rename, writeFile } from "node:fs/promises";
-import { createRequire } from "node:module";
-import { dirname, relative, resolve } from "node:path";
-
-import { captionTypes } from "@hypit/caption";
-import { fineCaptionRecipeSchema, FINE_CAPTION_FAMILY } from "@hypit/caption-fine";
-import { openFontFamilies } from "@hypit/fonts-open";
-import type { OpenFontFamily, OpenFontStyle } from "@hypit/fonts-open";
-import { narrativeTypes } from "@hypit/narrative";
-import { loadNodePackageSelection } from "@hypit/package-loader-node";
-import type { LoadedPackage } from "@hypit/package-loader-node";
-import type { ArtifactAttachment } from "@hypit/workspace";
-import type { CanonicalValue, TypedRecord, TypeRef } from "@hypit/protocol";
-import { parseSvs } from "@hypit/svs";
-import { createVideoCompiler, discoverVideoSourcePackages } from "@hypit/video-cli";
-import type { Plugin, ViteDevServer } from "vite";
-
-import type {
- CaptionPlaygroundFailure,
- CaptionPlaygroundFont,
- CaptionPlaygroundSnapshot,
- FontPatch,
- RecipePatch,
-} from "./shared.js";
-
-// Resolve font packages from the package that owns that catalog. They are its
-// dependencies, not hidden root dependencies of this developer tool.
-const require = createRequire(new URL("../../../packages/fonts-open/src/surface.ts", import.meta.url));
-
-export type CaptionPlaygroundOptions = {
- readonly source: string;
- /** Host directory whose package manager installation supplies Source imports. */
- readonly packageRoot: string;
- readonly styleExport: string;
- readonly displayExport: string;
- readonly recipeFile: string;
- readonly recipePath: string;
- readonly fontFile: string;
- readonly fontId: string;
- readonly width: number;
- readonly height: number;
- readonly fps: number;
-};
-
-type CurrentState = {
- readonly snapshot: CaptionPlaygroundSnapshot;
- readonly attachments: ReadonlyMap<string, ArtifactAttachment>;
-};
-
-function maskedSourceHeader(source: string): string {
- return source.replace(/^\s*<\?svml\s+using=(['"])[^'"]+\1\s*\?>/u, (header) =>
- header.replace(/[^\r\n]/gu, " "));
-}
-
-function json(response: import("node:http").ServerResponse, status: number, value: unknown): void {
- response.statusCode = status;
- response.setHeader("content-type", "application/json; charset=utf-8");
- response.end(`${JSON.stringify(value)}\n`);
-}
-
-async function body<T>(request: import("node:http").IncomingMessage): Promise<T> {
- const chunks: Uint8Array[] = [];
- for await (const chunk of request) chunks.push(typeof chunk === "string" ? Buffer.from(chunk) : chunk);
- return JSON.parse(Buffer.concat(chunks).toString("utf8")) as T;
-}
-
-function typeLabel(type: TypeRef): string {
- return `${type.module.name}@${type.module.version} ${type.name}`;
-}
-
-function inlineExport(
- result: Awaited<ReturnType<ReturnType<typeof createVideoCompiler>["compileFile"]>>,
- name: string,
- expected: TypeRef,
-): unknown {
- const item = result.exports.find((candidate) => candidate.name === name);
- if (item === undefined) throw new Error(`Source exports no ${name}`);
- if (item.ref.kind !== "record") throw new Error(`${name} is computed at run time; Caption Playground needs an authored value`);
- const recordId = item.ref.id;
- const record: TypedRecord | undefined = result.program.records.find((candidate) => candidate.id === recordId);
- if (record?.value.kind !== "inline") throw new Error(`${name} is not an authored inline value`);
- // A Record carries its Type identity; the authored value itself names no contract.
- if (record.type.module.name !== expected.module.name
- || record.type.module.version !== expected.module.version
- || record.type.name !== expected.name) {
- throw new Error(`${name} is ${typeLabel(record.type)}, not ${typeLabel(expected)}`);
- }
- return record.value.value;
-}
-
-function assertRecord(value: unknown, subject: string): asserts value is Record<string, unknown> {
- if (value === null || typeof value !== "object" || Array.isArray(value)) {
- throw new Error(`${subject} is not an authored record`);
- }
-}
-
-function fontWeights(family: OpenFontFamily): readonly number[] {
- if (family.kind === "static" || family.kind === "static-split" || family.kind === "external-split") {
- return family.weights;
- }
- const common = [100, 200, 300, 400, 500, 600, 700, 800, 900]
- .filter((weight) => weight >= family.minimumWeight && weight <= family.maximumWeight);
- return common.length > 0 ? common : [family.minimumWeight, family.maximumWeight];
-}
-
-function catalog(): readonly CaptionPlaygroundFont[] {
- return Object.entries(openFontFamilies).map(([id, family]) => {
- const weights = fontWeights(family);
- return {
- id,
- label: family.label,
- category: family.category,
- intendedUse: family.intendedUse,
- license: family.license,
- weights,
- styles: family.styles,
- previewWeight: weights.includes(700) ? 700 : weights.includes(400) ? 400 : weights[0]!,
- previewStyle: family.styles.includes("normal") ? "normal" : family.styles[0]!,
- };
- }).sort((left, right) => left.label.localeCompare(right.label));
-}
-
-function quotePattern(value: string): string {
- return value.replace(/[.*+?^${}()|[\]\\]/gu, "\\$&");
-}
-
-function fontTag(source: string, id: string): {
- readonly start: number;
- readonly end: number;
- readonly text: string;
- readonly family: string;
- readonly weight: number;
- readonly style: OpenFontStyle;
-} {
- const tag = new RegExp(`<[A-Za-z][A-Za-z0-9_-]*:Stack\\b[^>]*\\bid=(['"])${quotePattern(id)}\\1[^>]*>`, "u").exec(source);
- if (tag?.index === undefined) throw new Error(`Source contains no fonts:Stack with id=${id}`);
- const text = tag[0];
- const attribute = (name: string): string | undefined =>
- new RegExp(`\\b${name}=(['"])(.*?)\\1`, "u").exec(text)?.[2];
- const family = attribute("family");
- const weight = Number(attribute("weight"));
- const style = attribute("style") as OpenFontStyle | undefined;
- if (family === undefined || !Number.isSafeInteger(weight) || (style !== "normal" && style !== "italic")) {
- throw new Error(`fonts:Stack ${id} must declare family, weight and style`);
- }
- return { start: tag.index, end: tag.index + text.length, text, family, weight, style };
-}
-
-function replaceAttribute(tag: string, name: string, value: string): string {
- const pattern = new RegExp(`(\\b${name}=)(['"])(.*?)\\2`, "u");
- if (!pattern.test(tag)) throw new Error(`fonts:Stack is missing ${name}`);
- return tag.replace(pattern, `$1"${value}"`);
-}
-
-function canonicalSource(value: CanonicalValue): string {
- if (typeof value === "number" || typeof value === "boolean") return String(value);
- if (typeof value === "string" && /^[^;{}\r\n]+$/u.test(value) && value.trim() === value) return value;
- if (typeof value === "string") return JSON.stringify(value);
- return JSON.stringify(value);
-}
-
-async function atomicWrite(path: string, contents: string): Promise<void> {
- const temporary = `${path}.caption-playground-${process.pid}-${Date.now()}`;
- await writeFile(temporary, contents, "utf8");
- await rename(temporary, path);
-}
-
-function defaultFontFile(
- family: OpenFontFamily & { readonly fileStem: string },
- weight: number,
- style: OpenFontStyle,
-): string {
- const filename = family.kind === "static"
- ? `${family.fileStem}-${weight}-${style}.woff2`
- : `${family.fileStem}-${style}.woff2`;
- return require.resolve(`${family.packageName}/files/${filename}`);
-}
-
-function splitFontFiles(
- family: OpenFontFamily & { readonly kind: "variable-split" | "static-split" | "external-split" },
- weight: number,
- style: OpenFontStyle,
-): readonly { readonly file: string; readonly unicodeRange: string }[] {
- const css = family.kind === "variable-split"
- ? family.css
- : family.kind === "external-split"
- ? family.css
- : `${weight}${style === "italic" ? "-italic" : ""}.css`;
- const cssPath = require.resolve(`${family.packageName}/${css}`);
- return [...readFileSync(cssPath, "utf8").matchAll(/@font-face\s*\{([\s\S]*?)\}/gu)].map((match) => {
- const bodyText = match[1]!;
- const file = /src:\s*url\((?:['"])?\.\/files\/([^)'";]+\.woff2)(?:['"])?\)/u.exec(bodyText)?.[1];
- const unicodeRange = /unicode-range:\s*([^;]+);/u.exec(bodyText)?.[1]?.replace(/\s+/gu, "");
- if (file === undefined || unicodeRange === undefined) throw new Error(`${cssPath} has unsupported @font-face CSS`);
- return { file: require.resolve(`${family.packageName}/files/${file}`), unicodeRange };
- });
-}
-
-export function captionPlaygroundPlugin(options: CaptionPlaygroundOptions): Plugin {
- let current: CurrentState | undefined;
- let failure: CaptionPlaygroundFailure | undefined;
- let revision = 0;
- let server: ViteDevServer | undefined;
- let compileTimer: ReturnType<typeof setTimeout> | undefined;
- const galleryFiles = new Map<string, string>();
- const loaded = (async () => {
- let packages: readonly LoadedPackage[] = [];
- let previous = "";
- while (true) {
- const selection = await discoverVideoSourcePackages(options.source, {
- workspaceRoot: dirname(options.source),
- packages,
- });
- packages = await loadNodePackageSelection(selection, options.packageRoot);
- const key = JSON.stringify(packages.map((item) => item.specifier));
- if (key === previous) return packages;
- previous = key;
- }
- })();
-
- const compile = async (): Promise<CurrentState> => {
- const packages = await loaded;
- const compiler = createVideoCompiler({
- packageContributions: packages.map((item) => item.contribution),
- workspaceRoot: dirname(options.source),
- });
- const [result, fontText, recipeText] = await Promise.all([
- compiler.compileFile(options.source),
- readFile(options.fontFile, "utf8"),
- readFile(options.recipeFile, "utf8"),
- ]);
- const style = inlineExport(result, options.styleExport, captionTypes.style);
- const display = inlineExport(result, options.displayExport, narrativeTypes.captionDisplay);
- assertRecord(style, options.styleExport);
- assertRecord(display, options.displayExport);
- if ((style.rendering as Record<string, unknown> | undefined)?.family !== FINE_CAPTION_FAMILY) {
- throw new Error(`${options.styleExport} is not a Fine Caption Style`);
- }
- const recipe = parseSvs(options.recipeFile, maskedSourceHeader(recipeText)).recipes
- .find((candidate) => candidate.value.path === options.recipePath);
- if (recipe === undefined) throw new Error(`${options.recipeFile} contains no ${options.recipePath}`);
- const selectedFont = fontTag(fontText, options.fontId);
- const attachments = new Map(result.attachments.map((item) => [item.artifact.digest, item]));
- revision += 1;
- return {
- snapshot: {
- revision,
- style: style as CaptionPlaygroundSnapshot["style"],
- display: display as CaptionPlaygroundSnapshot["display"],
- recipe: {
- file: relative(process.cwd(), options.recipeFile),
- path: options.recipePath,
- values: recipe.value.properties,
- schema: fineCaptionRecipeSchema,
- },
- font: {
- file: relative(process.cwd(), options.fontFile),
- id: options.fontId,
- family: selectedFont.family,
- weight: selectedFont.weight,
- style: selectedFont.style,
- },
- preview: { width: options.width, height: options.height, fps: options.fps },
- fonts: catalog(),
- artifacts: result.attachments.map((item) => ({ ...item.artifact })),
- },
- attachments,
- };
- };
-
- const publish = async (): Promise<void> => {
- try {
- current = await compile();
- failure = undefined;
- server?.ws.send({ type: "custom", event: "caption:snapshot", data: current.snapshot });
- } catch (error) {
- revision += 1;
- failure = { revision, error: error instanceof Error ? error.message : String(error) };
- server?.ws.send({ type: "custom", event: "caption:error", data: failure });
- }
- };
-
- const schedule = (): void => {
- if (compileTimer !== undefined) clearTimeout(compileTimer);
- compileTimer = setTimeout(() => void publish(), 80);
- };
-
- const patchRecipe = async (patch: RecipePatch): Promise<void> => {
- const source = await readFile(options.recipeFile, "utf8");
- const parsed = parseSvs(options.recipeFile, maskedSourceHeader(source)).recipes
- .find((item) => item.value.path === options.recipePath);
- if (parsed === undefined) throw new Error(`Recipe ${options.recipePath} no longer exists`);
- const property = parsed.properties.find((item) => item.name === patch.name);
- let next: string;
- if (patch.remove === true) {
- if (property === undefined) return;
- next = `${source.slice(0, property.range.start)}${source.slice(property.range.end)}`;
- } else {
- if (patch.value === undefined) throw new Error("Recipe patch has no value");
- const value = canonicalSource(patch.value);
- if (property !== undefined) {
- next = `${source.slice(0, property.valueRange.start)}${value}${source.slice(property.valueRange.end)}`;
- } else {
- const close = parsed.range.end - 1;
- next = `${source.slice(0, close)}\n ${patch.name}: ${value};${source.slice(close)}`;
- }
- }
- await atomicWrite(options.recipeFile, next);
- };
-
- const patchFont = async (patch: FontPatch): Promise<void> => {
- const family = openFontFamilies[patch.family as keyof typeof openFontFamilies] as OpenFontFamily | undefined;
- if (family === undefined) throw new Error(`Unknown open font ${patch.family}`);
- if (!fontWeights(family).includes(patch.weight)
- || !(family.styles as readonly OpenFontStyle[]).includes(patch.style)) {
- throw new Error(`${patch.family} does not provide ${patch.weight} ${patch.style}`);
- }
- const source = await readFile(options.fontFile, "utf8");
- const selected = fontTag(source, options.fontId);
- let replacement = replaceAttribute(selected.text, "family", patch.family);
- replacement = replaceAttribute(replacement, "weight", String(patch.weight));
- replacement = replaceAttribute(replacement, "style", patch.style);
- await atomicWrite(options.fontFile, `${source.slice(0, selected.start)}${replacement}${source.slice(selected.end)}`);
- };
-
- return {
- name: "hypit-caption-playground",
- configureServer(value) {
- server = value;
- value.watcher.add([options.source, options.recipeFile, options.fontFile]);
- value.watcher.on("change", (path) => {
- if (resolve(path) === options.source || resolve(path) === options.recipeFile || resolve(path) === options.fontFile) schedule();
- });
- value.middlewares.use(async (request, response, next) => {
- const url = new URL(request.url ?? "/", "http://caption.local");
- try {
- if (request.method === "GET" && url.pathname === "/__caption/session") {
- if (current === undefined && failure === undefined) await publish();
- if (current !== undefined) json(response, 200, current.snapshot);
- else json(response, 500, failure);
- return;
- }
- if (request.method === "PATCH" && url.pathname === "/__caption/recipe") {
- await patchRecipe(await body<RecipePatch>(request));
- await publish();
- json(response, 200, current?.snapshot ?? failure);
- return;
- }
- if (request.method === "PATCH" && url.pathname === "/__caption/font") {
- await patchFont(await body<FontPatch>(request));
- await publish();
- json(response, 200, current?.snapshot ?? failure);
- return;
- }
- const artifact = /^\/__caption\/artifact\/(sha256:[a-f0-9]+)$/u.exec(url.pathname)?.[1];
- if (request.method === "GET" && artifact !== undefined) {
- const attachment = current?.attachments.get(artifact);
- if (attachment === undefined) { response.statusCode = 404; response.end(); return; }
- response.setHeader("content-type", attachment.artifact.mediaType);
- response.setHeader("cache-control", "no-store");
- for await (const chunk of await attachment.open()) response.write(chunk);
- response.end();
- return;
- }
- const familyId = /^\/__caption\/font-css\/([a-z0-9-]+)$/u.exec(url.pathname)?.[1];
- if (request.method === "GET" && familyId !== undefined) {
- const family = openFontFamilies[familyId as keyof typeof openFontFamilies] as OpenFontFamily | undefined;
- if (family === undefined) { response.statusCode = 404; response.end(); return; }
- const weights = fontWeights(family);
- const weight = weights.includes(700) ? 700 : weights.includes(400) ? 400 : weights[0]!;
- const style = family.styles.includes("normal") ? "normal" : family.styles[0]!;
- const files = family.kind === "variable-split" || family.kind === "static-split" || family.kind === "external-split"
- ? splitFontFiles(family, weight, style)
- : [{ file: defaultFontFile(family, weight, style) }];
- const css = files.map((item) => {
- const token = String(galleryFiles.size);
- galleryFiles.set(token, item.file);
- const range = "unicodeRange" in item ? `unicode-range:${item.unicodeRange};` : "";
- return `@font-face{font-family:${JSON.stringify(`caption-gallery-${familyId}`)};src:url('/__caption/font-file/${token}') format('woff2');font-style:${style};font-weight:${weight};${range}font-display:swap;}`;
- }).join("\n");
- response.setHeader("content-type", "text/css; charset=utf-8");
- response.setHeader("cache-control", "public, max-age=3600");
- response.end(css);
- return;
- }
- const token = /^\/__caption\/font-file\/([a-f0-9]+)$/u.exec(url.pathname)?.[1];
- if (request.method === "GET" && token !== undefined) {
- const path = galleryFiles.get(token);
- if (path === undefined) { response.statusCode = 404; response.end(); return; }
- response.setHeader("content-type", "font/woff2");
- response.setHeader("cache-control", "public, max-age=3600");
- response.end(await readFile(path));
- return;
- }
- next();
- } catch (error) {
- const status = typeof error === "object" && error !== null && "status" in error
- ? Number((error as { status: unknown }).status)
- : 400;
- if (status === 409) await publish();
- json(response, status, { error: error instanceof Error ? error.message : String(error), snapshot: current?.snapshot });
- }
- });
- },
- };
-}
diff --git a/packages/caption-playground/src/shared.ts b/packages/caption-playground/src/shared.ts
deleted file mode 100644
index a59ad61b..00000000
--- a/packages/caption-playground/src/shared.ts
+++ /dev/null
@@ -1,63 +0,0 @@
-import type { CaptionStyleIntent } from "@hypit/caption";
-import type { OpenFontCategory, OpenFontStyle } from "@hypit/fonts-open";
-import type { CaptionDisplaySequence } from "@hypit/narrative";
-import type { CanonicalValue, ValueSchema } from "@hypit/protocol";
-
-export type CaptionPlaygroundFont = {
- readonly id: string;
- readonly label: string;
- readonly category: OpenFontCategory;
- readonly intendedUse: string;
- readonly license: string;
- readonly weights: readonly number[];
- readonly styles: readonly OpenFontStyle[];
- readonly previewWeight: number;
- readonly previewStyle: OpenFontStyle;
-};
-
-export type CaptionPlaygroundSnapshot = {
- readonly revision: number;
- readonly style: CaptionStyleIntent;
- readonly display: CaptionDisplaySequence;
- readonly recipe: {
- readonly file: string;
- readonly path: string;
- readonly values: Readonly<Record<string, CanonicalValue>>;
- readonly schema: ValueSchema;
- };
- readonly font: {
- readonly file: string;
- readonly id: string;
- readonly family: string;
- readonly weight: number;
- readonly style: OpenFontStyle;
- };
- readonly preview: {
- readonly width: number;
- readonly height: number;
- readonly fps: number;
- };
- readonly fonts: readonly CaptionPlaygroundFont[];
- readonly artifacts: readonly {
- readonly digest: string;
- readonly mediaType: string;
- readonly size: number;
- }[];
-};
-
-export type CaptionPlaygroundFailure = {
- readonly revision: number;
- readonly error: string;
-};
-
-export type RecipePatch = {
- readonly name: string;
- readonly value?: CanonicalValue;
- readonly remove?: true;
-};
-
-export type FontPatch = {
- readonly family: string;
- readonly weight: number;
- readonly style: OpenFontStyle;
-};
diff --git a/packages/caption-playground/src/shims/node-crypto.ts b/packages/caption-playground/src/shims/node-crypto.ts
deleted file mode 100644
index bcb11913..00000000
--- a/packages/caption-playground/src/shims/node-crypto.ts
+++ /dev/null
@@ -1,60 +0,0 @@
-const K = new Uint32Array([
- 0x428a2f98,0x71374491,0xb5c0fbcf,0xe9b5dba5,0x3956c25b,0x59f111f1,0x923f82a4,0xab1c5ed5,
- 0xd807aa98,0x12835b01,0x243185be,0x550c7dc3,0x72be5d74,0x80deb1fe,0x9bdc06a7,0xc19bf174,
- 0xe49b69c1,0xefbe4786,0x0fc19dc6,0x240ca1cc,0x2de92c6f,0x4a7484aa,0x5cb0a9dc,0x76f988da,
- 0x983e5152,0xa831c66d,0xb00327c8,0xbf597fc7,0xc6e00bf3,0xd5a79147,0x06ca6351,0x14292967,
- 0x27b70a85,0x2e1b2138,0x4d2c6dfc,0x53380d13,0x650a7354,0x766a0abb,0x81c2c92e,0x92722c85,
- 0xa2bfe8a1,0xa81a664b,0xc24b8b70,0xc76c51a3,0xd192e819,0xd6990624,0xf40e3585,0x106aa070,
- 0x19a4c116,0x1e376c08,0x2748774c,0x34b0bcb5,0x391c0cb3,0x4ed8aa4a,0x5b9cca4f,0x682e6ff3,
- 0x748f82ee,0x78a5636f,0x84c87814,0x8cc70208,0x90befffa,0xa4506ceb,0xbef9a3f7,0xc67178f2,
-]);
-
-const rotr = (value: number, bits: number): number => ((value >>> bits) | (value << (32 - bits))) >>> 0;
-
-export function sha256Hex(bytes: Uint8Array): string {
- const h = new Uint32Array([0x6a09e667,0xbb67ae85,0x3c6ef372,0xa54ff53a,0x510e527f,0x9b05688c,0x1f83d9ab,0x5be0cd19]);
- const padded = new Uint8Array(((((bytes.length + 8) / 64) | 0) + 1) * 64);
- padded.set(bytes); padded[bytes.length] = 0x80;
- const view = new DataView(padded.buffer); const bits = bytes.length * 8;
- view.setUint32(padded.length - 8, Math.floor(bits / 0x1_0000_0000), false);
- view.setUint32(padded.length - 4, bits >>> 0, false);
- const w = new Uint32Array(64);
- for (let offset = 0; offset < padded.length; offset += 64) {
- for (let index = 0; index < 16; index += 1) w[index] = view.getUint32(offset + index * 4, false);
- for (let index = 16; index < 64; index += 1) {
- const x = w[index - 15]!; const y = w[index - 2]!;
- const s0 = (rotr(x, 7) ^ rotr(x, 18) ^ (x >>> 3)) >>> 0;
- const s1 = (rotr(y, 17) ^ rotr(y, 19) ^ (y >>> 10)) >>> 0;
- w[index] = (w[index - 16]! + s0 + w[index - 7]! + s1) >>> 0;
- }
- let a=h[0]!,b=h[1]!,c=h[2]!,d=h[3]!,e=h[4]!,f=h[5]!,g=h[6]!,s=h[7]!;
- for (let index = 0; index < 64; index += 1) {
- const s1 = (rotr(e,6)^rotr(e,11)^rotr(e,25))>>>0;
- const t1 = (s+s1+((e&f)^(~e&g))+K[index]!+w[index]!)>>>0;
- const s0 = (rotr(a,2)^rotr(a,13)^rotr(a,22))>>>0;
- const t2 = (s0+((a&b)^(a&c)^(b&c)))>>>0;
- s=g;g=f;f=e;e=(d+t1)>>>0;d=c;c=b;b=a;a=(t1+t2)>>>0;
- }
- h[0]=(h[0]!+a)>>>0;h[1]=(h[1]!+b)>>>0;h[2]=(h[2]!+c)>>>0;h[3]=(h[3]!+d)>>>0;
- h[4]=(h[4]!+e)>>>0;h[5]=(h[5]!+f)>>>0;h[6]=(h[6]!+g)>>>0;h[7]=(h[7]!+s)>>>0;
- }
- return [...h].map((value) => value.toString(16).padStart(8,"0")).join("");
-}
-
-const encoder = new TextEncoder();
-class Sha256Hash {
- #chunks: Uint8Array[] = [];
- update(chunk: string | Uint8Array): this { this.#chunks.push(typeof chunk === "string" ? encoder.encode(chunk) : chunk); return this; }
- digest(encoding?: string): string {
- if (encoding !== undefined && encoding !== "hex") throw new Error(`crypto shim supports hex, not ${encoding}`);
- const size = this.#chunks.reduce((sum, chunk) => sum + chunk.length, 0);
- const joined = new Uint8Array(size); let cursor = 0;
- for (const chunk of this.#chunks) { joined.set(chunk, cursor); cursor += chunk.length; }
- return sha256Hex(joined);
- }
-}
-export function createHash(algorithm: string): Sha256Hash {
- if (algorithm !== "sha256") throw new Error(`crypto shim supports sha256, not ${algorithm}`);
- return new Sha256Hash();
-}
-export default { createHash };
diff --git a/packages/caption-playground/src/style.css b/packages/caption-playground/src/style.css
deleted file mode 100644
index bb693630..00000000
--- a/packages/caption-playground/src/style.css
+++ /dev/null
@@ -1,47 +0,0 @@
-:root {
- color-scheme: dark; --bg:#09090b; --panel:#131316; --panel2:#18181c; --line:#2a2a30;
- --text:#f4f4f5; --muted:#96969f; --accent:#ee7b62; --danger:#ff6868;
- font: 13px/1.45 Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
-}
-* { box-sizing:border-box; }
-html, body, #app { margin:0; height:100%; overflow:hidden; background:var(--bg); color:var(--text); }
-#app { display:flex; flex-direction:column; }
-.topbar { height:54px; flex:none; display:flex; align-items:center; justify-content:space-between; padding:0 18px; border-bottom:1px solid var(--line); background:#101013; }
-.topbar strong { font-size:15px; letter-spacing:-.01em; }
-.topbar span { margin-left:10px; color:var(--muted); }
-.status { color:var(--muted); font-size:12px; }
-.status.ok { color:#75d69b; } .status.error { color:var(--danger); }
-main { flex:1; min-height:0; display:grid; grid-template-columns:minmax(0,1fr) 430px; }
-[data-stage] { min-width:0; min-height:0; }
-.stage { height:100%; display:flex; flex-direction:column; background:radial-gradient(circle at 50% 42%, #222228 0, #0c0c0f 60%); }
-.stage-viewport { flex:1; min-height:0; overflow:hidden; display:flex; align-items:center; justify-content:center; padding:16px; }
-.stage-scaler { position:relative; transform-origin:top left; }
-.stage iframe { display:block; transform-origin:top left; border:0; background:#000; box-shadow:0 24px 80px #0009, 0 0 0 1px #ffffff1c; }
-.stage-bar { height:48px; flex:none; display:flex; gap:12px; align-items:center; padding:0 14px; background:#111114; border-top:1px solid var(--line); color:var(--muted); font-variant-numeric:tabular-nums; }
-.stage-bar button { width:32px; height:28px; color:var(--text); border:1px solid var(--line); background:#1c1c21; border-radius:6px; cursor:pointer; }
-.stage-bar input { flex:1; accent-color:var(--accent); }
-.stage-error { position:absolute; left:16px; right:446px; bottom:64px; z-index:3; max-height:180px; overflow:auto; margin:0; padding:12px; color:#ffb0b0; background:#310f13e8; border:1px solid #8d3039; border-radius:8px; white-space:pre-wrap; }
-.stage-error:empty { display:none; }
-aside { min-height:0; overflow:auto; border-left:1px solid var(--line); background:var(--panel); padding-bottom:28px; }
-aside section, aside details { border-bottom:1px solid var(--line); }
-.section-heading { padding:17px 18px 10px; }
-.section-heading h2 { margin:0; font-size:14px; }
-.section-heading p { margin:3px 0 0; color:var(--muted); font-size:11px; }
-.font-current { display:grid; grid-template-columns:1fr 1fr; gap:8px; padding:0 18px 10px; }
-input, select { min-width:0; width:100%; padding:7px 9px; color:var(--text); background:#0f0f12; border:1px solid #35353c; border-radius:6px; outline:none; }
-input:focus, select:focus { border-color:var(--accent); }
-.font-search { width:calc(100% - 36px); margin:0 18px 10px; }
-.font-grid { height:250px; overflow:auto; padding:0 12px 12px; display:grid; grid-template-columns:1fr 1fr; gap:7px; }
-.font-card { min-width:0; text-align:left; display:flex; flex-direction:column; gap:2px; padding:9px; color:var(--text); background:#101013; border:1px solid var(--line); border-radius:8px; cursor:pointer; }
-.font-card:hover { border-color:#5a5a64; } .font-card.selected { border-color:var(--accent); box-shadow:inset 0 0 0 1px var(--accent); }
-.font-card strong { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; font-size:11px; color:var(--muted); }
-.font-card span { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; font-size:17px; }
-.font-card small { color:#686872; }
-details summary { position:sticky; top:0; z-index:1; padding:13px 18px; cursor:pointer; background:var(--panel2); font-weight:650; }
-.property-grid { padding:8px 18px 15px; display:grid; gap:7px; }
-.property { min-height:34px; display:grid; grid-template-columns:16px minmax(130px,1fr) minmax(120px,1fr); align-items:center; gap:8px; }
-.property > span { color:#c7c7ce; font-family:ui-monospace, SFMono-Regular, Menlo, monospace; font-size:11px; }
-.property:not(:has(.property-toggle)) { grid-template-columns:minmax(154px,1fr) minmax(120px,1fr); padding-left:24px; }
-.property-toggle { width:14px; height:14px; padding:0; accent-color:var(--accent); }
-.property input:disabled, .property select:disabled { opacity:.35; }
-@media (max-width:900px) { main { grid-template-columns:1fr 360px; } .stage-error { right:376px; } }
diff --git a/packages/caption-playground/src/svml.ts b/packages/caption-playground/src/svml.ts
deleted file mode 100644
index 4f470e5f..00000000
--- a/packages/caption-playground/src/svml.ts
+++ /dev/null
@@ -1,12 +0,0 @@
-export { resolveCaptionProgram } from "@hypit/caption";
-export type { CaptionStyleIntent, TimedCaptionProjection } from "@hypit/caption";
-export { renderFineCaption } from "@hypit/caption-fine";
-export type { CaptionDisplaySequence } from "@hypit/narrative";
-export { sealComposition } from "@hypit/composition";
-export type { Composition, Track } from "@hypit/composition";
-export { sealProgramSpace, programSpaceFrameCount } from "@hypit/program-space";
-export type { ProgramSpace } from "@hypit/program-space";
-export {
- compileHyperframesDocument,
- materializeHyperframesHtml,
-} from "../../../packages/hyperframes/src/document.js";
diff --git a/packages/caption-playground/src/ui/stage.ts b/packages/caption-playground/src/ui/stage.ts
deleted file mode 100644
index dede647e..00000000
--- a/packages/caption-playground/src/ui/stage.ts
+++ /dev/null
@@ -1,95 +0,0 @@
-import type { PreviewOutput } from "../preview/render.js";
-
-type SeekWindow = Window & { __svmlSeekFrame?: (frame: number) => void };
-
-export type Stage = {
- readonly element: HTMLElement;
- show(output: PreviewOutput): void;
- showError(message: string): void;
-};
-
-export function createStage(): Stage {
- const element = document.createElement("section");
- element.className = "stage";
- element.innerHTML = `
- <div class="stage-viewport"><div class="stage-scaler"><iframe title="Caption preview"></iframe></div></div>
- <div class="stage-bar">
- <button type="button" data-play aria-label="Play">▶</button>
- <input type="range" min="0" max="0" step="1" value="0" data-scrub />
- <span data-frame>0 / 0</span><span data-size></span>
- </div>
- <pre class="stage-error" data-error></pre>`;
- const viewport = element.querySelector<HTMLElement>(".stage-viewport")!;
- const scaler = element.querySelector<HTMLElement>(".stage-scaler")!;
- const iframe = element.querySelector<HTMLIFrameElement>("iframe")!;
- const play = element.querySelector<HTMLButtonElement>("[data-play]")!;
- const scrub = element.querySelector<HTMLInputElement>("[data-scrub]")!;
- const readout = element.querySelector<HTMLElement>("[data-frame]")!;
- const size = element.querySelector<HTMLElement>("[data-size]")!;
- const error = element.querySelector<HTMLElement>("[data-error]")!;
- let canvas = { width: 1080, height: 1920 };
- let frames = 1;
- let fps = 30;
- let ready = false;
- let playing = false;
- let raf = 0;
-
- const fit = (): void => {
- const room = viewport.getBoundingClientRect();
- const scale = Math.min((room.width - 32) / canvas.width, (room.height - 32) / canvas.height, 1);
- const valid = Number.isFinite(scale) && scale > 0 ? scale : 1;
- scaler.style.width = `${canvas.width * valid}px`;
- scaler.style.height = `${canvas.height * valid}px`;
- iframe.style.width = `${canvas.width}px`;
- iframe.style.height = `${canvas.height}px`;
- iframe.style.transform = `scale(${valid})`;
- };
- const seek = (frame: number): void => {
- readout.textContent = `${frame} / ${frames - 1}`;
- if (ready) (iframe.contentWindow as SeekWindow | null)?.__svmlSeekFrame?.(frame);
- };
- const stop = (): void => {
- playing = false;
- play.textContent = "▶";
- if (raf !== 0) cancelAnimationFrame(raf);
- raf = 0;
- };
- play.addEventListener("click", () => {
- if (playing) { stop(); return; }
- playing = true;
- play.textContent = "❚❚";
- const start = performance.now();
- const from = Number(scrub.value);
- const step = (now: number): void => {
- const at = from + Math.round((now - start) / 1000 * fps);
- if (!playing || at >= frames) { scrub.value = String(frames - 1); seek(frames - 1); stop(); return; }
- scrub.value = String(at);
- seek(at);
- raf = requestAnimationFrame(step);
- };
- raf = requestAnimationFrame(step);
- });
- scrub.addEventListener("input", () => { stop(); seek(Number(scrub.value)); });
- iframe.addEventListener("load", () => { ready = true; seek(Number(scrub.value)); });
- new ResizeObserver(fit).observe(viewport);
-
- return {
- element,
- show(output) {
- error.textContent = "";
- canvas = output.canvas;
- frames = Math.max(1, output.frameCount);
- fps = output.fps;
- const at = Math.min(Number(scrub.value), frames - 1);
- scrub.max = String(frames - 1);
- scrub.value = String(at);
- readout.textContent = `${at} / ${frames - 1}`;
- size.textContent = `${canvas.width}×${canvas.height}`;
- ready = false;
- iframe.srcdoc = output.srcdoc;
- stop();
- fit();
- },
- showError(message) { stop(); error.textContent = message; },
- };
-}
diff --git a/packages/caption-playground/start.ts b/packages/caption-playground/start.ts
deleted file mode 100644
index e4287d5f..00000000
--- a/packages/caption-playground/start.ts
+++ /dev/null
@@ -1,108 +0,0 @@
-import { readdirSync, readFileSync } from "node:fs";
-import { dirname, join, resolve } from "node:path";
-import { fileURLToPath } from "node:url";
-
-import { createServer } from "vite";
-
-import { captionPlaygroundPlugin } from "./src/server.js";
-
-const here = dirname(fileURLToPath(import.meta.url));
-const repoRoot = resolve(here, "../..");
-
-function usage(message?: string): never {
- if (message !== undefined) process.stderr.write(`${message}\n\n`);
- process.stderr.write(`Usage:
- pnpm caption:playground -- \\
- --source <main.svml> \\
- --style <export> --display <export> --recipe <file.svs#recipe.path> \\
- --font <file.svml#font-stack-id> --canvas <width>x<height> --fps <number> \
- [--package-root <directory>] [--port <number>]
-`);
- process.exit(1);
-}
-
-function argumentsByName(argv: readonly string[]): ReadonlyMap<string, string> {
- const result = new Map<string, string>();
- for (let index = 0; index < argv.length; index += 2) {
- const flag = argv[index];
- const value = argv[index + 1];
- if (flag === undefined || !flag.startsWith("--") || value === undefined || value.startsWith("--")) {
- usage(`Malformed argument near ${flag ?? "end of command"}`);
- }
- result.set(flag.slice(2), value);
- }
- return result;
-}
-
-function required(values: ReadonlyMap<string, string>, name: string): string {
- const value = values.get(name);
- if (value === undefined || !value.trim()) usage(`Missing --${name}`);
- return value;
-}
-
-function workspaceAliases(): Array<{ find: string; replacement: string }> {
- const packages = join(repoRoot, "packages");
- return readdirSync(packages, { withFileTypes: true }).filter((entry) => entry.isDirectory()).flatMap((entry) => {
- const manifestPath = join(packages, entry.name, "package.json");
- let manifest: { name?: unknown; exports?: unknown };
- try { manifest = JSON.parse(readFileSync(manifestPath, "utf8")) as typeof manifest; } catch { return []; }
- const target = (manifest.exports as Record<string, unknown> | undefined)?.["."];
- return typeof manifest.name === "string" && typeof target === "string"
- ? [{ find: manifest.name, replacement: join(packages, entry.name, target) }]
- : [];
- });
-}
-
-const rawArguments = process.argv.slice(2);
-const values = argumentsByName(rawArguments[0] === "--" ? rawArguments.slice(1) : rawArguments);
-const recipeArgument = required(values, "recipe");
-const hash = recipeArgument.lastIndexOf("#");
-if (hash <= 0 || hash === recipeArgument.length - 1) usage("--recipe must be <file.svs#recipe.path>");
-const fontArgument = required(values, "font");
-const fontHash = fontArgument.lastIndexOf("#");
-if (fontHash <= 0 || fontHash === fontArgument.length - 1) usage("--font must be <file.svml#font-stack-id>");
-const canvas = /^(\d+)x(\d+)$/u.exec(required(values, "canvas"));
-if (canvas === null) usage("--canvas must be <width>x<height>");
-const fps = Number(required(values, "fps"));
-const port = Number(values.get("port") ?? "5178");
-if (!Number.isSafeInteger(fps) || fps <= 0 || !Number.isSafeInteger(port) || port <= 0) usage("--fps and --port must be positive integers");
-
-// `pnpm --filter … exec` runs inside the package directory, so a relative
-// path must be resolved against the directory the author typed it in.
-const invokedFrom = process.env.INIT_CWD ?? process.cwd();
-const source = resolve(invokedFrom, required(values, "source"));
-const recipeFile = resolve(invokedFrom, recipeArgument.slice(0, hash));
-const fontFile = resolve(invokedFrom, fontArgument.slice(0, fontHash));
-const packageRoot = resolve(invokedFrom, values.get("package-root") ?? repoRoot);
-const server = await createServer({
- configFile: false,
- root: here,
- resolve: {
- alias: [
- { find: "node:crypto", replacement: join(here, "src/shims/node-crypto.ts") },
- ...workspaceAliases(),
- ],
- },
- server: {
- port,
- fs: {
- allow: [...new Set([repoRoot, packageRoot, dirname(source), dirname(recipeFile), dirname(fontFile)])],
- },
- },
- plugins: [captionPlaygroundPlugin({
- source,
- packageRoot,
- styleExport: required(values, "style"),
- displayExport: required(values, "display"),
- recipeFile,
- recipePath: recipeArgument.slice(hash + 1),
- fontFile,
- fontId: fontArgument.slice(fontHash + 1),
- width: Number(canvas[1]),
- height: Number(canvas[2]),
- fps,
- })],
-});
-
-await server.listen();
-server.printUrls();
diff --git a/packages/caption-playground/test/runtime-shim.test.ts b/packages/caption-playground/test/runtime-shim.test.ts
deleted file mode 100644
index eb13b833..00000000
--- a/packages/caption-playground/test/runtime-shim.test.ts
+++ /dev/null
@@ -1,46 +0,0 @@
-import assert from "node:assert/strict";
-import test from "node:test";
-
-import { sealComposition, sealVisualTrack } from "@hypit/composition";
-import { compileHyperframesDocument } from "@hypit/hyperframes";
-import { sealProgramSpace } from "@hypit/program-space";
-
-import { injectRuntimeShim } from "../src/preview/runtime-shim.js";
-
-const space = sealProgramSpace({
- durationSec: 2,
- frameRate: { numerator: 30, denominator: 1 },
-});
-
-function document_() {
- return compileHyperframesDocument(sealComposition({
- id: "caption-preview",
- canvas: { width: 1080, height: 1920, clearColor: "#09090b" },
- tracks: [sealVisualTrack({
- visualIr: "hypit.visual-ir@1",
- id: "caption",
- presents: [{
- id: "one", span: { startFrame: 0, endFrameExclusive: 30 },
- stacking: { order: 10, tieBreak: "caption" },
- elements: [{ id: "root", order: 0, kind: "box", style: [{ name: "position", value: "absolute" }] }],
- }],
- })],
- }), space);
-}
-
-test("Caption preview shim sizes the Hyperframes root and supplies a seekable timeline", () => {
- const { html } = document_();
- const rootRule = /\[data-composition-id\]\{([^}]*)\}/u.exec(html);
- assert.notEqual(rootRule, null);
- assert.doesNotMatch(rootRule![1]!, /(^|;)\s*(width|height)\s*:/u);
- assert.doesNotMatch(html, /visibility\s*:/u);
- const output = injectRuntimeShim(html);
- assert.match(output, /root\.style\.height/u);
- assert.match(output, /__svmlSeekFrame/u);
- assert.match(output, /visibility/u);
- assert.ok(output.lastIndexOf("<script>") < output.lastIndexOf("</body>"));
-});
-
-test("Caption preview shim is still injected when body close is absent", () => {
- assert.match(injectRuntimeShim("<!doctype html><html></html>"), /__svmlSeekFrame/u);
-});
diff --git a/packages/cli/src/index.ts b/packages/cli/src/index.ts
index ac3e2297..2971bb54 100644
--- a/packages/cli/src/index.ts
+++ b/packages/cli/src/index.ts
@@ -1,7 +1,10 @@
-export { materializeArtifact, materializeRecord, pinnedRecords } from "./archive.js";
+export { materializeArtifact, materializeRecord, pinnedRecords, selectArchivedRecord } from "./archive.js";
export type { PinnedRecord } from "./archive.js";
export { runCli } from "./main.js";
export { discoverSourcePackages } from "./source-discovery.js";
+export { loadDiscoveredSourcePackages } from "./source-packages.js";
+export { collectRunFrontends, loadRunFile } from "./run-file.js";
+export type { LoadedRunFile } from "./run-file.js";
export { hypitHostStateRoot, hypitProjectStateRoot } from "./paths.js";
export { renderCliError, writeCliHelp, writeCliOutput } from "./output.js";
export type {
diff --git a/packages/studio/README.md b/packages/studio/README.md
new file mode 100644
index 00000000..f6f7fddc
--- /dev/null
+++ b/packages/studio/README.md
@@ -0,0 +1,19 @@
+# Hypit Studio
+
+The single official Web Studio for SVML. It opens an explicit Run Source,
+traces its Film or Render target back to the semantic and visual projections
+Studio can edit, runs deterministic Producers only, and composites the
+resulting Tracks with HyperFrames.
+
+```bash
+pnpm studio -- --run path/to/studio.svrun
+```
+
+Studio is an application boundary. Core and domain packages do not import it or
+register UI metadata. Studio discovers the packages selected by the Source via
+the same recursive mechanism as the official CLI, then applies its centralized
+video-domain trace policy locally.
+
+Opening Studio never invokes a Provider and never creates a Build. Every
+projection needed for display must already be supplied by the Run or be
+deterministically derivable from those supplied Candidates.
diff --git a/packages/svml-playground/index.html b/packages/studio/index.html
similarity index 93%
rename from packages/svml-playground/index.html
rename to packages/studio/index.html
index fd720e78..e6b04d51 100644
--- a/packages/svml-playground/index.html
+++ b/packages/studio/index.html
@@ -8,7 +8,7 @@
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
<link rel="stylesheet"
href="https://fonts.googleapis.com/css2?family=Material+Symbols+Rounded:opsz,wght,FILL,GRAD@24,400,1,0&display=block" />
- <title>SVML Playground - Hypit</title>
+ <title>Hypit Studio</title>
</head>
<body><div id="app"></div><script type="module" src="/src/ui/main.ts"></script></body>
</html>
diff --git a/packages/studio/package.json b/packages/studio/package.json
new file mode 100644
index 00000000..6cc87fe8
--- /dev/null
+++ b/packages/studio/package.json
@@ -0,0 +1,29 @@
+{
+ "name": "@hypit/studio",
+ "version": "0.0.1",
+ "private": true,
+ "type": "module",
+ "dependencies": {
+ "@hypit/cli": "workspace:*",
+ "@hypit/compiler-node": "workspace:*",
+ "@hypit/component-kit": "workspace:*",
+ "@hypit/composition": "workspace:*",
+ "@hypit/core": "workspace:*",
+ "@hypit/driver-node": "workspace:*",
+ "@hypit/elaborator": "workspace:*",
+ "@hypit/hyperframes": "workspace:*",
+ "@hypit/markup": "workspace:*",
+ "@hypit/package-loader-node": "workspace:*",
+ "@hypit/program-space": "workspace:*",
+ "@hypit/protocol": "workspace:*",
+ "@hypit/run": "workspace:*",
+ "@hypit/runtime": "workspace:*",
+ "@hypit/runtime-host-node": "workspace:*",
+ "@hypit/script": "workspace:*",
+ "@hypit/validation": "workspace:*",
+ "@hypit/video-cli": "workspace:*",
+ "@hypit/workspace": "workspace:*",
+ "@hypit/workspace-fs-node": "workspace:*",
+ "vite": "5.4.21"
+ }
+}
diff --git a/packages/studio/src/archive.ts b/packages/studio/src/archive.ts
new file mode 100644
index 00000000..ee789bd1
--- /dev/null
+++ b/packages/studio/src/archive.ts
@@ -0,0 +1,58 @@
+import type { NodeRuntimeHost } from "@hypit/runtime-host-node";
+import type { Digest, StoredValue, TypeRef } from "@hypit/protocol";
+
+import { selectArchivedRecord } from "@hypit/cli";
+import { videoCliDistribution } from "@hypit/video-cli";
+
+export type StudioArchive = {
+ readonly runtime?: Pick<Awaited<ReturnType<NodeRuntimeHost["openArchive"]>>, "status">;
+ readonly resolveBuildRecord: (
+ build: string,
+ output: string,
+ ) => Promise<{ readonly type: TypeRef; readonly value: StoredValue } | undefined>;
+ readonly read: (digest: Digest) => Promise<Uint8Array | undefined>;
+ readonly close: () => Promise<void>;
+};
+
+/** Open a Runtime profile read-only; Studio never creates or mutates a Build. */
+export async function openStudioArchive(
+ profile: string | undefined,
+ packageRoot: string,
+): Promise<StudioArchive | undefined> {
+ if (profile === undefined) return undefined;
+ const host = await videoCliDistribution.openRuntimeHost(profile, { packageRoot });
+ const runtime = await host.openArchive({ readOnly: true });
+ const artifacts = await host.openArtifacts();
+ const cache = new Map<string, Awaited<ReturnType<typeof runtime.status>>>();
+ const status = async (build: string) => {
+ const held = cache.get(build);
+ if (held !== undefined) return held;
+ const fresh = await runtime.status(build);
+ cache.set(build, fresh);
+ return fresh;
+ };
+ return {
+ runtime,
+ async resolveBuildRecord(build, output) {
+ const held = await status(build);
+ const state = held.build?.state;
+ if (state === undefined) return undefined;
+ const alias = held.catalog?.aliases.find((item) => item.name === output);
+ if (alias !== undefined && alias.ref.kind !== "logical-output") {
+ throw new Error(`Build ${build} alias ${output} is an authored Record, not a Logical Output`);
+ }
+ const record = alias === undefined
+ ? selectArchivedRecord(state, { output })
+ : selectArchivedRecord(state, {
+ name: output,
+ catalog: held.catalog as NonNullable<typeof held.catalog>,
+ });
+ return { type: record.type, value: record.value };
+ },
+ async read(digest) { return await artifacts.readArtifact(digest) ?? undefined; },
+ async close() {
+ await artifacts.close();
+ await runtime.close();
+ },
+ };
+}
diff --git a/packages/studio/src/compile.ts b/packages/studio/src/compile.ts
new file mode 100644
index 00000000..099b1dd2
--- /dev/null
+++ b/packages/studio/src/compile.ts
@@ -0,0 +1,89 @@
+import { readFileSync } from "node:fs";
+
+import type { NodeCompiledSourceClosure } from "@hypit/compiler-node";
+import type { ArtifactAttachment } from "@hypit/workspace";
+
+import type { StudioDomain } from "./domain.js";
+import type { Observations } from "./observe.js";
+import { createObserver } from "./observe.js";
+
+export type ServedFile = {
+ readonly mediaType: string;
+ readonly bytes: Uint8Array;
+ readonly source?: string;
+};
+
+export type CompiledSource = {
+ readonly compiled: NodeCompiledSourceClosure;
+ readonly observations: Observations;
+ readonly served: ReadonlyMap<string, ServedFile>;
+ readonly exports: readonly { readonly name: string; readonly type: string; readonly ref: string }[];
+};
+
+export class CompileFailure extends Error {
+ readonly range: { readonly start: number; readonly end: number } | undefined;
+
+ constructor(message: string, range?: { readonly start: number; readonly end: number }) {
+ super(message);
+ this.name = "CompileFailure";
+ this.range = range;
+ }
+}
+
+async function bytesOf(attachment: ArtifactAttachment): Promise<Uint8Array> {
+ const chunks: Uint8Array[] = [];
+ let size = 0;
+ for await (const chunk of await attachment.open()) {
+ const copy = Uint8Array.from(chunk);
+ chunks.push(copy);
+ size += copy.byteLength;
+ }
+ const bytes = new Uint8Array(size);
+ let offset = 0;
+ for (const chunk of chunks) {
+ bytes.set(chunk, offset);
+ offset += chunk.byteLength;
+ }
+ return bytes;
+}
+
+/**
+ * Compile once through the official Node compiler. The observer wraps the
+ * selected Markup Surfaces only to retain source-to-output provenance.
+ */
+export async function compileSource(entryPath: string, domain: StudioDomain): Promise<CompiledSource> {
+ const observer = createObserver(domain.surfaces, (request) => {
+ const found = domain.resolveModule(request.from);
+ if (found === undefined) throw new CompileFailure(`No selected Source package satisfies ${request.from}.`);
+ return found;
+ });
+ const compiler = domain.createCompiler(observer.surfaces);
+ let compiled: NodeCompiledSourceClosure;
+ try {
+ compiled = await compiler.compileFile(entryPath);
+ } catch (error) {
+ const held = error as { readonly message?: string; readonly range?: { start: number; end: number } };
+ const last = observer.observations().placements.at(-1);
+ throw new CompileFailure(held.message ?? String(error), held.range ?? last?.range);
+ }
+ const served = new Map<string, ServedFile>();
+ for (const attachment of compiled.attachments) {
+ served.set(attachment.artifact.digest, {
+ mediaType: attachment.artifact.mediaType,
+ bytes: await bytesOf(attachment),
+ });
+ }
+ return {
+ compiled,
+ observations: observer.observations(),
+ served,
+ exports: compiled.exports.flatMap((item) => {
+ if (!("id" in item.ref)) return [];
+ return [{ name: item.name, type: item.type.name, ref: item.ref.id }];
+ }),
+ };
+}
+
+export function sourceText(path: string): string {
+ return readFileSync(path, "utf8");
+}
diff --git a/packages/studio/src/domain.ts b/packages/studio/src/domain.ts
new file mode 100644
index 00000000..eea99a55
--- /dev/null
+++ b/packages/studio/src/domain.ts
@@ -0,0 +1,123 @@
+import { loadDiscoveredSourcePackages } from "@hypit/cli";
+import { registerProducerFacets, registerTypeValidatorFacets } from "@hypit/component-kit";
+import { createResolvedClosure } from "@hypit/core";
+import { ProducerRegistry } from "@hypit/driver-node";
+import {
+ AuthorFrontendRegistry,
+ installAuthorFrontendHostFacets,
+} from "@hypit/elaborator";
+import {
+ createMarkupAuthorFrontend,
+ installMarkupSurfaceHostFacets,
+ MarkupSurfaceRegistry,
+} from "@hypit/markup";
+import type { MarkupSurfaceRegistryLike } from "@hypit/markup";
+import type { LoadedPackage, NodePackageContribution } from "@hypit/package-loader-node";
+import { ModulePackageRegistry, NodeCompiler } from "@hypit/compiler-node";
+import type { ModuleRef, ResolvedModuleClosure } from "@hypit/protocol";
+import { TypeValidatorRegistry } from "@hypit/validation";
+import { createVideoCompiler, videoCliDistribution } from "@hypit/video-cli";
+import { NodeFilesystemWorkspace } from "@hypit/workspace-fs-node";
+
+export type StudioDomain = {
+ readonly packages: readonly LoadedPackage[];
+ readonly contributions: readonly NodePackageContribution[];
+ readonly compiler: NodeCompiler;
+ readonly createCompiler: (surfaces?: MarkupSurfaceRegistryLike) => NodeCompiler;
+ readonly closure: ResolvedModuleClosure;
+ readonly surfaces: MarkupSurfaceRegistry;
+ readonly producers: ProducerRegistry;
+ readonly validators: TypeValidatorRegistry;
+ readonly resolveModule: (specifier: string) => ModuleRef | undefined;
+ readonly frontends: (surfaces?: MarkupSurfaceRegistryLike) => AuthorFrontendRegistry;
+};
+
+/**
+ * Assemble Studio from the same recursive package selection as the official CLI.
+ * The application owns this video-domain view; packages never register Studio metadata.
+ */
+export async function loadStudioDomain(input: {
+ readonly run: string;
+ readonly workspaceRoot: string;
+ readonly packageRoot: string;
+}): Promise<StudioDomain> {
+ const packages = await loadDiscoveredSourcePackages(videoCliDistribution, {
+ source: input.run,
+ workspaceRoot: input.workspaceRoot,
+ packageRoot: input.packageRoot,
+ });
+ const contributions = packages.map((item) => item.contribution);
+ const manifests = contributions.flatMap((item) =>
+ (item.modules ?? []).map((module) => module.manifest));
+ const closure = createResolvedClosure(manifests);
+
+ const modules = new Map<string, ModuleRef>();
+ const moduleRegistry = new ModulePackageRegistry();
+ for (const contribution of contributions) {
+ for (const module of contribution.modules ?? []) {
+ moduleRegistry.register(module);
+ const ref = { name: module.manifest.name, version: module.manifest.version };
+ for (const specifier of [
+ module.manifest.name,
+ `${module.manifest.name}@${module.manifest.version}`,
+ ...(module.specifiers ?? []),
+ ]) modules.set(specifier, ref);
+ }
+ }
+ const resolveModule = (specifier: string): ModuleRef | undefined => modules.get(specifier);
+ const facets = contributions.flatMap((item) => item.hostFacets ?? []);
+ const surfaces = new MarkupSurfaceRegistry();
+ installMarkupSurfaceHostFacets(facets, surfaces);
+ const domainFrontends = (registry: MarkupSurfaceRegistryLike): AuthorFrontendRegistry => {
+ const frontends = new AuthorFrontendRegistry();
+ frontends.register(createMarkupAuthorFrontend({
+ registry,
+ resolveModule(request) {
+ const found = resolveModule(request.from);
+ if (found === undefined) throw new Error(`No selected Source package satisfies ${request.from}`);
+ return found;
+ },
+ }));
+ installAuthorFrontendHostFacets(facets, frontends);
+ return frontends;
+ };
+
+ const producers = new ProducerRegistry();
+ const validators = new TypeValidatorRegistry();
+ for (const contribution of contributions) {
+ for (const component of contribution.components ?? []) {
+ registerProducerFacets(producers, component.producers ?? []);
+ registerTypeValidatorFacets(validators, component.validators ?? []);
+ }
+ }
+
+ return {
+ packages,
+ contributions,
+ compiler: createVideoCompiler({
+ workspaceRoot: input.workspaceRoot,
+ packageContributions: contributions,
+ }),
+ createCompiler(registry) {
+ if (registry === undefined) {
+ return createVideoCompiler({
+ workspaceRoot: input.workspaceRoot,
+ packageContributions: contributions,
+ });
+ }
+ const frontends = domainFrontends(registry);
+ return new NodeCompiler({
+ modules: moduleRegistry,
+ frontends,
+ validators,
+ workspace: new NodeFilesystemWorkspace({ root: input.workspaceRoot }),
+ });
+ },
+ closure,
+ surfaces,
+ producers,
+ validators,
+ resolveModule,
+ frontends(registry = surfaces) { return domainFrontends(registry); },
+ };
+}
diff --git a/packages/studio/src/execute.ts b/packages/studio/src/execute.ts
new file mode 100644
index 00000000..3db93612
--- /dev/null
+++ b/packages/studio/src/execute.ts
@@ -0,0 +1,42 @@
+import { EndpointRegistry, MemoryArtifactStore, NodeDriver } from "@hypit/driver-node";
+import type { ArtifactStore } from "@hypit/runtime";
+import type { BuildState } from "@hypit/protocol";
+
+import type { StudioDomain } from "./domain.js";
+
+export type Executed = {
+ readonly state: BuildState;
+ readonly status: string;
+ readonly unserved: readonly { readonly capability: string; readonly count: number }[];
+ readonly errors: readonly string[];
+};
+
+/** Run only deterministic Producers; Studio never installs or invokes Provider endpoints. */
+export async function executeDeterministic(
+ domain: StudioDomain,
+ planned: BuildState,
+ artifacts: ArtifactStore,
+): Promise<Executed> {
+ const result = await new NodeDriver({
+ producers: domain.producers,
+ validators: domain.validators,
+ endpoints: new EndpointRegistry(),
+ artifacts,
+ }).run(planned);
+ const counts = new Map<string, number>();
+ for (const item of result.blocked) {
+ const need = result.state.needs.find((candidate) => item.subject.includes(candidate.capability.name));
+ const name = need?.capability.name ?? item.subject;
+ counts.set(name, (counts.get(name) ?? 0) + 1);
+ }
+ return {
+ state: result.state,
+ status: result.status,
+ unserved: [...counts].map(([capability, count]) => ({ capability, count })),
+ errors: result.outcomes
+ .filter((entry) => entry.status === "error")
+ .map((entry) => entry.message ?? "a Producer failed without saying why"),
+ };
+}
+
+export { MemoryArtifactStore };
diff --git a/packages/svml-playground/src/pipeline/observe.ts b/packages/studio/src/observe.ts
similarity index 99%
rename from packages/svml-playground/src/pipeline/observe.ts
rename to packages/studio/src/observe.ts
index fbae1ab1..4ec26358 100644
--- a/packages/svml-playground/src/pipeline/observe.ts
+++ b/packages/studio/src/observe.ts
@@ -13,7 +13,7 @@ import type {
import type { ModuleRef } from "@hypit/protocol";
import { parseScript } from "@hypit/script";
-import type { Range } from "../shared.js";
+import type { Range } from "./shared.js";
/** One authored element, where it was written, and what it produced. */
export type Placement = {
diff --git a/packages/svml-playground/src/preview/render.ts b/packages/studio/src/preview/render.ts
similarity index 84%
rename from packages/svml-playground/src/preview/render.ts
rename to packages/studio/src/preview/render.ts
index 8d7f6909..ab7928ed 100644
--- a/packages/svml-playground/src/preview/render.ts
+++ b/packages/studio/src/preview/render.ts
@@ -10,7 +10,7 @@ export type RenderInput = {
readonly canvas: Composition["canvas"];
readonly space: ProgramSpace;
readonly tracks: readonly Track[];
- /** Digests the Playground can serve, for material an author already has. */
+ /** Digests Studio can serve for material selected by the Run. */
readonly served?: ReadonlySet<string>;
/** The Track whose material carries the programme's speech. */
readonly audibleTrack?: string;
@@ -20,8 +20,8 @@ export type RenderInput = {
* Compile the interpreted Tracks into the same HyperFrames document the real
* renderer photographs frame by frame, and hand it back as an `iframe` srcdoc.
*
- * Nothing is approximated here: the placement, stacking, clipping and motion are
- * the renderer's own, and only the material inside each box is a placeholder.
+ * Nothing is approximated here: placement, stacking, clipping, motion and
+ * material all come from the projection selected by the Run.
*/
export function renderPreview(input: RenderInput): string {
const document = compileHyperframesDocument(sealComposition({
@@ -36,7 +36,7 @@ export function renderPreview(input: RenderInput): string {
if (input.served?.has(artifact.digest) !== true) {
throw new Error(`Preview composition references Artifact ${artifact.digest}, which it cannot serve.`);
}
- return `/__svml/material/${artifact.digest}`;
+ return `/__studio/material/${artifact.digest}`;
});
return injectRuntimeShim(html, input.audibleTrack);
}
diff --git a/packages/svml-playground/src/preview/runtime-shim.ts b/packages/studio/src/preview/runtime-shim.ts
similarity index 57%
rename from packages/svml-playground/src/preview/runtime-shim.ts
rename to packages/studio/src/preview/runtime-shim.ts
index 650b3ffd..6584e413 100644
--- a/packages/svml-playground/src/preview/runtime-shim.ts
+++ b/packages/studio/src/preview/runtime-shim.ts
@@ -25,10 +25,32 @@ function shim(audibleTrack: string | undefined): string {
var fps = slash === -1
? parseFloat(fpsAttr)
: parseFloat(fpsAttr.slice(0, slash)) / parseFloat(fpsAttr.slice(slash + 1));
+ var frameSeconds = 1 / fps;
+ var currentSeconds = 0;
+ var playing = false;
+ var playbackFrame = 0;
+ var playbackStartedAt = 0;
+ var playbackHandle = 0;
+ var programmeDuration = 0;
+ var visualClips = [];
if (root) {
root.style.width = (root.getAttribute('data-width') || '0') + 'px';
root.style.height = (root.getAttribute('data-height') || '0') + 'px';
}
+ var clipNodes = document.querySelectorAll('.hypit-visual-present');
+ for (var clipIndex = 0; clipIndex < clipNodes.length; clipIndex++) {
+ var clipNode = clipNodes[clipIndex];
+ var clipStart = parseFloat(clipNode.getAttribute('data-start') || '0') || 0;
+ var clipDuration = parseFloat(clipNode.getAttribute('data-duration') || '0') || 0;
+ programmeDuration = Math.max(programmeDuration, clipStart + clipDuration);
+ visualClips.push({
+ element: clipNode,
+ start: clipStart,
+ duration: clipDuration,
+ videos: clipNode.querySelectorAll('video'),
+ track: clipNode.getAttribute('data-hypit-track-id')
+ });
+ }
/**
* Place the composition at one instant.
*
@@ -40,29 +62,36 @@ function shim(audibleTrack: string | undefined): string {
* while the transport insisted it was keeping time.
*/
function apply(seconds, scrubbing) {
- var clips = document.querySelectorAll('.hypit-visual-present');
- for (var i = 0; i < clips.length; i++) {
- var clip = clips[i];
- var start = parseFloat(clip.getAttribute('data-start') || '0') || 0;
- var duration = parseFloat(clip.getAttribute('data-duration') || '0') || 0;
- var local = seconds - start;
- var inside = local >= 0 && local < duration;
+ currentSeconds = Math.max(0, seconds);
+ for (var i = 0; i < visualClips.length; i++) {
+ var record = visualClips[i];
+ var clip = record.element;
+ var local = seconds - record.start;
+ var inside = local >= 0 && local < record.duration;
+ var lastFrame = inside && local >= record.duration - frameSeconds - 0.000001;
clip.style.visibility = inside ? 'visible' : 'hidden';
- var media = clip.querySelectorAll('video');
+ var media = record.videos;
for (var m = 0; m < media.length; m++) {
var element = media[m];
var mediaStart = parseFloat(element.getAttribute('data-media-start') || '0') || 0;
var rate = parseFloat(element.getAttribute('data-playback-rate') || '1') || 1;
- var target = mediaStart + Math.max(0, local) * rate;
+ // Seek the centre of the requested source frame. An exact frame
+ // boundary lets the decoder choose either neighbouring picture.
+ var target = mediaStart + (Math.max(0, local) + frameSeconds / 2) * rate;
+ if (Number.isFinite(element.duration) && element.duration > 0) {
+ target = Math.min(target, Math.max(0, element.duration - 0.001));
+ }
// HyperFrames renders a silent picture, because programme audio is a
// separate Track the media pipeline muxes in. A preview is not a
// render, and placing B-roll against speech means hearing the speech,
// so the Spine's own material is allowed to sound.
- var track = clip.getAttribute('data-hypit-track-id');
- element.muted = muted || scrubbing || audible === null || track !== audible;
+ element.muted = muted || scrubbing || audible === null || record.track !== audible;
try {
if (!inside) { element.pause(); continue; }
- if (scrubbing) { element.pause(); element.currentTime = target; continue; }
+ // Do not let a video run through its media end. Some decoders expose
+ // the first decoded picture again after ended; pinning the final
+ // Program frame keeps the Segment transition frame-pure.
+ if (scrubbing || lastFrame) { element.pause(); element.currentTime = target; continue; }
// Quarter of a second is below the threshold of noticing and well
// above the jitter of a decoder keeping its own time.
if (Math.abs(element.currentTime - target) > 0.25) element.currentTime = target;
@@ -75,9 +104,31 @@ function shim(audibleTrack: string | undefined): string {
// flow from their sampled timelines.
window.dispatchEvent(new CustomEvent('hf-seek', { detail: { time: seconds } }));
}
- window.__svmlSetMuted = function (value) { muted = !!value; };
- window.__svmlSeekFrame = function (frame) { apply(frame / fps, true); };
- window.__svmlPlayFrame = function (frame) { apply(frame / fps, false); };
+ function stopClock() {
+ playing = false;
+ if (playbackHandle) cancelAnimationFrame(playbackHandle);
+ playbackHandle = 0;
+ }
+ function tick(now) {
+ if (!playing) return;
+ var seconds = playbackFrame / fps + Math.max(0, now - playbackStartedAt) / 1000;
+ if (programmeDuration > 0 && seconds >= programmeDuration) {
+ apply(Math.max(0, programmeDuration - frameSeconds), true);
+ stopClock();
+ return;
+ }
+ apply(seconds, false);
+ playbackHandle = requestAnimationFrame(tick);
+ }
+ window.__hypitSetMuted = function (value) {
+ muted = !!value;
+ apply(currentSeconds, !playing);
+ };
+ window.__hypitSeekFrame = function (frame) {
+ stopClock();
+ apply(frame / fps, true);
+ };
+ window.__hypitPlayFrame = function (frame) { apply(frame / fps, false); };
apply(0, true);
window.addEventListener('load', function () { apply(0, true); });
})();
diff --git a/packages/studio/src/programme.ts b/packages/studio/src/programme.ts
new file mode 100644
index 00000000..b6275014
--- /dev/null
+++ b/packages/studio/src/programme.ts
@@ -0,0 +1,230 @@
+import type { ArtifactAttachment } from "@hypit/workspace";
+import type { Digest, StoredValue } from "@hypit/protocol";
+
+import type { StudioArchive } from "./archive.js";
+import type { CompiledSource, ServedFile } from "./compile.js";
+import type { StudioDomain } from "./domain.js";
+import { executeDeterministic, MemoryArtifactStore } from "./execute.js";
+import type { RunPlan } from "./run.js";
+
+const PLAYABLE = new Set(["VisualTrack", "AudioTrack"]);
+const TIMING = "CompleteSemanticMap";
+
+export type BuiltTrack = {
+ readonly name: string;
+ readonly type: string;
+ readonly outputRef: string;
+ readonly candidateId?: string;
+ readonly candidateOrigin: "run" | "source" | "none";
+ readonly track: unknown;
+};
+
+export type Preview = {
+ readonly source: CompiledSource;
+ readonly tracks: readonly BuiltTrack[];
+ readonly timing: "measured";
+ readonly timingOutput?: { readonly name: string; readonly ref: string };
+ readonly timingCandidateId?: string;
+ readonly timingCandidateOrigin: "run" | "source" | "none";
+ readonly served: ReadonlyMap<string, ServedFile>;
+ readonly canvas: { readonly width: number; readonly height: number; readonly clearColor: string };
+ readonly frameRate: { readonly numerator: number; readonly denominator: number };
+ readonly space: unknown;
+ readonly anchors: ReadonlyMap<string, number>;
+ readonly tokens: readonly {
+ readonly id: string;
+ readonly startAnchorId: string;
+ readonly endAnchorId: string;
+ }[];
+};
+
+function inlineRecord(compiled: unknown, id: string): unknown {
+ const records = (compiled as {
+ readonly program: {
+ readonly records: readonly { readonly id: string; readonly value: StoredValue }[];
+ };
+ }).program.records;
+ const found = records.find((record) => record.id === id);
+ return found?.value.kind === "inline" ? found.value.value : undefined;
+}
+
+function canvasOf(compiled: unknown): { width: number; height: number; clearColor: string } {
+ const records = (compiled as {
+ readonly program: { readonly records: readonly { readonly value: StoredValue }[] };
+ }).program.records;
+ let clearColor = "#000000";
+ let size: { width: number; height: number } | undefined;
+ for (const record of records) {
+ if (record.value.kind !== "inline") continue;
+ const held = record.value.value as {
+ readonly contract?: string;
+ readonly widthPx?: number;
+ readonly heightPx?: number;
+ readonly clearColor?: string;
+ readonly canvas?: { readonly clearColor?: string };
+ };
+ clearColor = held.clearColor ?? held.canvas?.clearColor ?? clearColor;
+ if (held.contract === "hypit.canvas-space@1"
+ && typeof held.widthPx === "number" && typeof held.heightPx === "number") {
+ size = { width: held.widthPx, height: held.heightPx };
+ }
+ }
+ return { ...(size ?? { width: 1080, height: 1920 }), clearColor };
+}
+
+async function bytesOf(attachment: ArtifactAttachment): Promise<Uint8Array> {
+ const chunks: Uint8Array[] = [];
+ let size = 0;
+ for await (const chunk of await attachment.open()) {
+ const copy = Uint8Array.from(chunk);
+ chunks.push(copy);
+ size += copy.byteLength;
+ }
+ const bytes = new Uint8Array(size);
+ let offset = 0;
+ for (const chunk of chunks) {
+ bytes.set(chunk, offset);
+ offset += chunk.byteLength;
+ }
+ return bytes;
+}
+
+type ExecutionState = Awaited<ReturnType<typeof executeDeterministic>>["state"];
+
+function selectedValue(state: ExecutionState, output: string): StoredValue | undefined {
+ const selection = state.plan.selections.find((item) => item.output === output);
+ if (selection === undefined) return undefined;
+ return state.records.find((item) => item.id === selection.record)?.value
+ ?? state.program.records.find((item) => item.id === selection.record)?.value;
+}
+
+function programSpace(values: readonly StoredValue[]): unknown {
+ for (const stored of values) {
+ if (stored.kind !== "inline") continue;
+ const value = stored.value as {
+ readonly durationSec?: unknown;
+ readonly frameRate?: { readonly numerator?: unknown; readonly denominator?: unknown };
+ };
+ if (typeof value.durationSec === "number"
+ && typeof value.frameRate?.numerator === "number"
+ && typeof value.frameRate.denominator === "number") return value;
+ }
+ throw new Error("Studio projection produced no ProgramSpace.");
+}
+
+/** Build only the Studio-approved deterministic projection of one explicit Run. */
+export async function preview(input: {
+ readonly source: CompiledSource;
+ readonly run: RunPlan;
+ readonly domain: StudioDomain;
+ readonly outputRefs: readonly string[];
+ readonly archive?: StudioArchive;
+}): Promise<Preview> {
+ const targets = input.source.exports.filter((item) => input.outputRefs.includes(item.ref));
+ const store = new MemoryArtifactStore();
+ const served = new Map(input.source.served);
+ for (const attachment of input.run.attachments) {
+ const bytes = await bytesOf(attachment);
+ await store.put(bytes, attachment.artifact.mediaType);
+ served.set(attachment.artifact.digest, {
+ mediaType: attachment.artifact.mediaType,
+ bytes,
+ });
+ }
+ for (const [, file] of input.source.served) await store.put(file.bytes, file.mediaType);
+ const artifacts = {
+ async get(digest: Digest) {
+ const local = await store.get(digest);
+ if (local !== undefined) return local;
+ const archived = await input.archive?.read(digest);
+ if (archived !== undefined) {
+ served.set(digest, { mediaType: "application/octet-stream", bytes: archived });
+ }
+ return archived;
+ },
+ async put(bytes: Uint8Array, mediaType: string) {
+ const ref = await store.put(bytes, mediaType);
+ served.set(ref.digest, { mediaType, bytes });
+ return ref;
+ },
+ async has(digest: Digest) {
+ return await store.has(digest) || await input.archive?.read(digest) !== undefined;
+ },
+ };
+ const planned = input.run.plan(input.run.run, targets.map((target) => target.ref));
+ const executed = await executeDeterministic(input.domain, planned.state, artifacts);
+ if (executed.unserved.length > 0) {
+ throw new Error(
+ `Studio projection is unresolved: ${executed.unserved.map((item) => item.capability).join(", ")}`,
+ );
+ }
+ if (executed.errors.length > 0) throw new Error(executed.errors.join("\n"));
+
+ const satisfactions = new Map(
+ input.run.run.graph.satisfactions.map((item) => [item.output, item.candidate]),
+ );
+ const values = targets
+ .map((target) => selectedValue(executed.state, target.ref))
+ .filter((value): value is StoredValue => value !== undefined);
+ const timingOutput = targets.find((target) => target.type === TIMING);
+ const timingValue = timingOutput === undefined
+ ? undefined
+ : selectedValue(executed.state, timingOutput.ref);
+ if (timingOutput === undefined || timingValue?.kind !== "inline") {
+ throw new Error("Studio requires a resolved CompleteSemanticMap projection.");
+ }
+ const map = timingValue.value as {
+ readonly anchors?: readonly { readonly identity: string; readonly frame: number }[];
+ };
+ const anchors = new Map((map.anchors ?? []).map((anchor) => [anchor.identity, anchor.frame]));
+ const narrative = input.source.exports.find((item) => item.type === "Narrative");
+ const narrativeValue = narrative === undefined ? undefined : inlineRecord(
+ input.source.compiled,
+ narrative.ref,
+ ) as {
+ readonly tokens?: readonly {
+ readonly id: string;
+ readonly startAnchorId: string;
+ readonly endAnchorId: string;
+ }[];
+ } | undefined;
+ const space = programSpace([
+ ...values,
+ ...executed.state.records.map((item) => item.value),
+ ...executed.state.program.records.map((item) => item.value),
+ ]);
+ const rate = (space as {
+ readonly frameRate: { readonly numerator: number; readonly denominator: number };
+ }).frameRate;
+ const tracks: BuiltTrack[] = targets.flatMap((target) => {
+ if (!PLAYABLE.has(target.type)) return [];
+ const stored = selectedValue(executed.state, target.ref);
+ const candidateId = satisfactions.get(target.ref);
+ if (stored?.kind !== "inline") {
+ throw new Error(`Studio projection ${target.name} did not produce an inline Track.`);
+ }
+ return [{
+ name: target.name,
+ type: target.type,
+ outputRef: target.ref,
+ ...(candidateId === undefined ? {} : { candidateId }),
+ candidateOrigin: candidateId === undefined ? "source" as const : "run" as const,
+ track: stored.value,
+ }];
+ });
+ const timingCandidateId = satisfactions.get(timingOutput.ref);
+ return {
+ source: input.source,
+ tracks,
+ timing: "measured",
+ timingOutput: { name: timingOutput.name, ref: timingOutput.ref },
+ ...(timingCandidateId === undefined ? {} : { timingCandidateId }),
+ timingCandidateOrigin: timingCandidateId === undefined ? "source" : "run",
+ served,
+ canvas: canvasOf(input.source.compiled),
+ frameRate: rate,
+ space,
+ anchors,
+ tokens: narrativeValue?.tokens ?? [],
+ };
+}
diff --git a/packages/studio/src/run.ts b/packages/studio/src/run.ts
new file mode 100644
index 00000000..818b5d02
--- /dev/null
+++ b/packages/studio/src/run.ts
@@ -0,0 +1,74 @@
+import type { PlannedBuild } from "@hypit/compiler-node";
+import { NodeRunCompiler } from "@hypit/compiler-node";
+import type { Candidate, OperationNode, Satisfaction, BuildTarget } from "@hypit/protocol";
+import type { ArtifactAttachment } from "@hypit/workspace";
+import {
+ installRunFragmentHostFacets,
+ runFrontendsFromHostFacets,
+ RunFragmentRegistry,
+ RunFrontendRegistry,
+} from "@hypit/run";
+
+import type { StudioArchive } from "./archive.js";
+import type { StudioDomain } from "./domain.js";
+
+export type RunCompilation = {
+ readonly graph: {
+ readonly candidates: readonly Candidate[];
+ readonly operations: readonly OperationNode[];
+ readonly satisfactions: readonly Satisfaction[];
+ readonly targets: readonly BuildTarget[];
+ };
+};
+
+export type RunPlan = {
+ readonly authorSource: string;
+ readonly run: RunCompilation;
+ readonly targets: readonly string[];
+ readonly attachments: readonly ArtifactAttachment[];
+ readonly plan: (run: RunCompilation, targets: readonly string[]) => PlannedBuild;
+};
+
+/** Compile the exact Run Source selected for Studio, using normal Run facets. */
+export async function loadStudioRun(input: {
+ readonly run: string;
+ readonly domain: StudioDomain;
+ readonly archive?: StudioArchive;
+}): Promise<RunPlan> {
+ const fragments = new RunFragmentRegistry();
+ const frontends = new RunFrontendRegistry();
+ for (const contribution of input.domain.contributions) {
+ installRunFragmentHostFacets(contribution.hostFacets ?? [], fragments);
+ for (const frontend of runFrontendsFromHostFacets(contribution.hostFacets ?? [])) {
+ frontends.register(frontend);
+ }
+ }
+ const compiler = new NodeRunCompiler({
+ authorCompiler: input.domain.compiler,
+ fragments,
+ frontends,
+ ...(input.archive === undefined ? {} : {
+ resolveBuildRecord: input.archive.resolveBuildRecord,
+ }),
+ });
+ const compiled = await compiler.compileFile(input.run);
+ const targets = compiled.run.graph.targets.map((target) => target.output);
+ return {
+ authorSource: compiled.authorSource,
+ run: compiled.run as RunCompilation,
+ targets,
+ attachments: compiled.attachments,
+ plan(run, selected) {
+ return compiler.planCompilation({
+ ...compiled,
+ run: {
+ ...compiled.run,
+ graph: {
+ ...run.graph,
+ targets: selected.map((output) => ({ output })),
+ },
+ },
+ } as never);
+ },
+ };
+}
diff --git a/packages/studio/src/server.ts b/packages/studio/src/server.ts
new file mode 100644
index 00000000..b4eff8fa
--- /dev/null
+++ b/packages/studio/src/server.ts
@@ -0,0 +1,149 @@
+import { writeFile } from "node:fs/promises";
+import { resolve } from "node:path";
+
+import type { Plugin, ViteDevServer } from "vite";
+
+import type { StudioArchive } from "./archive.js";
+import type { ServedFile } from "./compile.js";
+import type { StudioDomain } from "./domain.js";
+import type { RunPlan } from "./run.js";
+import { readStudioSession } from "./session.js";
+import type { Range, StudioFailure, StudioSnapshot } from "./shared.js";
+
+export type StudioPluginOptions = {
+ readonly source: string;
+ readonly runPath: string;
+ readonly domain: StudioDomain;
+ readonly run: RunPlan;
+ readonly archive?: StudioArchive;
+};
+
+function json(response: import("node:http").ServerResponse, status: number, value: unknown): void {
+ response.statusCode = status;
+ response.setHeader("content-type", "application/json; charset=utf-8");
+ response.setHeader("cache-control", "no-store");
+ response.end(`${JSON.stringify(value)}\n`);
+}
+
+function rangeOf(error: unknown): Range | undefined {
+ if (typeof error !== "object" || error === null) return undefined;
+ const range = (error as { readonly range?: unknown }).range;
+ if (typeof range === "object" && range !== null && "start" in range && "end" in range) {
+ return range as Range;
+ }
+ const offset = (error as { readonly offset?: unknown }).offset;
+ return typeof offset === "number" && Number.isFinite(offset)
+ ? { start: offset, end: offset + 1 }
+ : undefined;
+}
+
+export function studioPlugin(options: StudioPluginOptions): Plugin {
+ let snapshot: StudioSnapshot | undefined;
+ let failure: StudioFailure | undefined;
+ let material: ReadonlyMap<string, ServedFile> = new Map();
+ let revision = 0;
+ let server: ViteDevServer | undefined;
+ let timer: ReturnType<typeof setTimeout> | undefined;
+
+ const publish = async (): Promise<void> => {
+ revision += 1;
+ try {
+ const result = await readStudioSession({
+ source: options.source,
+ domain: options.domain,
+ run: options.run,
+ ...(options.archive === undefined ? {} : { archive: options.archive }),
+ revision,
+ });
+ snapshot = result.snapshot;
+ material = result.material;
+ failure = undefined;
+ server?.ws.send({ type: "custom", event: "studio:snapshot", data: snapshot });
+ } catch (error) {
+ const range = rangeOf(error);
+ failure = {
+ revision,
+ error: error instanceof Error ? error.message : String(error),
+ ...(range === undefined ? {} : { range }),
+ };
+ server?.ws.send({ type: "custom", event: "studio:error", data: failure });
+ }
+ };
+
+ const schedule = (): void => {
+ if (timer !== undefined) clearTimeout(timer);
+ timer = setTimeout(() => void publish(), 80);
+ };
+
+ return {
+ name: "hypit-studio",
+ configureServer(value) {
+ server = value;
+ value.watcher.add([options.source, options.runPath]);
+ value.watcher.on("change", (path) => {
+ const changed = resolve(path);
+ if (changed === options.source || changed === options.runPath || path.endsWith(".svs")) schedule();
+ });
+ value.middlewares.use((request, response, next) => {
+ const url = new URL(request.url ?? "/", "http://studio.hypit.local");
+ if (request.method === "PUT" && url.pathname === "/__studio/source") {
+ void (async () => {
+ try {
+ const chunks: Buffer[] = [];
+ for await (const chunk of request) chunks.push(Buffer.from(chunk));
+ const body = JSON.parse(Buffer.concat(chunks).toString("utf8")) as {
+ readonly text?: unknown;
+ readonly revision?: unknown;
+ };
+ if (typeof body.text !== "string" || typeof body.revision !== "number") {
+ json(response, 400, { error: "Expected source text and revision." });
+ return;
+ }
+ if (snapshot !== undefined && body.revision !== snapshot.revision) {
+ json(response, 409, { error: "The Source changed outside Studio." });
+ return;
+ }
+ await writeFile(options.source, body.text, "utf8");
+ await publish();
+ response.statusCode = 202;
+ response.end();
+ } catch (error) {
+ json(response, 500, { error: error instanceof Error ? error.message : String(error) });
+ }
+ })();
+ return;
+ }
+ if (request.method !== "GET" && request.method !== "HEAD") {
+ next();
+ return;
+ }
+ if (url.pathname === "/__studio/session") {
+ void (async () => {
+ if (snapshot === undefined && failure === undefined) await publish();
+ if (snapshot !== undefined) json(response, 200, snapshot);
+ else json(response, 500, failure);
+ })();
+ return;
+ }
+ const digest = /^\/__studio\/material\/(sha256:[a-f0-9]{64})$/u.exec(url.pathname)?.[1];
+ if (digest !== undefined) {
+ const file = material.get(digest);
+ if (file === undefined) {
+ response.statusCode = 404;
+ response.end();
+ return;
+ }
+ response.statusCode = 200;
+ response.setHeader("content-type", file.mediaType);
+ response.setHeader("cache-control", "no-store");
+ response.setHeader("accept-ranges", "bytes");
+ if (request.method === "HEAD") response.end();
+ else response.end(Buffer.from(file.bytes));
+ return;
+ }
+ next();
+ });
+ },
+ async closeBundle() { await options.archive?.close(); },
+ };
+}
diff --git a/packages/studio/src/session.ts b/packages/studio/src/session.ts
new file mode 100644
index 00000000..312a7799
--- /dev/null
+++ b/packages/studio/src/session.ts
@@ -0,0 +1,70 @@
+import { readFileSync } from "node:fs";
+
+import type { StudioArchive } from "./archive.js";
+import { compileSource } from "./compile.js";
+import type { ServedFile } from "./compile.js";
+import type { StudioDomain } from "./domain.js";
+import type { Observations } from "./observe.js";
+import { preview } from "./programme.js";
+import { renderPreview } from "./preview/render.js";
+import type { RunPlan } from "./run.js";
+import type { StudioSnapshot } from "./shared.js";
+import { snapshot } from "./snapshot.js";
+import { inspectStudioRun } from "./studio-preflight.js";
+import type { StudioProjection } from "./studio-preflight.js";
+
+export type StudioSession = {
+ readonly snapshot: StudioSnapshot;
+ readonly material: ReadonlyMap<string, ServedFile>;
+ readonly observations: Observations;
+ readonly projections: readonly StudioProjection[];
+};
+
+export async function readStudioSession(input: {
+ readonly source: string;
+ readonly domain: StudioDomain;
+ readonly run: RunPlan;
+ readonly archive?: StudioArchive;
+ readonly revision: number;
+}): Promise<StudioSession> {
+ const source = await compileSource(input.source, input.domain);
+ const inspection = inspectStudioRun(source, input.run);
+ const outputRefs = inspection.projections.map((projection) => projection.ref);
+ const built = await preview({
+ source,
+ run: input.run,
+ domain: input.domain,
+ outputRefs,
+ ...(input.archive === undefined ? {} : { archive: input.archive }),
+ });
+ const tracks = built.tracks
+ .map((track) => track.track)
+ .filter((track): track is object => track !== undefined);
+ const rendered = renderPreview({
+ id: "studio-preview",
+ canvas: built.canvas,
+ space: built.space as never,
+ tracks: tracks as never,
+ served: new Set(built.served.keys()),
+ ...(audible(built) === undefined ? {} : { audibleTrack: audible(built)! }),
+ });
+ const text = readFileSync(input.source, "utf8");
+ return {
+ snapshot: snapshot(built, {
+ revision: input.revision,
+ path: input.source,
+ text,
+ canvas: built.canvas,
+ frameRate: built.frameRate,
+ preview: { kind: "hyperframes", srcdoc: rendered },
+ }),
+ material: built.served,
+ observations: source.observations,
+ projections: inspection.projections,
+ };
+}
+
+function audible(built: Awaited<ReturnType<typeof preview>>): string | undefined {
+ const found = built.tracks.find((track) => track.type === "AudioTrack" && track.track !== undefined);
+ return found === undefined ? undefined : (found.track as { readonly id?: string }).id;
+}
diff --git a/packages/svml-playground/src/shared.ts b/packages/studio/src/shared.ts
similarity index 62%
rename from packages/svml-playground/src/shared.ts
rename to packages/studio/src/shared.ts
index 80d3c405..6fabf2a3 100644
--- a/packages/svml-playground/src/shared.ts
+++ b/packages/studio/src/shared.ts
@@ -6,6 +6,23 @@
/** UTF-16 offsets into the exact source text carried by the snapshot. */
export type Range = { readonly start: number; readonly end: number };
+export type CandidateOrigin = "run" | "source" | "none";
+export type CandidateStatus = "resolved" | "unresolved";
+
+/**
+ * The graph edge that made a Studio projection exist. This is deliberately
+ * small: it identifies the Run output and candidate without pulling the whole
+ * build graph or artifact history into the browser.
+ */
+export type CandidateProvenance = {
+ readonly output: string;
+ readonly outputRef?: string;
+ readonly candidateId?: string;
+ readonly origin: CandidateOrigin;
+ readonly status: CandidateStatus;
+ readonly errors: readonly string[];
+};
+
/**
* One Visual Present, which is the whole of what a Track says about a picture:
* an identity, a span and where it sits in the stack. The box it paints into is
@@ -24,12 +41,6 @@ export type Clip = {
readonly endFrameExclusive: number;
/** Where that authored tag was written. */
readonly elementRange?: Range;
- /**
- * What is actually on screen for this clip. Absent means the material the
- * Source names; otherwise the shot has not been made and this says what was
- * put there instead.
- */
- readonly standIn?: "picture" | "black";
readonly stackOrder: number;
};
@@ -39,16 +50,8 @@ export type Track = {
/** Render order in the timeline; 0 is the top row. */
readonly row: number;
readonly clips: readonly Clip[];
- /** Capabilities this machine could not answer, when the Track has no picture. */
- readonly waiting?: readonly string[];
- /**
- * Where this Track's own picture came from. `made` is the material the Source
- * names; `stand-in` is a picture it named for a shot nobody has made; `black`
- * is neither. A Track drawn from more than one is reported by its weakest.
- */
- readonly source: "made" | "stand-in" | "black" | "waiting";
- /** Whether this Track's times were supplied or estimated. */
- readonly timing: "measured" | "estimated";
+ /** Which resolved Run candidate produced this Track, or why it did not. */
+ readonly provenance: CandidateProvenance;
};
export type ScriptMap = {
@@ -74,10 +77,7 @@ export type ScriptMap = {
readonly id: string;
readonly occurrences: readonly { readonly occurrence: number; readonly range: Range }[];
}[];
- /**
- * Spoken words placed on the timeline. Whether these are measured or estimated
- * is the snapshot's `provenance.timing`.
- */
+ /** Spoken words placed on the timeline by the selected semantic Candidate. */
readonly tokens: readonly {
readonly id: string;
readonly range: Range;
@@ -86,12 +86,51 @@ export type ScriptMap = {
}[];
};
-export type PlaygroundSnapshot = {
+/** A semantic boundary that can be addressed by the timeline without guessing. */
+export type SemanticAnchorKind =
+ | "segment-start"
+ | "segment-end"
+ | "token-start"
+ | "token-end";
+
+export type SemanticAnchor = {
+ readonly id: string;
+ readonly kind: SemanticAnchorKind;
+ readonly frame: number;
+ readonly segmentId: string;
+ readonly tokenId?: string;
+};
+
+export type SemanticSegment = {
+ readonly id: string;
+ readonly startFrame: number;
+ readonly endFrameExclusive: number;
+ readonly range?: Range;
+};
+
+export type SemanticToken = {
+ readonly id: string;
+ readonly segmentId: string;
+ readonly text: string;
+ readonly startFrame: number;
+ readonly endFrameExclusive: number;
+ readonly range?: Range;
+};
+
+/** The semantic timebase projected from the compiled Narrative and its anchors. */
+export type SemanticTimeline = {
+ readonly anchors: readonly SemanticAnchor[];
+ readonly segments: readonly SemanticSegment[];
+ readonly tokens: readonly SemanticToken[];
+ /** The CompleteSemanticMap candidate that supplied these frame anchors. */
+ readonly provenance: CandidateProvenance;
+};
+
+export type StudioSnapshot = {
readonly revision: number;
readonly source: {
readonly path: string;
readonly text: string;
- readonly digest: string;
};
readonly script?: ScriptMap;
readonly space: {
@@ -103,6 +142,11 @@ export type PlaygroundSnapshot = {
readonly durationSec: number;
};
readonly tracks: readonly Track[];
+ /**
+ * The special Studio lane. This is not another VisualTrack: it is the
+ * Narrative's segment/word geometry projected onto the same frame domain.
+ */
+ readonly semantic?: SemanticTimeline;
/**
* The picture, ready to mount. Real material is the base layer rather than the
* whole picture: the Tracks above it have not been rendered into that file, so
@@ -112,30 +156,14 @@ export type PlaygroundSnapshot = {
readonly preview: { readonly kind: "hyperframes"; readonly srcdoc: string };
readonly provenance: {
/** Where the timeline came from. The frame domain always shares its source. */
- readonly timing: "measured" | "estimated";
- /**
- * Whether the picture is real material. `partial` when some elements have
- * their footage and others are still placeholders, which is the normal
- * state part-way through a production.
- */
- readonly picture: "measured" | "estimated";
+ readonly timing: "measured";
+ readonly picture: "measured";
/** What the badges above are standing for, in one sentence. */
readonly note: string;
};
- /**
- * Material an author supplied that the preview will not show, and why. A
- * placeholder next to a file they know exists reads as a bug otherwise.
- */
- readonly refused: readonly { readonly output: string; readonly reason: string }[];
- /**
- * Why a Track has no value. A Producer that failed already said why, and a
- * plan that produced nothing knows which output it was; without this every
- * cause reads as the same silent absence.
- */
- readonly errors: readonly string[];
};
-export type PlaygroundFailure = {
+export type StudioFailure = {
readonly revision: number;
readonly error: string;
/** Points the code pane at the offending element when the interpreter knows it. */
diff --git a/packages/svml-playground/src/pipeline/snapshot.ts b/packages/studio/src/snapshot.ts
similarity index 64%
rename from packages/svml-playground/src/pipeline/snapshot.ts
rename to packages/studio/src/snapshot.ts
index 0ba38347..d668e397 100644
--- a/packages/svml-playground/src/pipeline/snapshot.ts
+++ b/packages/studio/src/snapshot.ts
@@ -6,9 +6,17 @@
* timeline is assembled without knowing what made any of it, and a package that
* grows a new Track shows up without this file changing.
*/
-import type { Clip, PlaygroundSnapshot, Range, ScriptMap, Track } from "../shared.js";
+import type {
+ CandidateProvenance,
+ Clip,
+ StudioSnapshot,
+ Range,
+ ScriptMap,
+ SemanticTimeline,
+ Track,
+} from "./shared.js";
import type { Placement } from "./observe.js";
-import type { Preview } from "./preview.js";
+import type { Preview } from "./programme.js";
type Present = {
readonly id: string;
@@ -111,25 +119,107 @@ function scriptMap(
};
}
-/** The element an output belongs to: `take-opening.video` is `take-opening`. */
+type NarrativeValue = {
+ readonly segments?: readonly {
+ readonly id: string;
+ readonly startAnchorId: string;
+ readonly endAnchorId: string;
+ }[];
+ readonly tokens?: readonly {
+ readonly id: string;
+ readonly segmentId: string;
+ readonly startAnchorId: string;
+ readonly endAnchorId: string;
+ readonly text: string;
+ }[];
+ readonly semanticIndex?: {
+ readonly anchors?: readonly {
+ readonly id: string;
+ readonly kind: "segment-start" | "segment-end" | "token-start" | "token-end";
+ readonly segmentId: string;
+ readonly tokenId?: string;
+ }[];
+ };
+};
+
+function inlineRecord(compiled: unknown, id: string): unknown {
+ const records = (compiled as {
+ readonly program: {
+ readonly records: readonly { readonly id: string; readonly value: { readonly kind: string; readonly value?: unknown } }[];
+ };
+ }).program.records;
+ const found = records.find((record) => record.id === id);
+ return found?.value.kind === "inline" ? found.value.value : undefined;
+}
+
/**
- * Whether this clip is showing a stand-in. A Present is named after what made
- * it, so either the tag that drew it or the identity itself says which shot it
- * came from.
+ * Project the compiled Narrative into the frame domain that the preview is
+ * already using. No frontend timing is invented here: if an anchor is absent
+ * from the built map, the corresponding item is simply not drawable yet.
*/
-function standInFor(
- presentId: string,
- elementId: string | undefined,
- standIns: ReadonlyMap<string, "picture" | "black">,
-): "picture" | "black" | undefined {
- if (elementId !== undefined && standIns.has(elementId)) return standIns.get(elementId);
- for (const part of presentId.split(/[:#+]/u)) {
- const held = standIns.get(part);
- if (held !== undefined) return held;
- }
- return undefined;
+function semanticTimeline(built: Preview, script: ScriptMap | undefined): SemanticTimeline | undefined {
+ const exported = built.source.exports.find((item) => item.type === "Narrative");
+ if (exported === undefined) return undefined;
+ const narrative = inlineRecord(built.source.compiled, exported.ref) as NarrativeValue | undefined;
+ if (narrative === undefined) return undefined;
+
+ const segmentRanges = new Map((script?.segments ?? []).map((item) => [item.id, item.range]));
+ const tokenRanges = new Map((script?.tokens ?? []).map((item) => [item.id, item.range]));
+ const frame = (id: string): number | undefined => built.anchors.get(id);
+
+ const segments = (narrative.segments ?? []).flatMap((segment) => {
+ const startFrame = frame(segment.startAnchorId);
+ const endFrame = frame(segment.endAnchorId);
+ if (startFrame === undefined || endFrame === undefined) return [];
+ return [{
+ id: segment.id,
+ startFrame,
+ endFrameExclusive: Math.max(startFrame + 1, endFrame),
+ ...(segmentRanges.has(segment.id) ? { range: segmentRanges.get(segment.id)! } : {}),
+ }];
+ });
+ const tokens = (narrative.tokens ?? []).flatMap((token) => {
+ const startFrame = frame(token.startAnchorId);
+ const endFrame = frame(token.endAnchorId);
+ if (startFrame === undefined || endFrame === undefined) return [];
+ return [{
+ id: token.id,
+ segmentId: token.segmentId,
+ text: token.text,
+ startFrame,
+ endFrameExclusive: Math.max(startFrame + 1, endFrame),
+ ...(tokenRanges.has(token.id) ? { range: tokenRanges.get(token.id)! } : {}),
+ }];
+ });
+ const anchors = (narrative.semanticIndex?.anchors ?? []).flatMap((anchor) => {
+ const at = frame(anchor.id);
+ if (at === undefined) return [];
+ return [{
+ id: anchor.id,
+ kind: anchor.kind,
+ frame: at,
+ segmentId: anchor.segmentId,
+ ...(anchor.tokenId === undefined ? {} : { tokenId: anchor.tokenId }),
+ }];
+ });
+ if (segments.length === 0 && tokens.length === 0) return undefined;
+ const provenance: CandidateProvenance = {
+ output: built.timingOutput?.name ?? "CompleteSemanticMap",
+ ...(built.timingOutput?.ref === undefined ? {} : { outputRef: built.timingOutput.ref }),
+ ...(built.timingCandidateId === undefined ? {} : { candidateId: built.timingCandidateId }),
+ origin: built.timingCandidateOrigin,
+ status: "resolved",
+ errors: [],
+ };
+ return {
+ anchors: anchors.sort((left, right) => left.frame - right.frame || left.id.localeCompare(right.id)),
+ segments: segments.sort((left, right) => left.startFrame - right.startFrame || left.id.localeCompare(right.id)),
+ tokens: tokens.sort((left, right) => left.startFrame - right.startFrame || left.id.localeCompare(right.id)),
+ provenance,
+ };
}
+/** The element an output belongs to: `take-opening.video` is `take-opening`. */
function depthOf(
selection: ScriptMap["selections"][number],
all: readonly ScriptMap["selections"][number][],
@@ -150,36 +240,13 @@ export function snapshot(built: Preview, input: {
readonly revision: number;
readonly path: string;
readonly text: string;
- readonly digest: string;
readonly canvas: { readonly width: number; readonly height: number; readonly clearColor: string };
readonly frameRate: { readonly numerator: number; readonly denominator: number };
- readonly preview: PlaygroundSnapshot["preview"];
-}): PlaygroundSnapshot {
+ readonly preview: StudioSnapshot["preview"];
+}): StudioSnapshot {
const located = authored(built.source.observations.placements);
- // Which shots are not the shot. A clip is drawn from an output, so the output
- // that was stood in for is the clip that has to say so.
- const stood = new Map<string, "picture" | "black">([
- ...built.stoodIn.map((name) => [name, "picture"] as const),
- ...built.placeholders.map((name) => [name, "black"] as const),
- ]);
- // A shot reaches a picture through whatever consumed it - a Take, an Item -
- // so an element is showing a stand-in when anything it points at was one.
- const standIns = new Map<string, "picture" | "black">();
- for (const placement of built.source.observations.placements) {
- const paths = [
- ...placement.references,
- ...placement.children.flatMap((child) => child.references),
- ];
- for (const path of paths) {
- const held = stood.get(path);
- if (held === undefined) continue;
- if (placement.id !== undefined) standIns.set(placement.id, held);
- for (const child of placement.children) {
- if (child.id !== undefined && child.references.includes(path)) standIns.set(child.id, held);
- }
- }
- }
const script = scriptMap(built.source.observations.sourceMaps, built);
+ const semantic = semanticTimeline(built, script);
// A clip is coloured by the marker that placed it, not by the tag that drew
// it, so a cutaway and the words that call for it read as the same thing.
const markers = new Set([
@@ -200,16 +267,10 @@ export function snapshot(built: Preview, input: {
}
return undefined;
};
- const placeholders = new Set(built.placeholders);
-
const tracks: Track[] = [];
for (const item of built.tracks) {
const clips: Clip[] = spans(item.track, input.frameRate).map((span) => {
const where = locate(span.id, located);
- // A Track is named after the element that owns it, which is the last
- // place to look when the Present itself names no shot.
- const owner = item.name.includes(".") ? item.name.slice(0, item.name.indexOf(".")) : item.name;
- const shown = standInFor(span.id, where?.id, standIns) ?? standIns.get(owner);
const named = [...new Set(span.id.split(/[:#+]/u))].find((part) => markers.has(part));
const marker = named ?? (where === undefined ? undefined : markerFor(where.id));
// A clip is itself before it is what placed it: four rows of one board
@@ -224,28 +285,23 @@ export function snapshot(built: Preview, input: {
startFrame: span.startFrame,
endFrameExclusive: span.endFrameExclusive,
...(where === undefined ? {} : { elementRange: where.range }),
- ...(shown === undefined ? {} : { standIn: shown }),
stackOrder: span.stackOrder,
};
});
- // A Track says for itself where its picture came from. One badge for the
- // whole programme hid that a Track was real while the one beside it was not.
- const stands = new Set(clips.map((clip) => clip.standIn).filter(Boolean));
- const source = item.track === undefined
- ? "waiting" as const
- : stands.has("black") ? "black" as const
- : stands.has("picture") ? "stand-in" as const
- : "made" as const;
+ const provenance: CandidateProvenance = {
+ output: item.name,
+ outputRef: item.outputRef,
+ ...(item.candidateId === undefined ? {} : { candidateId: item.candidateId }),
+ origin: item.candidateOrigin,
+ status: "resolved",
+ errors: [],
+ };
tracks.push({
id: item.name,
label: item.name,
row: 0,
clips,
- source,
- timing: built.timing,
- ...(item.track === undefined
- ? { waiting: item.unserved.length > 0 ? item.unserved : ["something this preview could not build"] }
- : {}),
+ provenance,
});
}
// The lowest Present sits at the bottom of the timeline, as it does in the
@@ -263,10 +319,12 @@ export function snapshot(built: Preview, input: {
? 0
: Math.round(declared * input.frameRate.numerator / input.frameRate.denominator),
...rows.flatMap((track) => track.clips.map((clip) => clip.endFrameExclusive)),
+ ...(semantic?.segments ?? []).map((segment) => segment.endFrameExclusive),
+ ...(semantic?.tokens ?? []).map((token) => token.endFrameExclusive),
);
return {
revision: input.revision,
- source: { path: input.path, text: input.text, digest: input.digest },
+ source: { path: input.path, text: input.text },
...(script === undefined ? {} : { script }),
space: {
canvasWidth: input.canvas.width,
@@ -277,37 +335,16 @@ export function snapshot(built: Preview, input: {
durationSec: frameCount * input.frameRate.denominator / input.frameRate.numerator,
},
tracks: rows,
+ ...(semantic === undefined ? {} : { semantic }),
preview: input.preview,
provenance: {
- timing: built.timing,
- picture: placeholders.size === 0 ? "measured" : "estimated",
+ timing: "measured",
+ picture: "measured",
note: note(built),
},
- refused: built.refused,
- // A Producer that failed already said why. Dropping the message here left
- // every such Track reading only "something this preview could not build".
- errors: [...new Set(built.tracks.flatMap((track) => track.errors))],
};
}
-function note(built: Preview): string {
- const parts: string[] = [];
- parts.push(built.timing === "measured"
- ? "Timings are the ones the Run Source supplied."
- : "No timings were supplied, so words are placed at an ordinary delivery pace.");
- if (built.stoodIn.length > 0) {
- parts.push(`${built.stoodIn.length} shots have not been made, and show the picture they name instead.`);
- }
- if (built.placeholders.length > 0) {
- parts.push(`${built.placeholders.length} shots have no material yet and stand in as black frames.`);
- }
- if (built.phrasing.length > 0) {
- parts.push("Nothing has decided which words share a screen, so captions are cut every few words.");
- }
- const waiting = built.tracks.filter((track) => track.track === undefined);
- if (waiting.length > 0) {
- parts.push(`${waiting.map((track) => track.name).join(", ")} could not be built here: `
- + `${[...new Set(waiting.flatMap((track) => track.unserved))].join(", ")}.`);
- }
- return parts.join(" ");
+function note(_built: Preview): string {
+ return "Timings and material are the Candidates selected by the Run Source.";
}
diff --git a/packages/studio/src/studio-preflight.ts b/packages/studio/src/studio-preflight.ts
new file mode 100644
index 00000000..2e9a6c9e
--- /dev/null
+++ b/packages/studio/src/studio-preflight.ts
@@ -0,0 +1,196 @@
+import { plannedNeeds } from "@hypit/core";
+import type { Candidate } from "@hypit/protocol";
+
+import type { CompiledSource } from "./compile.js";
+import type { Placement } from "./observe.js";
+import type { RunPlan } from "./run.js";
+import {
+ lastPlacementTag,
+ outputFor,
+ placementFor,
+ roleFor,
+ traceFor,
+ tracedRealizations,
+ unique,
+} from "./studio-trace.js";
+import type { StudioProjectionRole, StudioTrace } from "./studio-trace.js";
+
+export type StudioProjection = {
+ readonly name: string;
+ readonly ref: string;
+ readonly type: string;
+ readonly role: StudioProjectionRole;
+ readonly candidateId?: string;
+ readonly trace: StudioTrace;
+ readonly candidatePolicy: "materialized-inline" | "deterministic-derived";
+};
+
+export type StudioInspection = {
+ readonly renderTargets: readonly string[];
+ readonly filmComposition: string;
+ readonly projections: readonly StudioProjection[];
+};
+
+export class StudioPreflightError extends Error {
+ readonly issues: readonly string[];
+
+ constructor(issues: readonly string[]) {
+ super(["Studio cannot start:", ...issues.map((issue) => `- ${issue}`)].join("\n"));
+ this.name = "StudioPreflightError";
+ this.issues = issues;
+ }
+}
+
+function candidateIsMaterialized(candidate: Candidate | undefined): boolean {
+ return candidate?.root.kind === "value"
+ && candidate.root.value.value.kind === "inline";
+}
+
+function plannedExternalNeeds(base: RunPlan, refs: readonly string[]): readonly string[] {
+ const planned = base.plan(base.run, refs);
+ return unique(plannedNeeds(planned.state).map((need) =>
+ `${need.capability.module.name}@${need.capability.module.version}#${need.capability.name}`,
+ ));
+}
+
+function filmForTarget(source: CompiledSource, targetRef: string): {
+ readonly renderTarget: boolean;
+ readonly compositionRef?: string;
+ readonly placement?: Placement;
+} {
+ const targetPlacement = placementFor(source, targetRef);
+ if (targetPlacement === undefined) return { renderTarget: false };
+ if (lastPlacementTag(source, targetRef) === "Film") {
+ return { renderTarget: true, compositionRef: targetRef, placement: targetPlacement };
+ }
+ if (lastPlacementTag(source, targetRef) !== "Video") return { renderTarget: false };
+ const composition = targetPlacement.references
+ .map((ref) => outputFor(source, ref))
+ .find((item) => item?.type === "Composition");
+ const compositionRef = composition?.ref;
+ const placement = compositionRef === undefined ? undefined : placementFor(source, compositionRef);
+ return {
+ renderTarget: true,
+ ...(compositionRef === undefined ? {} : { compositionRef }),
+ ...(placement === undefined ? {} : { placement }),
+ };
+}
+
+/**
+ * Video-domain policy is centralized here, inside Studio. Core still only
+ * supplies the compiled graph and its exact BuildPlan/Need closure.
+ */
+export function inspectStudioRun(source: CompiledSource, base: RunPlan): StudioInspection {
+ const issues: string[] = [];
+ if (base.targets.length === 0) issues.push("the Run Source has no target; Studio requires Film or Render");
+
+ const targets = base.targets.flatMap((ref) => {
+ const found = filmForTarget(source, ref);
+ return found.renderTarget ? [{ ref, ...found }] : [];
+ });
+ if (targets.length === 0 && base.targets.length > 0) {
+ issues.push("the Run target is not a Film or Render output from the current SVML");
+ }
+ const chosen = targets.find((item) => item.compositionRef !== undefined && item.placement !== undefined);
+ if (chosen?.compositionRef === undefined || chosen.placement === undefined) {
+ issues.push("Film/Render target has no traceable Film composition");
+ throw new StudioPreflightError(issues);
+ }
+
+ const candidates = new Map(base.run.graph.candidates.map((item) => [item.id, item] as const));
+ const satisfactions = new Map(base.run.graph.satisfactions.map((item) => [item.output, item.candidate] as const));
+ for (const target of targets) {
+ const candidateId = satisfactions.get(target.ref);
+ const candidate = candidateId === undefined ? undefined : candidates.get(candidateId);
+ if (candidate?.root.kind === "value" && candidate.root.value.value.kind === "blob") {
+ issues.push(`Render target ${outputFor(source, target.ref)?.name ?? target.ref} is an opaque media Candidate; Studio needs the current Film graph`);
+ }
+ }
+
+ const filmTrackRefs = unique([
+ ...chosen.placement.references,
+ ...chosen.placement.children.flatMap((child) => child.references),
+ ]).flatMap((ref) => {
+ const output = outputFor(source, ref);
+ return output !== undefined && (output.type === "VisualTrack" || output.type === "AudioTrack")
+ ? [output.ref]
+ : [];
+ });
+ const speechSpines = source.observations.placements.filter((placement) =>
+ placement.tag.split(":").at(-1) === "Spine"
+ && placement.outputs.some((ref) => {
+ const output = outputFor(source, ref);
+ return output !== undefined && filmTrackRefs.includes(output.ref);
+ })
+ );
+ const semanticTakeRefs = unique(speechSpines.flatMap((placement) => [
+ ...placement.references,
+ ...placement.children.flatMap((child) => child.references),
+ ])).flatMap((ref) => outputFor(source, ref)?.type === "SemanticTake"
+ ? [outputFor(source, ref)!.ref] : []);
+ const speechProjectionRefs = unique(speechSpines.flatMap((placement) => placement.outputs))
+ .flatMap((ref) => {
+ const output = outputFor(source, ref);
+ return output !== undefined
+ && (output.type === "CompleteSemanticMap" || output.type === "VisualTrack" || output.type === "AudioTrack")
+ ? [output.ref] : [];
+ });
+ if (semanticTakeRefs.length === 0) issues.push("Film has no traceable SemanticTake / Speech Spine chain");
+
+ const captionPlanRefs = unique(filmTrackRefs.flatMap((ref) =>
+ tracedRealizations(source, ref).map((dependency) => dependency.ref)));
+
+ const projectionRefs = unique([
+ ...filmTrackRefs,
+ ...speechProjectionRefs,
+ ...semanticTakeRefs,
+ ...captionPlanRefs,
+ ]);
+ const projections: StudioProjection[] = [];
+ const derived: Omit<StudioProjection, "candidatePolicy">[] = [];
+ for (const ref of projectionRefs) {
+ const output = outputFor(source, ref);
+ const role = roleFor(source, ref);
+ if (output === undefined || role === undefined) continue;
+ const candidateId = satisfactions.get(ref);
+ const candidate = candidateId === undefined ? undefined : candidates.get(candidateId);
+ if (candidateIsMaterialized(candidate)) {
+ projections.push({
+ name: output.name,
+ ref,
+ type: output.type,
+ role,
+ ...(candidateId === undefined ? {} : { candidateId }),
+ trace: traceFor(source, ref),
+ candidatePolicy: "materialized-inline",
+ });
+ continue;
+ }
+ derived.push({
+ name: output.name,
+ ref,
+ type: output.type,
+ role,
+ ...(candidateId === undefined ? {} : { candidateId }),
+ trace: traceFor(source, ref),
+ });
+ }
+
+ if (derived.length > 0) {
+ const needs = plannedExternalNeeds(base, derived.map((projection) => projection.ref));
+ if (needs.length > 0) {
+ issues.push(`the Studio projection closure requires unresolved capabilities: ${needs.join(", ")}`);
+ } else {
+ projections.push(...derived.map((projection) => ({
+ ...projection,
+ candidatePolicy: "deterministic-derived" as const,
+ })));
+ }
+ }
+ if (issues.length > 0) throw new StudioPreflightError(issues);
+ return {
+ renderTargets: targets.map((item) => item.ref),
+ filmComposition: chosen.compositionRef,
+ projections,
+ };
+}
diff --git a/packages/studio/src/studio-trace.ts b/packages/studio/src/studio-trace.ts
new file mode 100644
index 00000000..2deab0fe
--- /dev/null
+++ b/packages/studio/src/studio-trace.ts
@@ -0,0 +1,129 @@
+import type { CompiledSource } from "./compile.js";
+import type { Placement } from "./observe.js";
+
+export type StudioProjectionRole =
+ | "semantic-take"
+ | "semantic-map"
+ | "caption-plan"
+ | "speech-visual"
+ | "speech-audio"
+ | "media"
+ | "text"
+ | "caption"
+ | "track";
+
+export type StudioTraceDependency = {
+ readonly name: string;
+ readonly ref: string;
+ readonly type: string;
+};
+
+export type StudioTrace = {
+ readonly placement?: string;
+ readonly references: readonly StudioTraceDependency[];
+};
+
+export type StudioOutput = {
+ readonly name: string;
+ readonly type: string;
+ readonly ref: string;
+};
+
+type StudioOutputRule = {
+ readonly type: string;
+ readonly role: StudioProjectionRole;
+ readonly tag?: string;
+ readonly namespace?: string;
+};
+
+type StudioDependencyRule = {
+ readonly fromRole: StudioProjectionRole;
+ readonly type: string;
+ readonly role: StudioProjectionRole;
+};
+
+/**
+ * This table belongs entirely to Studio. It understands public Output types
+ * and observed Surface tags without asking domain packages to register UI
+ * knowledge.
+ */
+const OUTPUT_RULES: readonly StudioOutputRule[] = [
+ { type: "SemanticTake", role: "semantic-take" },
+ { type: "CompleteSemanticMap", role: "semantic-map" },
+ { type: "CaptionPlan", role: "caption-plan" },
+ { type: "VisualTrack", role: "speech-visual", tag: "spine" },
+ { type: "AudioTrack", role: "speech-audio", tag: "spine" },
+ { type: "VisualTrack", role: "media", tag: "track", namespace: "media-track" },
+ { type: "AudioTrack", role: "media", tag: "track", namespace: "media-track" },
+ { type: "VisualTrack", role: "text", tag: "track", namespace: "text" },
+ { type: "VisualTrack", role: "caption", tag: "track", namespace: "caption-fine" },
+];
+
+const DEPENDENCY_RULES: readonly StudioDependencyRule[] = [
+ { fromRole: "caption", type: "CaptionPlan", role: "caption-plan" },
+];
+
+function lastTag(placement: Placement | undefined): string {
+ return placement?.tag.split(":").at(-1) ?? "";
+}
+
+export function outputFor(source: CompiledSource, ref: string): StudioOutput | undefined {
+ return source.exports.find((item) => item.ref === ref || item.name === ref);
+}
+
+export function placementFor(source: CompiledSource, ref: string): Placement | undefined {
+ const output = outputFor(source, ref);
+ return source.observations.placements.find((item) =>
+ item.outputs.includes(ref) || (output !== undefined && item.outputs.includes(output.name))
+ );
+}
+
+export function unique(values: readonly string[]): string[] {
+ return [...new Set(values)];
+}
+
+export function lastPlacementTag(source: CompiledSource, ref: string): string {
+ return lastTag(placementFor(source, ref));
+}
+
+export function roleFor(source: CompiledSource, ref: string): StudioProjectionRole | undefined {
+ const output = outputFor(source, ref);
+ if (output === undefined) return undefined;
+ const placement = placementFor(source, ref);
+ const tag = lastTag(placement).toLowerCase();
+ const namespace = placement?.tag.split(":")[0]?.toLowerCase();
+ return OUTPUT_RULES.find((rule) =>
+ rule.type === output.type
+ && (rule.tag === undefined || rule.tag === tag)
+ && (rule.namespace === undefined || rule.namespace === namespace)
+ )?.role ?? ((output.type === "VisualTrack" || output.type === "AudioTrack") ? "track" : undefined);
+}
+
+export function traceFor(source: CompiledSource, ref: string): StudioTrace {
+ const placement = placementFor(source, ref);
+ if (placement === undefined) return { references: [] };
+ const refs = unique([
+ ...placement.references,
+ ...placement.children.flatMap((child) => child.references),
+ ]).flatMap((dependency) => {
+ const output = outputFor(source, dependency);
+ return output === undefined ? [] : [{ name: output.name, ref: output.ref, type: output.type }];
+ });
+ return {
+ placement: placement.tag,
+ references: refs,
+ };
+}
+
+export function tracedRealizations(
+ source: CompiledSource,
+ ref: string,
+): readonly { ref: string; role: StudioProjectionRole }[] {
+ const role = roleFor(source, ref);
+ if (role === undefined) return [];
+ return traceFor(source, ref).references.flatMap((dependency) => {
+ const rule = DEPENDENCY_RULES.find((item) =>
+ item.fromRole === role && item.type === dependency.type);
+ return rule === undefined ? [] : [{ ref: dependency.ref, role: rule.role }];
+ });
+}
diff --git a/packages/studio/src/style.css b/packages/studio/src/style.css
new file mode 100644
index 00000000..c62d25b1
--- /dev/null
+++ b/packages/studio/src/style.css
@@ -0,0 +1,324 @@
+:root {
+ color-scheme: dark;
+ --bg: #08090b;
+ --panel: #0e1013;
+ --panel-raised: #13161a;
+ --panel-soft: #171a1f;
+ --inset: #090b0e;
+ --line: rgba(255, 255, 255, 0.075);
+ --line-strong: rgba(255, 255, 255, 0.13);
+ --text: #f3f4f6;
+ --text-soft: #c8ccd2;
+ --muted: #858b95;
+ --dim: #555c66;
+ --accent: #ff745f;
+ --marker: #f5c95b;
+ --danger: #ff6f78;
+ --ok: #57d39b;
+ --source-width: 390px;
+ --workspace-width: 300px;
+ font: 13px/1.45 Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
+}
+
+* { box-sizing: border-box; }
+html, body, #app {
+ width: 100%; height: 100%; margin: 0; overflow: hidden;
+ overscroll-behavior: none; background: var(--bg); color: var(--text);
+}
+body { cursor: default; }
+button, [role="button"] { font: inherit; }
+button { cursor: pointer; }
+button:focus-visible, textarea:focus-visible { outline: 1px solid var(--accent); outline-offset: -1px; }
+::selection { background: rgba(255, 116, 95, 0.28); color: #fff; }
+*::-webkit-scrollbar { width: 10px; height: 10px; }
+*::-webkit-scrollbar-track { background: transparent; }
+*::-webkit-scrollbar-thumb { background: rgba(255,255,255,.12); border: 3px solid transparent; border-radius: 10px; background-clip: padding-box; }
+*::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,.22); border: 3px solid transparent; background-clip: padding-box; }
+
+#app { display: flex; flex-direction: column; position: relative; }
+.material-symbols-rounded {
+ font-family: "Material Symbols Rounded"; font-size: 20px; line-height: 1; font-weight: 400;
+ font-style: normal; letter-spacing: normal; text-transform: none; white-space: nowrap;
+ direction: ltr; -webkit-font-feature-settings: "liga"; font-variation-settings: "FILL" 1;
+}
+
+/* Application chrome ------------------------------------------------ */
+.topbar {
+ height: 48px; flex: none; display: grid;
+ grid-template-columns: minmax(190px, auto) minmax(120px, 1fr) auto auto auto;
+ align-items: center; gap: 14px; padding: 0 14px;
+ border-bottom: 1px solid var(--line); background: #0b0d10;
+ user-select: none;
+}
+.brand { display: flex; align-items: center; gap: 9px; min-width: 0; }
+.brand-mark {
+ width: 26px; height: 26px; display: grid; place-items: center;
+ border-radius: 7px; background: var(--text); color: #0a0b0d;
+ font-size: 14px; font-weight: 850; letter-spacing: -.04em;
+}
+.brand > div { min-width: 0; display: flex; align-items: baseline; gap: 7px; }
+.brand strong { font-size: 13px; font-weight: 680; letter-spacing: -.01em; white-space: nowrap; }
+.brand small { color: var(--dim); font-size: 10px; white-space: nowrap; }
+.project-title {
+ min-width: 0; justify-self: center; max-width: 360px; overflow: hidden;
+ color: var(--text-soft); font-size: 12px; font-weight: 580; text-overflow: ellipsis; white-space: nowrap;
+}
+.meta { color: var(--dim); font: 10px/1.2 ui-monospace, SFMono-Regular, Menlo, monospace; white-space: nowrap; }
+.badges { display: flex; gap: 5px; }
+.badge {
+ padding: 3px 7px; border: 1px solid var(--line); border-radius: 999px;
+ background: rgba(255,255,255,.025); color: var(--muted); font-size: 10px; white-space: nowrap;
+}
+.status { min-width: 94px; display: flex; align-items: center; justify-content: flex-end; gap: 6px; color: var(--muted); font-size: 10px; white-space: nowrap; }
+.status i { width: 6px; height: 6px; border-radius: 50%; background: var(--dim); }
+.status.ok i { background: var(--ok); box-shadow: 0 0 0 3px rgba(87,211,155,.08); }
+.status.error { color: var(--danger); }
+.status.error i { background: var(--danger); }
+
+.studio-shell {
+ flex: 1; min-height: 0; display: grid;
+ grid-template-columns: var(--source-width) 5px minmax(360px, 1fr);
+ background: var(--bg); user-select: none;
+}
+.source-panel, .workspace-panel, .workbench, .preview-row, .preview-panel, .timeline-panel { min-width: 0; min-height: 0; }
+.source-panel { display: flex; border-right: 1px solid var(--line); background: var(--panel); }
+.workspace-panel { display: flex; flex-direction: column; border-left: 1px solid var(--line); background: var(--panel); }
+.workbench {
+ --timeline-height: 330px;
+ display: grid; grid-template-rows: minmax(0, 1fr) 5px var(--timeline-height);
+ overflow: hidden; background: #07080a;
+}
+.preview-row {
+ --workspace-width: 300px;
+ min-height: 0; display: grid;
+ grid-template-columns: minmax(0, 1fr) 5px var(--workspace-width);
+ overflow: hidden;
+}
+.preview-panel, .timeline-panel { overflow: hidden; }
+
+.pane-heading {
+ height: 44px; flex: none; display: flex; align-items: center; justify-content: space-between;
+ padding: 0 12px; border-bottom: 1px solid var(--line); background: var(--panel);
+}
+.pane-title { min-width: 0; display: flex; align-items: center; gap: 8px; }
+.pane-title > div { min-width: 0; }
+.pane-title h2 { margin: 0; color: var(--text-soft); font-size: 11px; font-weight: 650; letter-spacing: .01em; }
+.pane-title span:not(.pane-icon) { display: block; max-width: 260px; overflow: hidden; color: var(--dim); font-size: 9px; text-overflow: ellipsis; white-space: nowrap; }
+.pane-icon { color: var(--muted); font-size: 17px; }
+.icon-button {
+ width: 26px; height: 26px; display: grid; place-items: center; padding: 0;
+ border: 0; border-radius: 5px; background: transparent; color: var(--muted);
+}
+.icon-button:hover { background: rgba(255,255,255,.07); color: var(--text); }
+.icon-button:active { background: rgba(255,255,255,.11); }
+.icon-button .material-symbols-rounded { font-size: 17px; }
+
+/* Source ------------------------------------------------------------ */
+.code { flex: 1; min-width: 0; min-height: 0; display: flex; flex-direction: column; }
+.code-actions { display: flex; align-items: center; gap: 5px; }
+.code-save-state { color: var(--dim); font-size: 9px; white-space: nowrap; }
+.code-save-state.saving, .code-save-state.dirty { color: var(--marker); }
+.code-save-state.saved { color: var(--ok); }
+.code-save-state.error { color: var(--danger); }
+.code-scroll {
+ position: relative; flex: 1; min-height: 0; overflow-x: hidden; overflow-y: auto;
+ padding: 10px 10px 42px 0; background: #0b0d10;
+ font: 11.5px/20px ui-monospace, SFMono-Regular, Menlo, monospace;
+ user-select: text; cursor: text;
+}
+.code-editor {
+ display: none; flex: 1; min-height: 0; width: 100%; resize: none; padding: 12px 14px;
+ border: 0; background: #0a0c0f; color: #d2d6dc;
+ font: 11.5px/20px ui-monospace, SFMono-Regular, Menlo, monospace;
+ tab-size: 2; caret-color: var(--accent); outline: none; user-select: text; cursor: text;
+}
+.code.is-editing .code-scroll { display: none; }
+.code.is-editing .code-editor { display: block; }
+.code-line { position: relative; display: flex; align-items: flex-start; min-height: 20px; }
+.code-line .line-number { flex: none; width: 46px; padding-right: 19px; text-align: right; color: #404650; user-select: none; }
+.code-line.bound { cursor: pointer; }
+.code-line.bound:hover { background: rgba(255,255,255,.025); }
+.code-line .gutter-bar { position: absolute; top: 2px; bottom: 2px; width: 2px; border-radius: 2px; background: var(--tone, #fff); opacity: .72; pointer-events: none; }
+.code-line.bound:hover .gutter-bar { opacity: 1; }
+.code-line.bound:hover .line-number { color: var(--tone, #fff); }
+.code-line code { flex: 1; min-width: 0; padding-right: 5px; color: #8d949e; font: inherit; white-space: pre-wrap; overflow-wrap: break-word; }
+.tok-header, .tok-comment { color: #505762; font-style: italic; }
+.tok-punct { color: #686f79; }
+.tok-tag { color: #7dadf2; }
+.tok-attr { color: #bd9ae0; }
+.tok-string { color: #80c99a; }
+.tok-reference { color: #ef8a73; }
+.tok-marker { color: var(--marker); font-weight: 650; cursor: pointer; }
+.tok-role { color: #e987aa; }
+.tone-0 { --tone: #f5c95b; } .tone-1 { --tone: #61c3e8; }
+.tone-2 { --tone: #82cf8a; } .tone-3 { --tone: #db86bd; }
+.tok-marker.tone-0, .tok-marker.tone-1, .tok-marker.tone-2, .tok-marker.tone-3 {
+ color: var(--tone); background: color-mix(in srgb, var(--tone) 12%, transparent);
+ box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--tone) 30%, transparent);
+ border-radius: 3px; padding: 0 1px;
+}
+.range-canvas { position: absolute; inset: 0; z-index: 0; pointer-events: none; }
+.spoken { position: absolute; z-index: 0; border-radius: 3px; background: rgba(245,201,91,.12); box-shadow: inset 0 0 0 1px rgba(245,201,91,.35); pointer-events: none; }
+.range-element { fill: rgba(255,255,255,.055); stroke: rgba(255,255,255,.82); stroke-width: 1.2; }
+.range-binding { fill: color-mix(in srgb, var(--tone, var(--marker)) 9%, transparent); stroke: var(--tone, var(--marker)); stroke-width: 1.2; }
+
+/* Preview ----------------------------------------------------------- */
+.stage { height: 100%; min-height: 0; display: flex; flex-direction: column; background: #08090b; }
+.stage-heading { height: 38px; flex: none; display: flex; align-items: center; justify-content: space-between; padding: 0 12px; border-bottom: 1px solid var(--line); background: #0c0e11; }
+.stage-title { display: flex; align-items: center; gap: 7px; color: var(--text-soft); }
+.stage-title .material-symbols-rounded { color: var(--muted); font-size: 17px; }
+.stage-title strong { font-size: 11px; font-weight: 650; }
+.stage-canvas { color: var(--dim); font: 9px/1 ui-monospace, SFMono-Regular, Menlo, monospace; }
+.stage-viewport {
+ flex: 1; min-height: 0; overflow: hidden; display: flex; align-items: center; justify-content: center;
+ padding: 18px; background: radial-gradient(circle at 50% 48%, rgba(255,255,255,.035), transparent 42%), #07080a;
+}
+.stage-scaler { position: relative; transform-origin: top left; }
+.stage iframe {
+ display: block; border: 0; border-radius: 3px; background: #000; transform-origin: top left;
+ pointer-events: none; box-shadow: 0 22px 70px rgba(0,0,0,.68), 0 0 0 1px rgba(255,255,255,.13);
+}
+.stage-overlay { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; pointer-events: none; }
+.box { --tone: #fff; }
+.box-content { fill: color-mix(in srgb, var(--tone) 8%, transparent); stroke: var(--tone); stroke-width: 2; }
+.box-content-guide { fill: none; stroke: color-mix(in srgb, var(--tone) 45%, transparent); stroke-width: 1; stroke-dasharray: 3 4; }
+.box-label { fill: var(--tone); font: 600 25px Inter, sans-serif; paint-order: stroke; stroke: rgba(0,0,0,.85); stroke-width: 5px; }
+.box-elsewhere { opacity: .35; }
+.stage-bar {
+ position: relative; height: 44px; flex: none; display: flex; align-items: center; justify-content: center; gap: 3px;
+ border-top: 1px solid var(--line); background: #0c0e11;
+}
+.stage-bar button { width: 30px; height: 30px; display: grid; place-items: center; padding: 0; border: 0; border-radius: 6px; background: transparent; color: var(--muted); }
+.stage-bar button:hover { background: rgba(255,255,255,.07); color: var(--text); }
+.stage-bar button[data-play] { width: 34px; height: 34px; margin: 0 2px; background: var(--text); color: #0a0b0d; border-radius: 50%; }
+.stage-bar button[data-play]:hover { background: #fff; transform: scale(1.025); }
+.stage-bar button[data-play] .material-symbols-rounded { font-size: 23px; }
+.stage-time { position: absolute; left: 12px; color: var(--dim); font: 10px/1 ui-monospace, SFMono-Regular, Menlo, monospace; font-variant-numeric: tabular-nums; }
+.stage-mute { margin-left: 5px; }
+
+/* Workspace --------------------------------------------------------- */
+.workspace-panel { overflow: hidden; }
+.workspace-scroll { flex: 1; min-width: 0; min-height: 0; overflow-x: hidden; overflow-y: auto; overscroll-behavior: contain; }
+.workspace-section { min-width: 0; padding: 0; }
+.inspector { min-width: 0; display: flex; flex-direction: column; }
+.inspector-empty { min-height: 210px; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 24px 18px; color: var(--dim); text-align: center; }
+.inspector-empty .material-symbols-rounded { width: 36px; height: 36px; display: grid; place-items: center; margin-bottom: 10px; border: 1px solid var(--line); border-radius: 9px; background: rgba(255,255,255,.025); color: #525963; font-size: 19px; }
+.inspector-empty strong { color: var(--muted); font-size: 11px; font-weight: 620; }
+.inspector-empty small { max-width: 190px; margin-top: 5px; color: var(--dim); font-size: 9px; line-height: 1.5; }
+.selection-hero { min-width: 0; display: grid; grid-template-columns: 34px minmax(0,1fr) auto; align-items: center; gap: 9px; padding: 14px 12px; border-bottom: 1px solid var(--line); background: linear-gradient(180deg, rgba(255,255,255,.018), transparent); }
+.selection-icon { width: 34px; height: 34px; display: grid; place-items: center; border: 1px solid color-mix(in srgb, var(--accent) 34%, var(--line)); border-radius: 8px; background: rgba(255,116,95,.08); color: var(--accent); }
+.selection-icon .material-symbols-rounded { font-size: 17px; }
+.selection-title { min-width: 0; }
+.selection-title strong, .selection-title small { display: block; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
+.selection-title strong { color: var(--text); font-size: 11px; font-weight: 650; }
+.selection-title small { margin-top: 2px; color: var(--dim); font-size: 9px; }
+.selection-kind { padding: 2px 5px; border: 1px solid var(--line); border-radius: 4px; color: var(--muted); font-size: 8px; }
+.property-group { min-width: 0; padding: 13px 12px 14px; border-bottom: 1px solid var(--line); }
+.property-group h3 { margin: 0 0 9px; color: var(--dim); font-size: 8.5px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
+.property-grid { min-width: 0; display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 7px; }
+.property { min-width: 0; display: flex; flex-direction: column; gap: 4px; padding: 8px; border: 1px solid var(--line); border-radius: 6px; background: rgba(255,255,255,.018); }
+.property > span { overflow: hidden; color: var(--dim); font-size: 8px; text-overflow: ellipsis; white-space: nowrap; }
+.property > strong { min-width: 0; overflow: hidden; color: var(--text-soft); font-size: 10px; font-weight: 590; text-overflow: ellipsis; white-space: nowrap; font-variant-numeric: tabular-nums; }
+.property-wide { grid-column: 1 / -1; }
+.property-code > strong { font: 9px/1.35 ui-monospace, SFMono-Regular, Menlo, monospace; }
+.inspector-notice { min-width: 0; display: grid; grid-template-columns: 18px minmax(0,1fr); gap: 8px; margin: 12px; padding: 9px; border: 1px solid rgba(245,201,91,.18); border-radius: 6px; background: rgba(245,201,91,.055); }
+.inspector-notice > .material-symbols-rounded { color: var(--marker); font-size: 16px; }
+.inspector-notice strong { display: block; color: var(--marker); font-size: 9px; font-weight: 620; }
+.inspector-notice p { margin: 3px 0 0; color: var(--muted); font-size: 9px; line-height: 1.45; overflow-wrap: anywhere; }
+/* Timeline ---------------------------------------------------------- */
+.timeline { height: 100%; min-height: 0; display: flex; flex-direction: column; background: #090b0e; }
+.timeline-toolbar { height: 38px; flex: none; display: grid; grid-template-columns: minmax(190px,1fr) auto minmax(190px,1fr); align-items: center; gap: 8px; padding: 0 8px 0 10px; border-bottom: 1px solid var(--line); background: #0d0f12; }
+.timeline-title, .timeline-view-actions { display: flex; align-items: center; gap: 7px; min-width: 0; }
+.timeline-title > .material-symbols-rounded { color: var(--muted); font-size: 17px; }
+.timeline-title strong { color: var(--text-soft); font-size: 11px; font-weight: 650; }
+.timeline-mode { display: inline-flex; align-items: center; gap: 5px; margin-left: 3px; color: var(--dim); font-size: 9px; }
+.timeline-mode i { width: 5px; height: 5px; border-radius: 50%; background: #72a4ff; }
+.timeline-readout { justify-self: center; color: var(--text-soft); font: 10px/1 ui-monospace, SFMono-Regular, Menlo, monospace; font-variant-numeric: tabular-nums; }
+.timeline-view-actions { justify-content: flex-end; }
+.timeline-hint { margin-right: 3px; color: var(--dim); font-size: 9px; }
+.timeline-body { flex: 1; min-height: 0; display: grid; grid-template-columns: 126px minmax(0,1fr); overflow-x: hidden; overflow-y: auto; overscroll-behavior: contain; }
+.timeline-labels { position: sticky; left: 0; z-index: 3; border-right: 1px solid var(--line); background: var(--panel); }
+.label-corner { position: sticky; top: 0; z-index: 4; height: 24px; display: flex; align-items: center; justify-content: flex-end; padding-right: 9px; border-bottom: 1px solid var(--line); background: var(--panel); color: var(--dim); font: 9px/1 ui-monospace, SFMono-Regular, Menlo, monospace; }
+.track-label { min-height: 52px; min-width: 0; display: grid; grid-template-columns: 22px minmax(0,1fr) 8px; align-items: center; gap: 5px; padding: 0 8px; border-bottom: 1px solid var(--line); background: #0f1115; }
+.track-icon { width: 22px; height: 22px; display: grid; place-items: center; border-radius: 5px; background: color-mix(in srgb, var(--track) 13%, transparent); color: var(--track); font-size: 14px; }
+.track-copy { min-width: 0; }
+.track-copy strong, .track-copy small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
+.track-copy strong { color: var(--text-soft); font-size: 10px; font-weight: 620; }
+.track-copy small { margin-top: 2px; color: var(--dim); font-size: 8.5px; }
+.track-state { color: var(--marker); font-size: 10px; }
+.track-media { --track: #668cf1; } .track-speech { --track: #55c6a2; }
+.track-caption { --track: #b27ee5; } .track-component { --track: #ef9469; }
+.track-audio { --track: #d7b95d; } .track-visual { --track: #7da0bb; }
+.timeline-lanes { position: relative; min-width: 0; cursor: default; user-select: none; touch-action: pan-y; }
+.ruler { position: sticky; top: 0; z-index: 2; height: 24px; border-bottom: 1px solid var(--line); background: #0d0f12; cursor: ew-resize; }
+.tick { position: absolute; top: 0; height: 24px; padding-left: 5px; border-left: 1px solid rgba(255,255,255,.08); color: var(--dim); font: 8.5px/24px ui-monospace, SFMono-Regular, Menlo, monospace; white-space: nowrap; }
+.tick-last { padding-left: 0; padding-right: 5px; border-right: 1px solid rgba(255,255,255,.08); border-left: 0; transform: translateX(-100%); }
+.lane { position: relative; min-height: 52px; border-bottom: 1px solid var(--line); background-color: #090b0e; background-image: linear-gradient(to right, rgba(255,255,255,.025) 1px, transparent 1px); background-size: 48px 100%; }
+.semantic-label { --track: #7da0bb; align-items: start; padding-top: 10px; background: #10151b; }
+.semantic-label .track-icon { margin-top: 1px; }
+.semantic-label .track-copy small { white-space: normal; line-height: 1.2; }
+.semantic-lane { min-height: 72px; overflow: hidden; background-color: #0a0e13; background-image: linear-gradient(to right, rgba(125,160,187,.08) 1px, transparent 1px); background-size: 48px 100%; }
+.semantic-segment { --semantic-tone: #7199b8; position: absolute; top: 7px; bottom: 7px; min-width: 3px; overflow: hidden; border: 1px solid color-mix(in srgb, var(--semantic-tone) 65%, var(--line)); border-radius: 7px; background: linear-gradient(180deg, color-mix(in srgb, var(--semantic-tone) 22%, #172029), color-mix(in srgb, var(--semantic-tone) 10%, #10151b)); color: var(--text); text-align: left; cursor: pointer; box-shadow: inset 0 1px rgba(255,255,255,.055); transition: border-color 100ms ease, box-shadow 100ms ease, filter 100ms ease; }
+.semantic-segment:hover, .semantic-segment:focus-visible { z-index: 5; border-color: color-mix(in srgb, var(--semantic-tone) 90%, #fff 12%); filter: brightness(1.08); outline: none; }
+.semantic-segment.live { border-color: var(--accent); box-shadow: inset 0 0 0 1px rgba(255,116,95,.45), 0 0 14px rgba(255,116,95,.08); }
+.semantic-segment-label { position: absolute; top: 4px; left: 8px; right: 8px; overflow: hidden; color: color-mix(in srgb, var(--semantic-tone) 68%, var(--text-soft)); font-size: 9px; font-weight: 650; line-height: 12px; white-space: nowrap; text-overflow: clip; pointer-events: none; }
+.semantic-words { position: absolute; left: 6px; right: 6px; bottom: 6px; height: 27px; pointer-events: none; }
+.semantic-word { position: absolute; top: 0; height: 25px; min-width: 2px; overflow: hidden; padding: 0 4px; border: 1px solid color-mix(in srgb, var(--semantic-tone) 45%, var(--line)); border-radius: 4px; background: color-mix(in srgb, var(--semantic-tone) 22%, #151b21); color: var(--text-soft); font: inherit; text-align: left; white-space: nowrap; cursor: pointer; pointer-events: auto; }
+.semantic-word:hover, .semantic-word:focus-visible { z-index: 6; border-color: color-mix(in srgb, var(--semantic-tone) 84%, #fff 10%); outline: none; }
+.semantic-word.current { border-color: color-mix(in srgb, var(--accent) 72%, #fff 10%); background: color-mix(in srgb, var(--accent) 16%, #151b21); }
+.semantic-word-label { display: block; overflow: hidden; color: inherit; font-size: 8px; line-height: 23px; white-space: nowrap; text-overflow: clip; pointer-events: none; }
+.semantic-segment-label.label-hidden, .semantic-word.label-hidden .semantic-word-label { display: none; }
+.semantic-anchor { position: absolute; top: 22px; bottom: 7px; width: 1px; background: color-mix(in srgb, var(--semantic-tone) 54%, transparent); opacity: .45; pointer-events: none; }
+.semantic-anchor-segment-start, .semantic-anchor-segment-end { opacity: .86; background: color-mix(in srgb, var(--semantic-tone) 82%, #fff 8%); }
+.semantic-segment.semantic-coarse .semantic-words, .semantic-segment.semantic-coarse .semantic-anchor { display: none; }
+.clip { --tone: var(--track); position: absolute; height: 40px; min-width: 3px; margin-top: 6px; display: flex; align-items: center; gap: 6px; padding: 0 8px; overflow: hidden; border: 1px solid color-mix(in srgb, var(--tone) 36%, var(--line)); border-radius: 5px; background: linear-gradient(180deg, color-mix(in srgb, var(--tone) 18%, #171a20), color-mix(in srgb, var(--tone) 10%, #111419)); color: var(--text); text-align: left; box-shadow: inset 0 1px rgba(255,255,255,.035); transition: border-color 100ms ease, box-shadow 100ms ease, filter 100ms ease, transform 100ms ease; touch-action: none; }
+.clip:hover { z-index: 4; border-color: color-mix(in srgb, var(--tone) 66%, #fff 10%); filter: brightness(1.08); }
+.clip:active { cursor: grabbing; transform: translateY(1px); }
+.clip-icon { flex: none; color: color-mix(in srgb, var(--tone) 80%, #fff 15%); font-size: 14px; }
+.clip-copy { min-width: 0; display: flex; flex-direction: column; gap: 1px; }
+.clip-name { overflow: hidden; color: var(--text-soft); font-size: 10px; font-weight: 630; text-overflow: ellipsis; white-space: nowrap; }
+.clip-meta { color: color-mix(in srgb, var(--tone) 55%, var(--muted)); font: 8.5px/1.1 ui-monospace, SFMono-Regular, Menlo, monospace; }
+.clip-edge { position: absolute; top: 5px; bottom: 5px; width: 3px; border-radius: 2px; background: rgba(255,255,255,.62); opacity: 0; transition: opacity 100ms ease; }
+.clip-edge-left { left: 2px; } .clip-edge-right { right: 2px; }
+.clip:hover .clip-edge, .clip.selected .clip-edge { opacity: .55; }
+.clip.live { filter: brightness(1.16); box-shadow: inset 0 1px rgba(255,255,255,.08), 0 0 0 1px color-mix(in srgb, var(--tone) 22%, transparent); }
+.clip.selected { z-index: 5; border-color: var(--accent); box-shadow: inset 0 0 0 1px rgba(255,116,95,.65), 0 0 0 1px rgba(0,0,0,.8), 0 0 18px rgba(255,116,95,.1); }
+.clip.selected .clip-edge { background: var(--accent); opacity: 1; }
+.clipped-left { border-left-style: dashed; border-top-left-radius: 0; border-bottom-left-radius: 0; }
+.clipped-right { border-right-style: dashed; border-top-right-radius: 0; border-bottom-right-radius: 0; }
+.playhead { position: absolute; top: 0; bottom: 0; left: 0; z-index: 8; width: 1px; background: var(--accent); pointer-events: none; will-change: transform; box-shadow: 0 0 0 .5px rgba(0,0,0,.55); }
+.playhead-grip { position: sticky; top: 0; display: block; width: 11px; height: 9px; margin-left: -5px; background: var(--accent); clip-path: polygon(0 0,100% 0,50% 100%); }
+.timeline-zoom { height: 24px; flex: none; padding: 5px 9px 5px 135px; border-top: 1px solid var(--line); background: #0d0f12; }
+.zoom { position: relative; height: 14px; border-radius: 4px; background: #080a0d; box-shadow: inset 0 0 0 1px var(--line); cursor: pointer; }
+.zoom-window { position: absolute; top: 1px; bottom: 1px; border-radius: 3px; background: rgba(255,255,255,.09); box-shadow: inset 0 0 0 1px rgba(255,255,255,.17); cursor: grab; }
+.zoom-window:active { cursor: grabbing; }
+.zoom-grip { position: absolute; top: 50%; width: 4px; height: 8px; margin-top: -4px; border-radius: 2px; background: rgba(255,255,255,.78); cursor: col-resize; }
+.zoom-grip-start { left: 3px; } .zoom-grip-end { right: 3px; }
+.track-fold { height: 14px; margin-left: 4px; padding: 0 4px; border: 0; border-radius: 4px; background: rgba(255,255,255,.08); color: var(--muted); font-size: 8px; line-height: 14px; }
+.track-fold:hover { background: rgba(255,255,255,.14); color: var(--text); }
+
+/* Resizing and errors ------------------------------------------------ */
+.handle { position: relative; z-index: 20; background: transparent; touch-action: none; }
+.handle::after { content: ""; position: absolute; background: transparent; transition: background 100ms ease; }
+.handle-column { width: 5px; cursor: col-resize; }
+.handle-column::after { top: 0; bottom: 0; left: 2px; width: 1px; }
+.handle-row { height: 5px; cursor: row-resize; }
+.handle-row::after { left: 0; right: 0; top: 2px; height: 1px; }
+.handle:hover::after, .handle:focus-visible::after { background: var(--accent); }
+.handle:focus-visible { outline: none; }
+.failure { position: absolute; left: 18px; right: 18px; bottom: 18px; z-index: 70; max-height: 180px; overflow: auto; margin: 0; padding: 12px 14px; border: 1px solid rgba(255,111,120,.45); border-radius: 7px; background: rgba(49,15,19,.95); color: #ffb0b5; box-shadow: 0 18px 50px rgba(0,0,0,.5); font: 11px/1.5 ui-monospace, SFMono-Regular, Menlo, monospace; white-space: pre-wrap; user-select: text; }
+.failure:empty { display: none; }
+
+@media (max-width: 1180px) {
+ :root { --workspace-width: 250px; --source-width: 330px; }
+ .studio-shell { grid-template-columns: var(--source-width) 5px minmax(340px, 1fr); }
+ .preview-row { --workspace-width: 250px; }
+ .meta, .timeline-hint { display: none; }
+}
+@media (max-width: 900px) {
+ .workspace-panel, .workspace-handle { display: none; }
+ .studio-shell { grid-template-columns: minmax(280px, 36vw) 5px minmax(0,1fr); }
+ .preview-row { grid-template-columns: minmax(0,1fr); }
+ .topbar { grid-template-columns: auto minmax(80px,1fr) auto; }
+ .badges, .meta { display: none; }
+}
diff --git a/packages/svml-playground/src/ui/code.ts b/packages/studio/src/ui/code.ts
similarity index 81%
rename from packages/svml-playground/src/ui/code.ts
rename to packages/studio/src/ui/code.ts
index 3e9d69fa..f3812f89 100644
--- a/packages/svml-playground/src/ui/code.ts
+++ b/packages/studio/src/ui/code.ts
@@ -1,4 +1,4 @@
-import type { PlaygroundSnapshot, Range } from "../shared.js";
+import type { Range, StudioSnapshot } from "../shared.js";
import { markerTones } from "./markers.js";
import { tokenizeSvml } from "./syntax.js";
import type { Token } from "./syntax.js";
@@ -18,7 +18,7 @@ export type Highlight = {
export type CodePane = {
readonly element: HTMLElement;
- show(snapshot: PlaygroundSnapshot): void;
+ show(snapshot: StudioSnapshot): void;
highlight(values: readonly Highlight[], scrollIntoView: boolean): void;
/** Mark the word being spoken at the playhead, or nothing outside speech. */
speak(range: Range | undefined): void;
@@ -77,15 +77,98 @@ export function createCodePane(): CodePane {
const element = document.createElement("section");
element.className = "code";
element.innerHTML = `
- <div class="pane-heading"><h2>Source</h2><span data-path></span></div>
- <div class="code-scroll"><svg class="range-canvas" aria-hidden="true"></svg></div>`;
+ <div class="pane-heading code-heading">
+ <div class="pane-title">
+ <span class="material-symbols-rounded pane-icon">code</span>
+ <div><h2>SVML</h2><span data-path></span></div>
+ </div>
+ <div class="code-actions">
+ <span class="code-save-state" data-save-state></span>
+ <button type="button" class="icon-button code-mode" data-mode aria-label="Edit source" title="Edit source">
+ <span class="material-symbols-rounded">edit</span>
+ </button>
+ </div>
+ </div>
+ <div class="code-scroll"><svg class="range-canvas" aria-hidden="true"></svg></div>
+ <textarea class="code-editor" data-editor spellcheck="false" aria-label="SVML source"></textarea>`;
const path = element.querySelector<HTMLElement>("[data-path]")!;
const scroll = element.querySelector<HTMLElement>(".code-scroll")!;
const canvas = element.querySelector<SVGSVGElement>(".range-canvas")!;
+ const editor = element.querySelector<HTMLTextAreaElement>("[data-editor]")!;
+ const mode = element.querySelector<HTMLButtonElement>("[data-mode]")!;
+ const modeIcon = mode.querySelector<HTMLElement>(".material-symbols-rounded")!;
+ const saveState = element.querySelector<HTMLElement>("[data-save-state]")!;
let lines: Line[] = [];
let current: readonly Highlight[] = [];
let spoken: HTMLElement | undefined;
+ let snapshotRevision = 0;
+ let editingRevision = 0;
+ let sourceText = "";
+ let editing = false;
+ let dirty = false;
+ let saveTimer: number | undefined;
+
+ const setEditing = (value: boolean): void => {
+ editing = value;
+ element.classList.toggle("is-editing", editing);
+ modeIcon.textContent = editing ? "visibility" : "edit";
+ mode.setAttribute("aria-label", editing ? "Read source" : "Edit source");
+ mode.title = editing ? "Read source" : "Edit source";
+ if (editing) {
+ editor.value = sourceText;
+ editingRevision = snapshotRevision;
+ editor.focus({ preventScroll: true });
+ }
+ };
+
+ const save = async (): Promise<void> => {
+ if (!editing || !dirty) return;
+ saveState.textContent = "Saving";
+ saveState.className = "code-save-state saving";
+ try {
+ const response = await fetch("/__studio/source", {
+ method: "PUT",
+ headers: { "content-type": "application/json" },
+ body: JSON.stringify({ text: editor.value, revision: editingRevision }),
+ });
+ if (!response.ok) {
+ const reason = await response.text();
+ throw new Error(reason || `Save failed (${response.status})`);
+ }
+ sourceText = editor.value;
+ dirty = false;
+ saveState.textContent = "Saved";
+ saveState.className = "code-save-state saved";
+ window.setTimeout(() => {
+ if (!dirty) saveState.textContent = "";
+ }, 1200);
+ } catch (error) {
+ saveState.textContent = error instanceof Error && error.message.includes("changed")
+ ? "Changed outside Studio"
+ : "Save failed";
+ saveState.className = "code-save-state error";
+ }
+ };
+
+ mode.addEventListener("click", () => {
+ if (editing && dirty) void save();
+ setEditing(!editing);
+ });
+ editor.addEventListener("input", () => {
+ dirty = true;
+ saveState.textContent = "Unsaved";
+ saveState.className = "code-save-state dirty";
+ if (saveTimer !== undefined) window.clearTimeout(saveTimer);
+ saveTimer = window.setTimeout(() => void save(), 480);
+ });
+ editor.addEventListener("keydown", (event) => {
+ if ((event.metaKey || event.ctrlKey) && event.key.toLowerCase() === "s") {
+ event.preventDefault();
+ if (saveTimer !== undefined) window.clearTimeout(saveTimer);
+ void save();
+ }
+ });
const lineAt = (offset: number): Line | undefined =>
lines.find((line) => offset >= line.start && offset <= line.end);
@@ -183,6 +266,12 @@ export function createCodePane(): CodePane {
show(snapshot) {
path.textContent = snapshot.source.path;
const source = snapshot.source.text;
+ snapshotRevision = snapshot.revision;
+ sourceText = source;
+ if (!editing || !dirty) {
+ editor.value = source;
+ editingRevision = snapshot.revision;
+ }
const tokens: readonly Token[] = tokenizeSvml(source);
const tones = markerTones(snapshot);
lines = [];
diff --git a/packages/svml-playground/src/ui/main.ts b/packages/studio/src/ui/main.ts
similarity index 53%
rename from packages/svml-playground/src/ui/main.ts
rename to packages/studio/src/ui/main.ts
index 6b9d9d7d..71e3dc18 100644
--- a/packages/svml-playground/src/ui/main.ts
+++ b/packages/studio/src/ui/main.ts
@@ -1,4 +1,4 @@
-import type { PlaygroundFailure, PlaygroundSnapshot, Range as SourceRange } from "../shared.js";
+import type { StudioFailure, StudioSnapshot } from "../shared.js";
import { createCodePane } from "./code.js";
import { createHandle } from "./resize.js";
import type { Highlight } from "./code.js";
@@ -11,18 +11,36 @@ import "../style.css";
const app = document.querySelector<HTMLElement>("#app")!;
app.innerHTML = `
<header class="topbar">
- <div><strong>SVML Playground</strong></div>
+ <div class="brand">
+ <span class="brand-mark">H</span>
+ <div><strong>Hypit Studio</strong><small>SVML workspace</small></div>
+ </div>
+ <div class="project-title" data-project></div>
<div class="meta" data-meta></div>
<div class="badges" data-badges></div>
- <div class="status" data-status>Reading…</div>
+ <div class="status" data-status><i></i><span>Reading…</span></div>
</header>
- <main>
- <div class="left">
- <div data-stage></div>
- <section class="inspector" data-inspector></section>
- <div data-timeline></div>
- </div>
- <div class="right" data-code></div>
+ <main class="studio-shell">
+ <aside class="source-panel" data-code></aside>
+ <section class="workbench">
+ <div class="preview-row">
+ <div class="preview-panel" data-stage></div>
+ <aside class="workspace-panel">
+ <div class="pane-heading workspace-heading">
+ <div class="pane-title">
+ <span class="material-symbols-rounded pane-icon">tune</span>
+ <div><h2>Inspector</h2><span>Selected item</span></div>
+ </div>
+ </div>
+ <div class="workspace-scroll">
+ <section class="workspace-section">
+ <div class="inspector" data-inspector></div>
+ </section>
+ </div>
+ </aside>
+ </div>
+ <div class="timeline-panel" data-timeline></div>
+ </section>
</main>
<pre class="failure" data-failure></pre>`;
@@ -34,75 +52,78 @@ app.querySelector<HTMLElement>("[data-code]")!.append(code.element);
app.querySelector<HTMLElement>("[data-timeline]")!.append(timeline.element);
app.querySelector<HTMLElement>("[data-stage]")!.append(stage.element);
-// How much room the Source needs against how much the picture needs depends on
-// the Source and on what is being worked on, so both edges are the reader's.
-const shell = app.querySelector<HTMLElement>("main")!;
-const left = app.querySelector<HTMLElement>(".left")!;
-shell.insertBefore(createHandle({
- axis: "column", initial: 520, minimum: 320, invert: true,
- maximum: () => Math.max(360, shell.clientWidth - 420),
- apply: (size) => { shell.style.gridTemplateColumns = `minmax(0,1fr) auto ${size}px`; },
- remember: "svml-playground.code-width",
-}), app.querySelector<HTMLElement>(".right")!);
-left.insertBefore(createHandle({
- axis: "row", initial: 288, minimum: 140, invert: true,
- maximum: () => Math.max(160, left.clientHeight - 260),
- apply: (size) => { left.style.gridTemplateRows = `minmax(0,1fr) auto auto ${size}px`; },
- remember: "svml-playground.timeline-height",
+// The source, picture, workspace and timeline all need different amounts of
+// room for different jobs, so each boundary is draggable and remembered.
+const shell = app.querySelector<HTMLElement>(".studio-shell")!;
+const workbench = app.querySelector<HTMLElement>(".workbench")!;
+const previewRow = app.querySelector<HTMLElement>(".preview-row")!;
+const workspacePanel = app.querySelector<HTMLElement>(".workspace-panel")!;
+const sourceHandle = createHandle({
+ axis: "column", initial: 390, minimum: 280,
+ maximum: () => Math.max(320, shell.clientWidth - 760),
+ apply: (size) => { shell.style.setProperty("--source-width", `${size}px`); },
+ remember: "hypit-studio.source-width",
+});
+sourceHandle.classList.add("source-handle");
+shell.insertBefore(sourceHandle, workbench);
+const workspaceHandle = createHandle({
+ axis: "column", initial: 300, minimum: 240, invert: true,
+ maximum: () => Math.max(260, previewRow.clientWidth - 360),
+ apply: (size) => { previewRow.style.setProperty("--workspace-width", `${size}px`); },
+ remember: "hypit-studio.workspace-width",
+});
+workspaceHandle.classList.add("workspace-handle");
+previewRow.insertBefore(workspaceHandle, workspacePanel);
+workbench.insertBefore(createHandle({
+ axis: "row", initial: 330, minimum: 176, invert: true,
+ maximum: () => Math.max(220, workbench.clientHeight - 260),
+ apply: (size) => { workbench.style.setProperty("--timeline-height", `${size}px`); },
+ remember: "hypit-studio.timeline-height",
}), app.querySelector<HTMLElement>("[data-timeline]")!);
const inspector = app.querySelector<HTMLElement>("[data-inspector]")!;
const meta = app.querySelector<HTMLElement>("[data-meta]")!;
+const project = app.querySelector<HTMLElement>("[data-project]")!;
const badges = app.querySelector<HTMLElement>("[data-badges]")!;
const status = app.querySelector<HTMLElement>("[data-status]")!;
const failureView = app.querySelector<HTMLElement>("[data-failure]")!;
-/**
- * How much of what is shown was invented.
- *
- * One badge over the whole programme said "picture: measured" while two Tracks
- * were showing a stand-in, because a single word cannot describe seven Tracks
- * that differ. Each Track now says its own; this counts them, and clicking it
- * is the same as reading them.
- */
-function renderBadges(snapshot: PlaygroundSnapshot): void {
+function renderBadges(_snapshot: StudioSnapshot): void {
badges.replaceChildren();
- const standing = snapshot.tracks.filter((track) => track.source !== "made");
- if (standing.length === 0) return;
- const badge = document.createElement("span");
- badge.className = "badge badge-estimated";
- badge.textContent = `${standing.length} of ${snapshot.tracks.length} tracks are standing in`;
- badge.title = snapshot.provenance.note;
- badges.append(badge);
}
// Program-level facts never change while a Source is being read, so they live in
// the header rather than taking a panel that would have to sit over something.
-function renderMeta(snapshot: PlaygroundSnapshot): void {
+function renderMeta(snapshot: StudioSnapshot): void {
const { space } = snapshot;
+ project.textContent = snapshot.source.path.split("/").at(-1) ?? snapshot.source.path;
+ project.title = snapshot.source.path;
meta.textContent = [
`${space.canvasWidth}x${space.canvasHeight}`,
`${space.frameRate.numerator}/${space.frameRate.denominator}fps`,
- `${space.frameCount}f (${space.durationSec.toFixed(2)}s)`,
- ].join(" ");
+ `${space.durationSec.toFixed(2)}s`,
+ ].join(" · ");
}
-function cell(label: string, value: string, tone?: string): HTMLElement {
+function property(label: string, value: string, tone?: string): HTMLElement {
const node = document.createElement("div");
- node.className = `cell${tone === undefined ? "" : ` ${tone}`}`;
- node.innerHTML = "<dt></dt><dd></dd>";
- node.querySelector("dt")!.textContent = label;
- node.querySelector("dd")!.textContent = value;
+ node.className = `property${tone === undefined ? "" : ` ${tone}`}`;
+ node.innerHTML = "<span></span><strong></strong>";
+ node.querySelector("span")!.textContent = label;
+ node.querySelector("strong")!.textContent = value;
+ node.querySelector("strong")!.title = value;
return node;
}
-/** The Script marker a clip is bound to, or its own id when it binds nothing. */
-function bindingId(clip: { readonly binding: { readonly kind: string; readonly id?: string }; readonly id: string }): string {
- return clip.binding.id ?? clip.id;
-}
-
-function box(value: { widthPx: number; heightPx: number; xPx: number; yPx: number }): string {
- return `${Math.round(value.widthPx)}x${Math.round(value.heightPx)}`
- + ` at ${Math.round(value.xPx)},${Math.round(value.yPx)}`;
+function group(label: string, items: readonly HTMLElement[], className = ""): HTMLElement {
+ const node = document.createElement("section");
+ node.className = `property-group${className.length === 0 ? "" : ` ${className}`}`;
+ const heading = document.createElement("h3");
+ heading.textContent = label;
+ const content = document.createElement("div");
+ content.className = "property-grid";
+ content.append(...items);
+ node.append(heading, content);
+ return node;
}
/**
@@ -110,37 +131,58 @@ function box(value: { widthPx: number; heightPx: number; xPx: number; yPx: numbe
* layout rather than a floating card, so it can never cover the frame being
* inspected or the transport used to reach it.
*/
-function renderInspector(snapshot: PlaygroundSnapshot, clipId: string | undefined): void {
+function renderInspector(snapshot: StudioSnapshot, clipId: string | undefined): void {
const clip = clipId === undefined ? undefined : store.clip(clipId);
- const cells: HTMLElement[] = [];
if (clip === undefined) {
- cells.push(cell("selected", "nothing - click a marked line or a timeline clip"));
- } else {
- const fps = snapshot.space.frameRate.numerator / snapshot.space.frameRate.denominator;
- const seconds = (clip.endFrameExclusive - clip.startFrame) / fps;
- cells.push(
- cell("clip", clip.label, "wide"),
- cell("present", clip.id),
- cell("span", `${clip.startFrame}-${clip.endFrameExclusive}f (${seconds.toFixed(2)}s)`),
- cell("stack", String(clip.stackOrder)),
- );
- if (clip.standIn !== undefined) {
- cells.push(cell("showing", clip.standIn === "picture"
- ? "a picture this shot names - the shot itself has not been made"
- : "a black frame - this shot has no material and names no picture", "warn"));
- }
+ const empty = document.createElement("div");
+ empty.className = "inspector-empty";
+ empty.innerHTML = `<span class="material-symbols-rounded">select</span><strong>Nothing selected</strong><small>Choose a clip, source marker, or object in the preview.</small>`;
+ inspector.replaceChildren(empty);
+ return;
}
- for (const item of snapshot.refused) {
- cells.push(cell(`${item.output} not shown`, item.reason, "warn"));
- }
+ const fps = snapshot.space.frameRate.numerator / snapshot.space.frameRate.denominator;
+ const durationFrames = clip.endFrameExclusive - clip.startFrame;
+ const track = snapshot.tracks.find((item) => item.clips.some((candidate) => candidate.id === clip.id));
+ const hero = document.createElement("div");
+ hero.className = "selection-hero";
+ hero.innerHTML = `
+ <span class="selection-icon"><span class="material-symbols-rounded">widgets</span></span>
+ <div class="selection-title"><strong></strong><small></small></div>
+ <span class="selection-kind">Visual</span>`;
+ hero.querySelector("strong")!.textContent = clip.label;
+ hero.querySelector("small")!.textContent = track?.label ?? "Visual track";
- for (const track of snapshot.tracks) {
- if (track.waiting === undefined) continue;
- cells.push(cell(`${track.label} not shown`, `waiting on ${track.waiting.join(", ")}`, "warn"));
- }
- inspector.replaceChildren(...cells);
+ const timing = group("Timing", [
+ property("Start", `${clip.startFrame}f`),
+ property("End", `${clip.endFrameExclusive}f`),
+ property("Duration", `${durationFrames}f`),
+ property("Seconds", `${(durationFrames / fps).toFixed(2)}s`),
+ ]);
+ const identity = group("Binding", [
+ property("Authored id", clip.authoredId, "property-wide property-code"),
+ ...(clip.markerId === undefined
+ ? []
+ : [property("Script marker", clip.markerId, "property-wide property-code")]),
+ property("Present id", clip.id, "property-wide property-code"),
+ ]);
+ const composition = group("Composition", [
+ property("Track", track?.label ?? "—", "property-wide"),
+ property("Stack order", String(clip.stackOrder)),
+ property("Source", track?.provenance.origin ?? "source"),
+ ]);
+ const run = group("Run provenance", [
+ property("Output", track?.provenance.output ?? "—", "property-wide property-code"),
+ property("Candidate", track?.provenance.candidateId ?? "—", "property-wide property-code"),
+ property("Origin", track?.provenance.origin ?? "none"),
+ property("Status", track?.provenance.status ?? "unresolved"),
+ ...(track === undefined || track.provenance.errors.length === 0
+ ? []
+ : [property("Error", track.provenance.errors.join(" "), "property-wide property-code")]),
+ ]);
+ const sections: HTMLElement[] = [hero, timing, composition, identity, run];
+ inspector.replaceChildren(...sections);
}
// The word being spoken at the playhead, which is the point of carrying token
@@ -197,6 +239,7 @@ store.subscribe(({ snapshot, selection, playhead }) => {
// instant it covers. The lines that bind something carry a coloured gutter bar,
// so what is clickable is visible standing still.
code.element.addEventListener("click", (event) => {
+ if ((event.target as HTMLElement | null)?.closest("button, textarea") !== null) return;
const state = store.current();
if (state === undefined) return;
const offset = code.offsetAt(event);
@@ -253,29 +296,29 @@ window.addEventListener("keydown", (event) => {
event.preventDefault();
});
-function applySnapshot(snapshot: PlaygroundSnapshot): void {
+function applySnapshot(snapshot: StudioSnapshot): void {
failureView.textContent = "";
status.className = "status ok";
- status.textContent = `Watching ${snapshot.source.path} - revision ${snapshot.revision}`;
+ status.innerHTML = `<i></i><span>Live · r${snapshot.revision}</span>`;
renderMeta(snapshot);
renderBadges(snapshot);
code.show(snapshot);
store.load(snapshot);
}
-function applyFailure(failure: PlaygroundFailure): void {
+function applyFailure(failure: StudioFailure): void {
status.className = "status error";
- status.textContent = `Read failed - revision ${failure.revision}`;
+ status.innerHTML = `<i></i><span>Compile failed · r${failure.revision}</span>`;
failureView.textContent = failure.error;
if (failure.range !== undefined) code.highlight([{ range: failure.range, tone: "element" }], true);
}
-const response = await fetch("/__svml/session");
-const initial = await response.json() as PlaygroundSnapshot | PlaygroundFailure;
+const response = await fetch("/__studio/session");
+const initial = await response.json() as StudioSnapshot | StudioFailure;
if (response.ok && "tracks" in initial) applySnapshot(initial);
-else applyFailure(initial as PlaygroundFailure);
+else applyFailure(initial as StudioFailure);
type Hot = { on(event: string, listener: (value: unknown) => void): void };
const hot = (import.meta as ImportMeta & { hot?: Hot }).hot;
-hot?.on("svml:snapshot", (value) => applySnapshot(value as PlaygroundSnapshot));
-hot?.on("svml:error", (value) => applyFailure(value as PlaygroundFailure));
+hot?.on("studio:snapshot", (value) => applySnapshot(value as StudioSnapshot));
+hot?.on("studio:error", (value) => applyFailure(value as StudioFailure));
diff --git a/packages/svml-playground/src/ui/markers.ts b/packages/studio/src/ui/markers.ts
similarity index 91%
rename from packages/svml-playground/src/ui/markers.ts
rename to packages/studio/src/ui/markers.ts
index 1bcdca58..f40a448c 100644
--- a/packages/svml-playground/src/ui/markers.ts
+++ b/packages/studio/src/ui/markers.ts
@@ -1,4 +1,4 @@
-import type { PlaygroundSnapshot, Range } from "../shared.js";
+import type { Range, StudioSnapshot } from "../shared.js";
/** How many distinct depth tones the stylesheet defines. */
export const MARKER_TONES = 4;
@@ -16,7 +16,7 @@ export const MARKER_TONES = 4;
* The three panes have to agree, or the colour would carry no meaning: a marker
* pair in the prose and the clip it binds are the same fact seen twice.
*/
-export function markerTones(snapshot: PlaygroundSnapshot): ReadonlyMap<string, number> {
+export function markerTones(snapshot: StudioSnapshot): ReadonlyMap<string, number> {
const tones = new Map<string, number>();
for (const segment of snapshot.script?.segments ?? []) {
tones.set(segment.id, segment.depth % MARKER_TONES);
@@ -72,7 +72,7 @@ export type ScriptSpan = {
};
/** Every Segment and Selection, placed on the timeline by the tokens it holds. */
-export function scriptSpans(snapshot: PlaygroundSnapshot): readonly ScriptSpan[] {
+export function scriptSpans(snapshot: StudioSnapshot): readonly ScriptSpan[] {
const tokens = snapshot.script?.tokens ?? [];
const placed: ScriptSpan[] = [];
const spans = [
@@ -99,7 +99,7 @@ export function scriptSpans(snapshot: PlaygroundSnapshot): readonly ScriptSpan[]
return placed;
}
-export function liveRanges(snapshot: PlaygroundSnapshot, frame: number): readonly ScriptSpan[] {
+export function liveRanges(snapshot: StudioSnapshot, frame: number): readonly ScriptSpan[] {
// Outermost first: an inner outline is drawn last and sits inside its parent.
return scriptSpans(snapshot)
.filter((span) => frame >= span.startFrame && frame < span.endFrame)
@@ -114,7 +114,7 @@ export function liveRanges(snapshot: PlaygroundSnapshot, frame: number): readonl
* would send a click on `@amount` to whatever encloses it, because a marker that
* places nothing still means something.
*/
-export function spanAtOffset(snapshot: PlaygroundSnapshot, offset: number): ScriptSpan | undefined {
+export function spanAtOffset(snapshot: StudioSnapshot, offset: number): ScriptSpan | undefined {
return scriptSpans(snapshot)
.filter((span) => offset >= span.range.start && offset <= span.range.end)
.sort((left, right) =>
diff --git a/packages/svml-playground/src/ui/overlay.ts b/packages/studio/src/ui/overlay.ts
similarity index 96%
rename from packages/svml-playground/src/ui/overlay.ts
rename to packages/studio/src/ui/overlay.ts
index 8242c636..e85eaafd 100644
--- a/packages/svml-playground/src/ui/overlay.ts
+++ b/packages/studio/src/ui/overlay.ts
@@ -1,4 +1,4 @@
-import type { Clip, PlaygroundSnapshot } from "../shared.js";
+import type { Clip, StudioSnapshot } from "../shared.js";
import { markerTones } from "./markers.js";
import type { Store } from "./selection.js";
@@ -64,7 +64,7 @@ export function createOverlay(store: Store, measure: Measure): Overlay {
let live: readonly Clip[] = [];
let canvas = { width: 1, height: 1 };
- let last: { snapshot: PlaygroundSnapshot; selected: Clip | undefined; frame: number } | undefined;
+ let last: { snapshot: StudioSnapshot; selected: Clip | undefined; frame: number } | undefined;
/**
* The box is measured off the picture rather than restated from the Source:
diff --git a/packages/svml-playground/src/ui/resize.ts b/packages/studio/src/ui/resize.ts
similarity index 100%
rename from packages/svml-playground/src/ui/resize.ts
rename to packages/studio/src/ui/resize.ts
diff --git a/packages/svml-playground/src/ui/selection.ts b/packages/studio/src/ui/selection.ts
similarity index 94%
rename from packages/svml-playground/src/ui/selection.ts
rename to packages/studio/src/ui/selection.ts
index b95d9501..d16f6e33 100644
--- a/packages/svml-playground/src/ui/selection.ts
+++ b/packages/studio/src/ui/selection.ts
@@ -1,4 +1,4 @@
-import type { Clip, PlaygroundSnapshot } from "../shared.js";
+import type { Clip, StudioSnapshot } from "../shared.js";
/**
* Which pane the user acted in. Panes ignore events they originated, which is
@@ -14,7 +14,7 @@ export type Selection =
export type Playhead = { readonly frame: number; readonly origin: Origin | "play" };
export type State = {
- readonly snapshot: PlaygroundSnapshot;
+ readonly snapshot: StudioSnapshot;
readonly selection: Selection;
readonly playhead: Playhead;
};
@@ -25,7 +25,7 @@ export type Store = {
clip(clipId: string): Clip | undefined;
/** Clips covering a frame, topmost track first. */
clipsAt(frame: number): readonly Clip[];
- load(snapshot: PlaygroundSnapshot): void;
+ load(snapshot: StudioSnapshot): void;
selectClip(clipId: string, origin: Origin): void;
/**
* Look at one instant, optionally selecting a clip there. Used when the thing
@@ -46,7 +46,7 @@ export type Store = {
* prose would select the Speech Take instead of the B-roll. Ties break toward
* the tightest range, which is the most specific thing under the cursor.
*/
-export function clipAtOffset(snapshot: PlaygroundSnapshot, offset: number): Clip | undefined {
+export function clipAtOffset(snapshot: StudioSnapshot, offset: number): Clip | undefined {
const clips = snapshot.tracks.flatMap((track) => track.clips);
const within = (range: { readonly start: number; readonly end: number } | undefined): number =>
range === undefined || offset < range.start || offset > range.end
@@ -66,7 +66,7 @@ export function clipAtOffset(snapshot: PlaygroundSnapshot, offset: number): Clip
}
export function createStore(): Store {
- let snapshot: PlaygroundSnapshot | undefined;
+ let snapshot: StudioSnapshot | undefined;
let selection: Selection = { kind: "none" };
let playhead: Playhead = { frame: 0, origin: "timeline" };
const listeners: ((state: State) => void)[] = [];
diff --git a/packages/svml-playground/src/ui/stage.ts b/packages/studio/src/ui/stage.ts
similarity index 77%
rename from packages/svml-playground/src/ui/stage.ts
rename to packages/studio/src/ui/stage.ts
index 536a92e9..42908a06 100644
--- a/packages/svml-playground/src/ui/stage.ts
+++ b/packages/studio/src/ui/stage.ts
@@ -1,4 +1,4 @@
-import type { PlaygroundSnapshot } from "../shared.js";
+import type { StudioSnapshot } from "../shared.js";
import { createOverlay } from "./overlay.js";
import type { State, Store } from "./selection.js";
@@ -20,15 +20,26 @@ export function createStage(store: Store): Stage {
const element = document.createElement("section");
element.className = "stage";
element.innerHTML = `
+ <div class="stage-heading">
+ <div class="stage-title"><span class="material-symbols-rounded">smart_display</span><strong>Preview</strong></div>
+ <span class="stage-canvas" data-canvas></span>
+ </div>
<div class="stage-viewport">
<div class="stage-scaler">
- <iframe title="Preview" sandbox="allow-scripts allow-same-origin"></iframe>
+ <iframe title="Preview" sandbox="allow-scripts allow-same-origin" allow="autoplay"></iframe>
</div>
</div>
<div class="stage-bar">
+ <span class="stage-time" data-time>00:00:00</span>
+ <button type="button" data-previous aria-label="Previous frame" title="Previous frame">
+ <span class="material-symbols-rounded">skip_previous</span>
+ </button>
<button type="button" data-play aria-label="Play">
<span class="material-symbols-rounded" data-icon>play_arrow</span>
</button>
+ <button type="button" data-next aria-label="Next frame" title="Next frame">
+ <span class="material-symbols-rounded">skip_next</span>
+ </button>
<button type="button" data-mute aria-label="Mute" class="stage-mute">
<span class="material-symbols-rounded" data-mute-icon>volume_up</span>
</button>
@@ -77,14 +88,18 @@ export function createStage(store: Store): Stage {
if (event.target === viewport) store.clearSelection();
});
const play = element.querySelector<HTMLButtonElement>("[data-play]")!;
+ const previous = element.querySelector<HTMLButtonElement>("[data-previous]")!;
+ const next = element.querySelector<HTMLButtonElement>("[data-next]")!;
const icon = element.querySelector<HTMLElement>("[data-icon]")!;
const mute = element.querySelector<HTMLButtonElement>("[data-mute]")!;
const muteIcon = element.querySelector<HTMLElement>("[data-mute-icon]")!;
+ const time = element.querySelector<HTMLElement>("[data-time]")!;
+ const canvas = element.querySelector<HTMLElement>("[data-canvas]")!;
type SeekWindow = Window & {
- __svmlSeekFrame?: (frame: number) => void;
- __svmlPlayFrame?: (frame: number) => void;
- __svmlSetMuted?: (muted: boolean) => void;
+ __hypitSeekFrame?: (frame: number) => void;
+ __hypitPlayFrame?: (frame: number) => void;
+ __hypitSetMuted?: (muted: boolean) => void;
};
let state: State | undefined;
let mounted = -1;
@@ -98,7 +113,7 @@ export function createStage(store: Store): Stage {
let fromFrame = 0;
let began = 0;
- const fps = (snapshot: PlaygroundSnapshot): number =>
+ const fps = (snapshot: StudioSnapshot): number =>
snapshot.space.frameRate.numerator / snapshot.space.frameRate.denominator;
const fit = (): void => {
@@ -128,7 +143,7 @@ export function createStage(store: Store): Stage {
raf = 0;
// Settle the picture on the frame the transport stopped at.
if (wasPlaying && state !== undefined && ready) {
- (iframe.contentWindow as SeekWindow | null)?.__svmlSeekFrame?.(state.playhead.frame);
+ (iframe.contentWindow as SeekWindow | null)?.__hypitSeekFrame?.(state.playhead.frame);
}
};
@@ -141,6 +156,7 @@ export function createStage(store: Store): Stage {
const total = state.snapshot.space.frameCount;
const rate = fps(state.snapshot);
fromFrame = state.playhead.frame >= total - 1 ? 0 : state.playhead.frame;
+ if (ready) (iframe.contentWindow as SeekWindow | null)?.__hypitPlayFrame?.(fromFrame);
began = performance.now();
const step = (now: number): void => {
const at = fromFrame + Math.round((now - began) / 1000 * rate);
@@ -151,17 +167,23 @@ export function createStage(store: Store): Stage {
raf = requestAnimationFrame(step);
};
play.addEventListener("click", toggle);
+ previous.addEventListener("click", () => {
+ if (state !== undefined) store.seek(state.playhead.frame - 1, "video");
+ });
+ next.addEventListener("click", () => {
+ if (state !== undefined) store.seek(state.playhead.frame + 1, "video");
+ });
const applyMuted = (): void => {
muteIcon.textContent = muted ? "volume_off" : "volume_up";
mute.setAttribute("aria-label", muted ? "Unmute" : "Mute");
- (iframe.contentWindow as SeekWindow | null)?.__svmlSetMuted?.(muted);
+ (iframe.contentWindow as SeekWindow | null)?.__hypitSetMuted?.(muted);
};
mute.addEventListener("click", () => { muted = !muted; applyMuted(); });
iframe.addEventListener("load", () => {
ready = true;
- if (state !== undefined) (iframe.contentWindow as SeekWindow | null)?.__svmlSeekFrame?.(state.playhead.frame);
+ if (state !== undefined) (iframe.contentWindow as SeekWindow | null)?.__hypitSeekFrame?.(state.playhead.frame);
applyMuted();
// The box could not be measured until now.
overlay.refresh();
@@ -172,6 +194,11 @@ export function createStage(store: Store): Stage {
store.subscribe((value) => {
const first = state === undefined;
state = value;
+ const frameRate = fps(value.snapshot);
+ const seconds = value.playhead.frame / frameRate;
+ const whole = Math.floor(seconds);
+ time.textContent = `${String(Math.floor(whole / 60)).padStart(2, "0")}:${String(whole % 60).padStart(2, "0")}:${String(value.playhead.frame % Math.round(frameRate)).padStart(2, "0")}`;
+ canvas.textContent = `${value.snapshot.space.canvasWidth} × ${value.snapshot.space.canvasHeight}`;
if (value.snapshot.revision !== mounted) {
mounted = value.snapshot.revision;
stop();
@@ -194,8 +221,8 @@ export function createStage(store: Store): Stage {
}
if (!ready) return;
const frame = (iframe.contentWindow as SeekWindow | null);
- if (playing) frame?.__svmlPlayFrame?.(value.playhead.frame);
- else frame?.__svmlSeekFrame?.(value.playhead.frame);
+ if (playing) frame?.__hypitPlayFrame?.(value.playhead.frame);
+ else frame?.__hypitSeekFrame?.(value.playhead.frame);
// The overlay subscribed first, so it measured the picture as it was before
// this seek. Redraw now that the picture has moved.
overlay.refresh();
diff --git a/packages/svml-playground/src/ui/syntax.ts b/packages/studio/src/ui/syntax.ts
similarity index 100%
rename from packages/svml-playground/src/ui/syntax.ts
rename to packages/studio/src/ui/syntax.ts
diff --git a/packages/studio/src/ui/timeline.ts b/packages/studio/src/ui/timeline.ts
new file mode 100644
index 00000000..c3b11ea7
--- /dev/null
+++ b/packages/studio/src/ui/timeline.ts
@@ -0,0 +1,475 @@
+import type { SemanticAnchor, SemanticToken, StudioSnapshot } from "../shared.js";
+import { markerTones } from "./markers.js";
+import type { State, Store } from "./selection.js";
+import { createZoom } from "./zoom.js";
+
+export type Timeline = { readonly element: HTMLElement };
+
+/** Ruler ticks land on whole seconds until that gets too dense, then on 5s / 10s. */
+function tickSeconds(durationSec: number, widthPx: number): number {
+ for (const step of [1, 2, 5, 10, 15, 30, 60]) {
+ if (durationSec / step <= Math.max(2, widthPx / 64)) return step;
+ }
+ return 120;
+}
+
+function timecode(seconds: number): string {
+ const whole = Math.floor(seconds);
+ return `${String(Math.floor(whole / 60)).padStart(2, "0")}:${String(whole % 60).padStart(2, "0")}`;
+}
+
+function trackKind(label: string, id: string): string {
+ const value = `${label} ${id}`.toLowerCase();
+ if (value.includes("caption") || value.includes("subtitle")) return "caption";
+ if (value.includes("speech") || value.includes("spine") || value.includes("a-roll")) return "speech";
+ if (value.includes("audio") || value.includes("music") || value.includes("sound")) return "audio";
+ if (value.includes("ranking") || value.includes("comment") || value.includes("component")) return "component";
+ if (value.includes("media") || value.includes("b-roll") || value.includes("image") || value.includes("video")) return "media";
+ return "visual";
+}
+
+function trackIcon(kind: string): string {
+ return {
+ caption: "subtitles",
+ speech: "record_voice_over",
+ audio: "graphic_eq",
+ component: "widgets",
+ media: "movie",
+ visual: "layers",
+ }[kind] ?? "layers";
+}
+
+/**
+ * A cutting-room timeline read straight from the Source: the Speech Spine on the
+ * bottom track, every Media Item above it on one shared track, exactly as an
+ * editor would lay them out.
+ */
+/** One row of one Track. A Track with overlapping clips is several rows tall. */
+const LANE_HEIGHT = 52;
+const SEMANTIC_HEIGHT = 72;
+
+/** Tracks the reader has opened. A Track shows only its front row until then. */
+const opened = new Set<string>();
+
+/**
+ * Where a frame sits across the strip, once the zoom window is taken into
+ * account. Everything the timeline draws goes through here, so the ruler, the
+ * clips and the playhead cannot disagree about where a moment is.
+ */
+function place(frame: number, frameCount: number, shown: { start: number; end: number }): number {
+ const span = Math.max(1e-6, shown.end - shown.start);
+ return (frame / Math.max(1, frameCount) - shown.start) / span;
+}
+
+export function createTimeline(store: Store): Timeline {
+ const element = document.createElement("section");
+ element.className = "timeline";
+ element.innerHTML = `
+ <div class="timeline-toolbar">
+ <div class="timeline-title">
+ <span class="material-symbols-rounded">view_timeline</span>
+ <strong>Timeline</strong>
+ <span class="timeline-mode"><i></i>Semantic + frame timebase</span>
+ </div>
+ <div class="timeline-readout" data-readout></div>
+ <div class="timeline-view-actions">
+ <span class="timeline-hint">⌘ scroll to zoom</span>
+ <button type="button" class="icon-button" data-zoom-out aria-label="Zoom out" title="Zoom out">
+ <span class="material-symbols-rounded">remove</span>
+ </button>
+ <button type="button" class="icon-button" data-zoom-fit aria-label="Fit timeline" title="Fit timeline">
+ <span class="material-symbols-rounded">fit_screen</span>
+ </button>
+ <button type="button" class="icon-button" data-zoom-in aria-label="Zoom in" title="Zoom in">
+ <span class="material-symbols-rounded">add</span>
+ </button>
+ </div>
+ </div>
+ <div class="timeline-body">
+ <div class="timeline-labels" data-labels></div>
+ <div class="timeline-lanes" data-lanes>
+ <div class="ruler" data-ruler></div>
+ <div class="lanes" data-rows></div>
+ <div class="playhead" data-playhead><div class="playhead-grip"></div></div>
+ </div>
+ </div>
+ <div class="timeline-zoom" data-zoom></div>`;
+
+ const readout = element.querySelector<HTMLElement>("[data-readout]")!;
+ const labels = element.querySelector<HTMLElement>("[data-labels]")!;
+ const lanes = element.querySelector<HTMLElement>("[data-lanes]")!;
+ // The whole programme as a bar, with the shown part as a window inside it.
+ const zoom = createZoom();
+ element.querySelector<HTMLElement>("[data-zoom]")!.append(zoom.element);
+ element.querySelector<HTMLButtonElement>("[data-zoom-out]")!
+ .addEventListener("click", () => zoom.pinch(0.5, 1.45));
+ element.querySelector<HTMLButtonElement>("[data-zoom-in]")!
+ .addEventListener("click", () => zoom.pinch(0.5, 0.68));
+ element.querySelector<HTMLButtonElement>("[data-zoom-fit]")!
+ .addEventListener("click", () => zoom.fit());
+ // Positions are computed against the window rather than scaled, so a clip's
+ // label stays the size it was however far in the reader has zoomed.
+ const ruler = element.querySelector<HTMLElement>("[data-ruler]")!;
+ const rows = element.querySelector<HTMLElement>("[data-rows]")!;
+ const playhead = element.querySelector<HTMLElement>("[data-playhead]")!;
+
+ let state: State | undefined;
+ let built = -1;
+ let clipNodes: readonly { readonly node: HTMLElement; readonly start: number; readonly end: number; readonly id: string }[] = [];
+ let semanticNodes: readonly { readonly node: HTMLElement; readonly start: number; readonly end: number; readonly kind: "segment" | "word" }[] = [];
+ let paintFrame = 0;
+
+ const fps = (snapshot: StudioSnapshot): number =>
+ snapshot.space.frameRate.numerator / snapshot.space.frameRate.denominator;
+
+ const frameAt = (clientX: number): number => {
+ const box = lanes.getBoundingClientRect();
+ if (box.width === 0 || state === undefined) return 0;
+ // Where the pointer is inside the window that is shown, not inside the
+ // whole programme; zoomed in, the two are different places.
+ const across = (clientX - box.left) / box.width;
+ const shown = zoom.window();
+ const ratio = shown.start + across * (shown.end - shown.start);
+ return Math.floor(ratio * state.snapshot.space.frameCount);
+ };
+
+ const scrub = (event: PointerEvent): void => {
+ // Capture keeps a drag alive past the edge of the lanes, but it is not
+ // essential: never let it stop the seek that the author actually asked for.
+ try { lanes.setPointerCapture(event.pointerId); } catch { /* drag stays local */ }
+ store.seek(frameAt(event.clientX), "timeline");
+ };
+
+ lanes.addEventListener("pointerdown", (event) => {
+ // A click on a clip selects it; a click on open track or the ruler moves the
+ // playhead and lets go of whatever was selected, because open track is the
+ // one place that plainly means "not that one".
+ if ((event.target as HTMLElement).closest(".clip") !== null) return;
+ store.clearSelection();
+ scrub(event);
+ });
+ lanes.addEventListener("pointermove", (event) => {
+ if (event.buttons === 1 && lanes.hasPointerCapture(event.pointerId)) {
+ store.seek(frameAt(event.clientX), "timeline");
+ }
+ });
+
+ const drawRuler = (snapshot: StudioSnapshot): void => {
+ ruler.replaceChildren();
+ const width = lanes.clientWidth;
+ const step = tickSeconds(snapshot.space.durationSec, width);
+ for (let seconds = 0; seconds <= snapshot.space.durationSec; seconds += step) {
+ const tick = document.createElement("span");
+ tick.className = "tick";
+ const frame = seconds * snapshot.space.frameRate.numerator / snapshot.space.frameRate.denominator;
+ const at = place(frame, snapshot.space.frameCount, zoom.window());
+ tick.style.left = `${at * 100}%`;
+ // A label near the end would hang past the strip and give the panel a
+ // width nothing occupies, so the last one reads back from its own mark.
+ if (at > 0.94) tick.classList.add("tick-last");
+ tick.textContent = timecode(seconds);
+ ruler.append(tick);
+ }
+ };
+
+ const build = (snapshot: StudioSnapshot): void => {
+ labels.replaceChildren();
+ rows.replaceChildren();
+ const nextClipNodes: { node: HTMLElement; start: number; end: number; id: string }[] = [];
+ const tones = markerTones(snapshot);
+
+ const corner = document.createElement("div");
+ corner.className = "label-corner";
+ corner.textContent = `${snapshot.space.frameCount}f`;
+ labels.append(corner);
+
+ const nextSemanticNodes: { node: HTMLElement; start: number; end: number; kind: "segment" | "word" }[] = [];
+ const semanticTextNodes: { node: HTMLElement; label: HTMLElement }[] = [];
+ if (snapshot.semantic !== undefined && snapshot.semantic.segments.length > 0) {
+ const semanticLabel = document.createElement("div");
+ semanticLabel.className = "track-label semantic-label track-visual";
+ semanticLabel.style.height = `${SEMANTIC_HEIGHT}px`;
+ semanticLabel.innerHTML = `
+ <span class="material-symbols-rounded track-icon">timeline</span>
+ <span class="track-copy"><strong>Semantic</strong><small></small></span>
+ <span class="track-state"></span>`;
+ const semanticSource = snapshot.semantic.provenance.candidateId === undefined
+ ? "no candidate"
+ : `${snapshot.semantic.provenance.origin} candidate`;
+ semanticLabel.querySelector("small")!.textContent =
+ `${snapshot.semantic.segments.length} segment${snapshot.semantic.segments.length === 1 ? "" : "s"} · ${snapshot.semantic.tokens.length} words · ${snapshot.semantic.provenance.status} · ${semanticSource}`;
+ labels.append(semanticLabel);
+
+ const semanticLane = document.createElement("div");
+ semanticLane.className = "lane semantic-lane";
+ semanticLane.style.height = `${SEMANTIC_HEIGHT}px`;
+ const tokensBySegment = new Map<string, SemanticToken[]>();
+ for (const token of snapshot.semantic.tokens) {
+ const held = tokensBySegment.get(token.segmentId);
+ if (held === undefined) tokensBySegment.set(token.segmentId, [token]);
+ else held.push(token);
+ }
+ const anchorsBySegment = new Map<string, SemanticAnchor[]>();
+ for (const anchor of snapshot.semantic.anchors) {
+ const held = anchorsBySegment.get(anchor.segmentId);
+ if (held === undefined) anchorsBySegment.set(anchor.segmentId, [anchor]);
+ else held.push(anchor);
+ }
+
+ for (const segment of snapshot.semantic.segments) {
+ const from = place(segment.startFrame, snapshot.space.frameCount, zoom.window());
+ const to = place(segment.endFrameExclusive, snapshot.space.frameCount, zoom.window());
+ if (to <= 0 || from >= 1) continue;
+ const visibleFrom = Math.max(0, from);
+ const visibleTo = Math.min(1, to);
+ const node = document.createElement("div");
+ node.className = "semantic-segment";
+ node.setAttribute("role", "button");
+ node.tabIndex = 0;
+ node.dataset.semanticSegment = segment.id;
+ node.style.left = `${visibleFrom * 100}%`;
+ node.style.width = `${Math.max(0, visibleTo - visibleFrom) * 100}%`;
+ node.title = `${segment.id} (${segment.startFrame}-${segment.endFrameExclusive}f) · double-click to focus`;
+ const segmentLabel = document.createElement("span");
+ segmentLabel.className = "semantic-segment-label";
+ segmentLabel.textContent = segment.id;
+ node.append(segmentLabel);
+ semanticTextNodes.push({ node, label: segmentLabel });
+ node.addEventListener("pointerdown", (event) => {
+ event.stopPropagation();
+ store.seek(segment.startFrame, "timeline");
+ });
+ node.addEventListener("dblclick", (event) => {
+ event.stopPropagation();
+ store.seek(segment.startFrame, "timeline");
+ zoom.focus(
+ segment.startFrame / Math.max(1, snapshot.space.frameCount),
+ segment.endFrameExclusive / Math.max(1, snapshot.space.frameCount),
+ );
+ });
+ node.addEventListener("keydown", (event) => {
+ if (event.key !== "Enter" && event.key !== " ") return;
+ event.preventDefault();
+ store.seek(segment.startFrame, "timeline");
+ });
+ nextSemanticNodes.push({ node, start: segment.startFrame, end: segment.endFrameExclusive, kind: "segment" });
+
+ const words = document.createElement("div");
+ words.className = "semantic-words";
+ for (const token of tokensBySegment.get(segment.id) ?? []) {
+ const wordFrom = place(token.startFrame, snapshot.space.frameCount, zoom.window());
+ const wordTo = place(token.endFrameExclusive, snapshot.space.frameCount, zoom.window());
+ if (wordTo <= 0 || wordFrom >= 1) continue;
+ const word = document.createElement("button");
+ word.type = "button";
+ word.className = "semantic-word";
+ word.dataset.semanticToken = token.id;
+ const segmentVisibleSpan = Math.max(1e-6, visibleTo - visibleFrom);
+ const wordVisibleFrom = Math.max(visibleFrom, wordFrom);
+ const wordVisibleTo = Math.min(visibleTo, wordTo);
+ word.style.left = `${Math.max(0, wordVisibleFrom - visibleFrom) / segmentVisibleSpan * 100}%`;
+ word.style.width = `${Math.max(0, wordVisibleTo - wordVisibleFrom) / segmentVisibleSpan * 100}%`;
+ word.title = `${token.text} (${token.startFrame}-${token.endFrameExclusive}f)`;
+ const wordLabel = document.createElement("span");
+ wordLabel.className = "semantic-word-label";
+ wordLabel.textContent = token.text;
+ word.append(wordLabel);
+ semanticTextNodes.push({ node: word, label: wordLabel });
+ word.addEventListener("pointerdown", (event) => {
+ event.stopPropagation();
+ store.seek(token.startFrame, "timeline");
+ });
+ nextSemanticNodes.push({ node: word, start: token.startFrame, end: token.endFrameExclusive, kind: "word" });
+ words.append(word);
+ }
+ node.append(words);
+
+ for (const anchor of anchorsBySegment.get(segment.id) ?? []) {
+ const at = place(anchor.frame, snapshot.space.frameCount, zoom.window());
+ if (at < from || at > to) continue;
+ const tick = document.createElement("span");
+ tick.className = `semantic-anchor semantic-anchor-${anchor.kind}`;
+ tick.style.left = `${(at - from) / Math.max(1e-6, to - from) * 100}%`;
+ tick.title = `${anchor.kind} · ${anchor.frame}f`;
+ node.append(tick);
+ }
+ semanticLane.append(node);
+ }
+ rows.append(semanticLane);
+ // Widths are only meaningful after the lane has entered the document.
+ // Hide labels that cannot fit in full; a clipped word remains a useful
+ // coloured timing block and never becomes an ugly ellipsis.
+ requestAnimationFrame(() => {
+ for (const item of semanticTextNodes) {
+ item.node.classList.toggle("label-hidden", item.label.scrollWidth > item.label.clientWidth);
+ if (!item.node.classList.contains("semantic-segment")) continue;
+ // At the whole-programme view a Segment is the useful unit. Once it
+ // has enough physical width, its words become a real sub-lane, like a
+ // Pattern Clip opening into FL Studio's piano roll.
+ item.node.classList.toggle("semantic-coarse", item.node.clientWidth < 88);
+ }
+ });
+ }
+
+ for (const track of snapshot.tracks) {
+ const kind = trackKind(track.label, track.id);
+ const label = document.createElement("div");
+ label.className = `track-label track-${kind}`;
+ label.innerHTML = `<span class="material-symbols-rounded track-icon"></span><span class="track-copy"><strong></strong><small></small></span><span class="track-state"></span>`;
+ label.querySelector(".track-icon")!.textContent = trackIcon(kind);
+ label.querySelector("strong")!.textContent = track.label;
+ label.querySelector("small")!.textContent =
+ `${track.clips.length} clip${track.clips.length === 1 ? "" : "s"}`;
+ label.querySelector(".track-state")!.textContent = "";
+ labels.append(label);
+
+ // Clips that overlap in time cannot share a row without hiding each
+ // other, so a Track is as many rows tall as it needs. A board's panel
+ // runs the whole programme and its rows settle underneath it.
+ // Packed by what is in front: the topmost row holds whatever is drawn over
+ // everything else, so a folded Track shows the picture the viewer sees.
+ const freeFrom: number[] = [];
+ const rowOf = new Map<string, number>();
+ const ordered = [...track.clips].sort((a, b) =>
+ b.stackOrder - a.stackOrder || a.startFrame - b.startFrame);
+ for (const clip of ordered) {
+ let row = freeFrom.findIndex((free) => free <= clip.startFrame);
+ if (row < 0) { row = freeFrom.length; freeFrom.push(0); }
+ freeFrom[row] = clip.endFrameExclusive;
+ rowOf.set(clip.id, row);
+ }
+ const depth = Math.max(1, freeFrom.length);
+ const folded = depth > 1 && !opened.has(track.id);
+ const shownRows = folded ? 1 : depth;
+ label.style.height = `${shownRows * LANE_HEIGHT}px`;
+ if (depth > 1) {
+ const fold = document.createElement("button");
+ fold.type = "button";
+ fold.className = "track-fold";
+ fold.textContent = folded ? `+${depth - 1}` : "\u2212";
+ fold.title = folded ? `Show all ${depth} rows` : "Show only what is in front";
+ fold.setAttribute("aria-expanded", String(!folded));
+ fold.addEventListener("click", (event) => {
+ event.stopPropagation();
+ if (opened.has(track.id)) opened.delete(track.id);
+ else opened.add(track.id);
+ build(snapshot);
+ paint();
+ });
+ label.querySelector("small")!.append(fold);
+ }
+
+ const lane = document.createElement("div");
+ lane.className = `lane track-${kind}`;
+ lane.style.height = `${shownRows * LANE_HEIGHT}px`;
+ for (const clip of track.clips) {
+ const from = place(clip.startFrame, snapshot.space.frameCount, zoom.window());
+ const to = place(clip.endFrameExclusive, snapshot.space.frameCount, zoom.window());
+ if (to <= 0 || from >= 1) continue;
+ const node = document.createElement("button");
+ node.type = "button";
+ node.className = `clip clip-${kind}`;
+ node.dataset.clip = clip.id;
+ const visibleFrom = Math.max(0, from);
+ const visibleTo = Math.min(1, to);
+ node.style.left = `${visibleFrom * 100}%`;
+ const row = rowOf.get(clip.id) ?? 0;
+ if (folded && row > 0) continue;
+ node.style.top = `${row * LANE_HEIGHT}px`;
+ node.style.width = `${Math.max(0, visibleTo - visibleFrom) * 100}%`;
+ node.title = `${clip.label} (${clip.startFrame}-${clip.endFrameExclusive}f)`;
+ node.innerHTML = `
+ <span class="clip-edge clip-edge-left"></span>
+ <span class="material-symbols-rounded clip-icon"></span>
+ <span class="clip-copy"><span class="clip-name"></span><span class="clip-meta"></span></span>
+ <span class="clip-edge clip-edge-right"></span>`;
+ node.querySelector(".clip-icon")!.textContent = trackIcon(kind);
+ node.querySelector(".clip-name")!.textContent = clip.label;
+ node.querySelector(".clip-meta")!.textContent =
+ `${((clip.endFrameExclusive - clip.startFrame) / fps(snapshot)).toFixed(2)}s`;
+ if (from < 0) node.classList.add("clipped-left");
+ if (to > 1) node.classList.add("clipped-right");
+ // Same tone as the Script marker this clip is named after.
+ const tone = tones.get(clip.authoredId);
+ if (tone !== undefined) node.classList.add(`tone-${tone}`);
+ node.addEventListener("pointerdown", (event) => {
+ event.stopPropagation();
+ store.focus(frameAt(event.clientX), clip.id, "timeline");
+ });
+ nextClipNodes.push({ node, start: clip.startFrame, end: clip.endFrameExclusive, id: clip.id });
+ lane.append(node);
+ }
+ rows.append(lane);
+ }
+ clipNodes = nextClipNodes;
+ semanticNodes = nextSemanticNodes;
+ drawRuler(snapshot);
+ };
+
+ const paint = (): void => {
+ if (state === undefined) return;
+ const { snapshot, selection, playhead: head } = state;
+ const position = place(head.frame, snapshot.space.frameCount, zoom.window()) * lanes.clientWidth;
+ playhead.style.transform = `translate3d(${position}px,0,0)`;
+ readout.textContent =
+ `${timecode(head.frame / fps(snapshot))}:${String(head.frame % Math.round(fps(snapshot))).padStart(2, "0")} · ${head.frame}f`;
+ for (const item of clipNodes) {
+ item.node.classList.toggle("selected", selection.kind === "clip" && selection.clipId === item.id);
+ item.node.setAttribute("aria-pressed", String(selection.kind === "clip" && selection.clipId === item.id));
+ item.node.classList.toggle("live", head.frame >= item.start && head.frame < item.end);
+ }
+ for (const item of semanticNodes) {
+ item.node.classList.toggle("live", item.kind === "segment" && head.frame >= item.start && head.frame < item.end);
+ item.node.classList.toggle("current", item.kind === "word" && head.frame >= item.start && head.frame < item.end);
+ }
+ };
+
+ const schedulePaint = (): void => {
+ if (paintFrame !== 0) return;
+ paintFrame = requestAnimationFrame(() => {
+ paintFrame = 0;
+ paint();
+ });
+ };
+
+ // A trackpad pinch is a wheel event with ctrlKey set; two fingers sideways is
+ // a wheel with deltaX. Both are how a reader expects to move around a strip.
+ lanes.addEventListener("wheel", (event) => {
+ if (event.ctrlKey) {
+ event.preventDefault();
+ const box = lanes.getBoundingClientRect();
+ const at = box.width === 0 ? 0.5 : (event.clientX - box.left) / box.width;
+ zoom.pinch(at, Math.exp(event.deltaY * 0.01));
+ return;
+ }
+ if (Math.abs(event.deltaX) <= Math.abs(event.deltaY)) return;
+ event.preventDefault();
+ zoom.slide(event.deltaX / Math.max(1, lanes.clientWidth));
+ }, { passive: false });
+
+ // Subscribed here rather than where the zoom is made: it reports its window
+ // at once, and there is nothing to redraw until a Source has been read.
+ zoom.subscribe(() => {
+ if (state === undefined) return;
+ build(state.snapshot);
+ schedulePaint();
+ });
+
+ store.subscribe((value) => {
+ state = value;
+ if (value.snapshot.revision !== built) {
+ built = value.snapshot.revision;
+ build(value.snapshot);
+ }
+ schedulePaint();
+ });
+
+ new ResizeObserver(() => {
+ if (state !== undefined) {
+ drawRuler(state.snapshot);
+ schedulePaint();
+ }
+ }).observe(lanes);
+
+ return { element };
+}
diff --git a/packages/svml-playground/src/ui/zoom.ts b/packages/studio/src/ui/zoom.ts
similarity index 94%
rename from packages/svml-playground/src/ui/zoom.ts
rename to packages/studio/src/ui/zoom.ts
index f5cd4df8..089f002f 100644
--- a/packages/svml-playground/src/ui/zoom.ts
+++ b/packages/studio/src/ui/zoom.ts
@@ -19,6 +19,10 @@ export type Zoom = {
pinch(at: number, factor: number): void;
/** Slide the window by a fraction of its own width. */
slide(by: number): void;
+ /** Show a particular programme interval, keeping it inside the strip. */
+ focus(start: number, end: number): void;
+ /** Show the whole programme. */
+ fit(): void;
};
/** Nothing smaller than this is readable, and nothing larger than all of it exists. */
@@ -115,5 +119,7 @@ export function createZoom(): Zoom {
const width = window_.end - window_.start;
settle(window_.start + by * width, window_.end + by * width);
},
+ focus(start: number, end: number) { settle(start, end); },
+ fit() { settle(0, 1); },
};
}
diff --git a/packages/studio/start.ts b/packages/studio/start.ts
new file mode 100644
index 00000000..4391c229
--- /dev/null
+++ b/packages/studio/start.ts
@@ -0,0 +1,89 @@
+import { dirname, resolve } from "node:path";
+import { fileURLToPath } from "node:url";
+
+import { createServer } from "vite";
+
+import { openStudioArchive } from "./src/archive.js";
+import { compileSource } from "./src/compile.js";
+import { loadStudioDomain } from "./src/domain.js";
+import { loadStudioRun } from "./src/run.js";
+import { studioPlugin } from "./src/server.js";
+import { inspectStudioRun } from "./src/studio-preflight.js";
+
+const here = dirname(fileURLToPath(import.meta.url));
+
+function usage(message?: string): never {
+ if (message !== undefined) process.stderr.write(`${message}\n\n`);
+ process.stderr.write(`Usage:
+ pnpm studio -- --run <build.svrun> [--runtime <hypit.runtime.json>]
+ [--port <number>] [--package-root <directory>]
+
+Studio opens one explicit Run Source, requires a Film/Render target and a
+resolved deterministic semantic projection, and writes only its Author SVML.
+`);
+ process.exit(1);
+}
+
+function argumentsByName(argv: readonly string[]): ReadonlyMap<string, string> {
+ const result = new Map<string, string>();
+ for (let index = 0; index < argv.length; index += 2) {
+ const flag = argv[index];
+ const value = argv[index + 1];
+ if (flag === undefined || !flag.startsWith("--") || value === undefined || value.startsWith("--")) {
+ usage(`Malformed argument near ${flag ?? "end of command"}`);
+ }
+ result.set(flag.slice(2), value);
+ }
+ return result;
+}
+
+const raw = process.argv.slice(2);
+const values = argumentsByName(raw[0] === "--" ? raw.slice(1) : raw);
+const invokedFrom = process.env.INIT_CWD ?? process.cwd();
+const runArgument = values.get("run");
+if (runArgument === undefined || runArgument.trim().length === 0) usage("Missing --run");
+const runPath = resolve(invokedFrom, runArgument);
+const packageRoot = resolve(values.get("package-root") ?? invokedFrom);
+const workspaceRoot = packageRoot;
+const runtimeArgument = values.get("runtime");
+const runtimePath = runtimeArgument === undefined ? undefined : resolve(invokedFrom, runtimeArgument);
+const port = Number(values.get("port") ?? "5179");
+if (!Number.isSafeInteger(port) || port <= 0) usage("--port must be a positive integer");
+
+const domain = await loadStudioDomain({ run: runPath, workspaceRoot, packageRoot });
+const archive = await openStudioArchive(runtimePath, packageRoot);
+let run;
+try {
+ run = await loadStudioRun({
+ run: runPath,
+ domain,
+ ...(archive === undefined ? {} : { archive }),
+ });
+} catch (error) {
+ await archive?.close();
+ throw error;
+}
+const source = run.authorSource;
+try {
+ inspectStudioRun(await compileSource(source, domain), run);
+} catch (error) {
+ await archive?.close();
+ throw error;
+}
+const server = await createServer({
+ configFile: false,
+ root: here,
+ server: {
+ port,
+ fs: { allow: [workspaceRoot, here] },
+ },
+ plugins: [studioPlugin({
+ source,
+ runPath,
+ domain,
+ run,
+ ...(archive === undefined ? {} : { archive }),
+ })],
+});
+await server.listen();
+server.printUrls();
diff --git a/packages/svml-playground/README.md b/packages/svml-playground/README.md
deleted file mode 100644
index 88c6183b..00000000
--- a/packages/svml-playground/README.md
+++ /dev/null
@@ -1,35 +0,0 @@
-# SVML Playground
-
-A read-only official preview application for one `.svml` Author Source.
-
-```bash
-pnpm svml:playground -- --source examples/talking-film-broll-preview/main.svml
-# ➜ http://localhost:5179/
-```
-
-Optional arguments:
-
-- `--run <build.svrun>` reads material and timings explicitly selected by a Run Source.
-- `--runtime <hypit.runtime.json>` opens earlier Build records and Artifacts read-only.
-- `--port <number>` changes the listening port from `5179`.
-
-The Playground never writes a Source, Recipe, Build or Artifact and never calls
-a paid Provider. Missing generation results are shown as declared stand-ins;
-missing speech timings are visibly estimated.
-
-## Package boundary
-
-The Playground is an application, not a registry required by Hypit. It
-explicitly depends on the official video packages it can preview and loads the
-same activation, Frontends, Surfaces, Producers and Validators that a normal
-Host loads. No compiler, Runtime or video package imports the Playground, and
-normal production works identically when it is not installed.
-
-The compiled Source remains the authority. The application asks it for every
-`VisualTrack` and `AudioTrack`, builds each independently, and renders the
-result with HyperFrames. A new Track from an already bundled package therefore
-needs no Playground-specific implementation. A newly published official video
-package is added to this application's dependency list in its next release.
-
-See [the complete guide](../../docs/guide/svml-playground.md) for selection,
-timeline, stand-in and measured-timing behavior.
diff --git a/packages/svml-playground/package.json b/packages/svml-playground/package.json
deleted file mode 100644
index cb86ffbd..00000000
--- a/packages/svml-playground/package.json
+++ /dev/null
@@ -1,65 +0,0 @@
-{
- "name": "@hypit/svml-playground",
- "version": "0.0.0-dev",
- "private": true,
- "type": "module",
- "dependencies": {
- "@hypit/audio-track": "workspace:*",
- "@hypit/background-removal": "workspace:*",
- "@hypit/caption": "workspace:*",
- "@hypit/caption-fine": "workspace:*",
- "@hypit/caption-gemini": "workspace:*",
- "@hypit/comment-sticker": "workspace:*",
- "@hypit/compiler-node": "workspace:*",
- "@hypit/component-kit": "workspace:*",
- "@hypit/composition": "workspace:*",
- "@hypit/core": "workspace:*",
- "@hypit/deck-track": "workspace:*",
- "@hypit/driver-node": "workspace:*",
- "@hypit/elaborator": "workspace:*",
- "@hypit/endpoint-kit": "workspace:*",
- "@hypit/estimate": "workspace:*",
- "@hypit/film": "workspace:*",
- "@hypit/fonts-open": "workspace:*",
- "@hypit/gemini-omni": "workspace:*",
- "@hypit/gpt-image": "workspace:*",
- "@hypit/grok-imagine": "workspace:*",
- "@hypit/hyperframes": "workspace:*",
- "@hypit/image-compose": "workspace:*",
- "@hypit/image-transform": "workspace:*",
- "@hypit/markup": "workspace:*",
- "@hypit/media": "workspace:*",
- "@hypit/media-pipeline": "workspace:*",
- "@hypit/media-track": "workspace:*",
- "@hypit/mimo-tts": "workspace:*",
- "@hypit/minimax-h3": "workspace:*",
- "@hypit/nano-banana": "workspace:*",
- "@hypit/narrative": "workspace:*",
- "@hypit/package-loader-node": "workspace:*",
- "@hypit/program-space": "workspace:*",
- "@hypit/protocol": "workspace:*",
- "@hypit/provider-hyperframes-local": "workspace:*",
- "@hypit/provider-media-local": "workspace:*",
- "@hypit/provider-whisperx-local": "workspace:*",
- "@hypit/ranking": "workspace:*",
- "@hypit/render-hyperframes": "workspace:*",
- "@hypit/run": "workspace:*",
- "@hypit/run-markup": "workspace:*",
- "@hypit/runtime": "workspace:*",
- "@hypit/runtime-local": "workspace:*",
- "@hypit/screen-overlay": "workspace:*",
- "@hypit/script": "workspace:*",
- "@hypit/seedance": "workspace:*",
- "@hypit/seedream": "workspace:*",
- "@hypit/semantic-map": "workspace:*",
- "@hypit/spatial": "workspace:*",
- "@hypit/speech-spine": "workspace:*",
- "@hypit/svs": "workspace:*",
- "@hypit/temporal": "workspace:*",
- "@hypit/text": "workspace:*",
- "@hypit/typography-track": "workspace:*",
- "@hypit/validation": "workspace:*",
- "@hypit/whisperx": "workspace:*",
- "vite": "5.4.21"
- }
-}
diff --git a/packages/svml-playground/src/official-video.ts b/packages/svml-playground/src/official-video.ts
deleted file mode 100644
index b1e63894..00000000
--- a/packages/svml-playground/src/official-video.ts
+++ /dev/null
@@ -1,165 +0,0 @@
-/**
- * The official video packages understood by this preview application.
- *
- * This is deliberately application-local composition. Hypit packages do
- * not register themselves with a central video catalogue and do not know that
- * the Playground exists. The Playground chooses the packages it previews,
- * then reads the activation each package already publishes for normal Hosts.
- */
-import { registerProducerFacets, registerTypeValidatorFacets } from "@hypit/component-kit";
-import { createResolvedClosure } from "@hypit/core";
-import { ProducerRegistry } from "@hypit/driver-node";
-import {
- AuthorFrontendRegistry,
- installAuthorFrontendHostFacets,
-} from "@hypit/elaborator";
-import {
- createMarkupAuthorFrontend,
- installMarkupSurfaceHostFacets,
- MarkupSurfaceRegistry,
-} from "@hypit/markup";
-import type { MarkupSurfaceRegistryLike } from "@hypit/markup";
-import { loadNodePackageSelection } from "@hypit/package-loader-node";
-import type { ModuleRef, ResolvedModuleClosure } from "@hypit/protocol";
-import { TypeValidatorRegistry } from "@hypit/validation";
-
-const OFFICIAL_VIDEO_PACKAGES = [
- "@hypit/audio-track",
- "@hypit/background-removal",
- "@hypit/caption",
- "@hypit/caption-fine",
- "@hypit/caption-gemini",
- "@hypit/comment-sticker",
- "@hypit/deck-track",
- "@hypit/estimate",
- "@hypit/film",
- "@hypit/fonts-open",
- "@hypit/gemini-omni",
- "@hypit/gpt-image",
- "@hypit/grok-imagine",
- "@hypit/image-compose",
- "@hypit/image-transform",
- "@hypit/media",
- "@hypit/media-pipeline",
- "@hypit/media-track",
- "@hypit/mimo-tts",
- "@hypit/minimax-h3",
- "@hypit/nano-banana",
- "@hypit/ranking",
- "@hypit/render-hyperframes",
- "@hypit/screen-overlay",
- "@hypit/script",
- "@hypit/seedance",
- "@hypit/seedream",
- "@hypit/spatial",
- "@hypit/speech-spine",
- "@hypit/svs",
- "@hypit/text",
- "@hypit/typography-track",
- "@hypit/whisperx",
-] as const;
-
-/**
- * Packages a previewed Source declares that the official list does not carry,
- * and the directory they are installed under.
- *
- * A Source is free to import a package this application has never heard of —
- * a project-local component is the normal case, not an exception — so the
- * preview loads what the Source actually names in addition to the official
- * list, resolved from the project rather than from this application.
- */
-let projectPackages: readonly string[] = [];
-let projectRoot: string | undefined;
-
-export function usePreviewPackages(packages: readonly string[], root: string): void {
- // The domain is built once, and the packages a Source imports are stable across its edits. Once
- // the domain is loading (or loaded), a later reading of the same Source must not re-specify them:
- // the first call wins, and later ones are ignored rather than throwing, because a watcher-driven
- // re-read is the normal path rather than an error.
- if (loading !== undefined) return;
- projectPackages = packages;
- projectRoot = root;
-}
-
-/** The package specifiers a Source imports, with any logical version suffix removed. */
-export function importedPackages(source: string): readonly string[] {
- const found = new Set<string>();
- for (const match of source.matchAll(/<import\b[^>]*\bfrom\s*=\s*"([^"]+)"/gu)) {
- const specifier = match[1]!;
- const suffix = specifier.lastIndexOf("@");
- found.add(suffix > 0 && /^\d+$/u.test(specifier.slice(suffix + 1)) ? specifier.slice(0, suffix) : specifier);
- }
- return [...found];
-}
-
-type OfficialVideoDomain = {
- readonly closure: ResolvedModuleClosure;
- readonly surfaces: MarkupSurfaceRegistry;
- readonly producers: ProducerRegistry;
- readonly validators: TypeValidatorRegistry;
- readonly resolveModule: (specifier: string) => ModuleRef | undefined;
- readonly frontends: (surfaces?: MarkupSurfaceRegistryLike) => AuthorFrontendRegistry;
-};
-
-let loading: Promise<OfficialVideoDomain> | undefined;
-
-async function loadOfficialVideoDomain(): Promise<OfficialVideoDomain> {
- const selection = [...new Set([...OFFICIAL_VIDEO_PACKAGES, ...projectPackages])];
- const loaded = await loadNodePackageSelection(selection, projectRoot ?? import.meta.dirname);
- const contributions = loaded.map((item) => item.contribution);
- const manifests = contributions.flatMap((item) =>
- (item.modules ?? []).map((module) => module.manifest));
- const closure = createResolvedClosure(manifests);
-
- const modules = new Map<string, ModuleRef>();
- for (const contribution of contributions) {
- for (const module of contribution.modules ?? []) {
- const ref = { name: module.manifest.name, version: module.manifest.version };
- for (const specifier of [
- module.manifest.name,
- `${module.manifest.name}@${module.manifest.version}`,
- ...(module.specifiers ?? []),
- ]) modules.set(specifier, ref);
- }
- }
- const resolveModule = (specifier: string): ModuleRef | undefined => modules.get(specifier);
-
- const facets = contributions.flatMap((item) => item.hostFacets ?? []);
- const surfaces = new MarkupSurfaceRegistry();
- installMarkupSurfaceHostFacets(facets, surfaces);
-
- const components = contributions.flatMap((item) => item.components ?? []);
- const producers = new ProducerRegistry();
- const validators = new TypeValidatorRegistry();
- for (const component of components) {
- registerProducerFacets(producers, component.producers ?? []);
- registerTypeValidatorFacets(validators, component.validators ?? []);
- }
-
- return {
- closure,
- surfaces,
- producers,
- validators,
- resolveModule,
- frontends(registry = surfaces) {
- const frontends = new AuthorFrontendRegistry();
- frontends.register(createMarkupAuthorFrontend({
- registry,
- resolveModule(request) {
- const found = resolveModule(request.from);
- if (found === undefined) throw new Error(`No package installed under the previewed project declares ${request.from}.`);
- return found;
- },
- }));
- installAuthorFrontendHostFacets(facets, frontends);
- return frontends;
- },
- };
-}
-
-/** Load the preview application's package composition once per process. */
-export async function officialVideoDomain(): Promise<OfficialVideoDomain> {
- loading ??= loadOfficialVideoDomain();
- return await loading;
-}
diff --git a/packages/svml-playground/src/pipeline/archive.ts b/packages/svml-playground/src/pipeline/archive.ts
deleted file mode 100644
index 56a54dcf..00000000
--- a/packages/svml-playground/src/pipeline/archive.ts
+++ /dev/null
@@ -1,68 +0,0 @@
-/**
- * The record of what has already been made.
- *
- * A Source that reuses an accepted take names the Build it came from, not a
- * path, because a produced Artifact has an identity rather than a location. So
- * a preview that is to show those takes has to read the same archive a build
- * writes - opened read-only, because a preview may not change what was accepted.
- */
-import {
- createRuntimeArchiveFromConfig, createRuntimeArtifactAccessFromConfig,
-} from "@hypit/runtime-local/config";
-import type { BuildState } from "@hypit/protocol";
-
-export type Archive = {
- /** A prior Build by its authored id, or undefined when it is not on this machine. */
- readonly readBuild: (id: string) => Promise<BuildState | undefined>;
- /** A public output alias, resolved to the Logical Output it names. */
- readonly resolveOutput: (id: string, output: string) => Promise<string | undefined>;
- /** Bytes for an Artifact this archive holds. */
- readonly read: (digest: string) => Promise<Uint8Array | undefined>;
- readonly close: () => Promise<void>;
-};
-
-/**
- * Open the archive a Runtime profile points at. The profile is the only thing
- * that says where it lives, which is why it is the one extra argument a preview
- * needs to show produced material.
- */
-export async function openArchive(profilePath: string, packageRoot: string): Promise<Archive> {
- const control = await createRuntimeArchiveFromConfig(profilePath, { packageRoot } as never);
- // Which Build accepted what, and the bytes behind it, are two stores now.
- const artifacts = await createRuntimeArtifactAccessFromConfig(profilePath, { packageRoot } as never);
- const seen = new Map<string, Awaited<ReturnType<typeof control.status>>>();
- const status = async (id: string): Promise<Awaited<ReturnType<typeof control.status>>> => {
- const held = seen.get(id);
- if (held !== undefined) return held;
- const fresh = await control.status(id);
- seen.set(id, fresh);
- return fresh;
- };
- return {
- async readBuild(id) {
- try {
- return (await status(id)).build?.state;
- } catch {
- // An archive that does not hold this Build is not a broken archive.
- return undefined;
- }
- },
- async resolveOutput(id, output) {
- try {
- const alias = (await status(id)).catalog?.aliases.find((item: { name: string }) => item.name === output);
- if (alias === undefined) return output;
- return alias.ref.kind === "logical-output" ? alias.ref.id : undefined;
- } catch {
- return undefined;
- }
- },
- async read(digest) {
- try {
- return await artifacts.readArtifact(digest as never) ?? undefined;
- } catch {
- return undefined;
- }
- },
- close: async () => { await artifacts.close(); await control.close(); },
- };
-}
diff --git a/packages/svml-playground/src/pipeline/caption-plan.ts b/packages/svml-playground/src/pipeline/caption-plan.ts
deleted file mode 100644
index ed9d0a6f..00000000
--- a/packages/svml-playground/src/pipeline/caption-plan.ts
+++ /dev/null
@@ -1,58 +0,0 @@
-/**
- * Provisional caption phrasing, for a Source nobody has planned yet.
- *
- * Deciding which words share a screen is a judgement, and the package that
- * makes it asks a model. A preview cannot, so it falls back to the plainest
- * rule there is - a fixed number of Atoms per cue, in the order they were
- * written - and says the phrasing is a stand-in rather than a plan.
- */
-
-/** The words a Source declared as captionable, in display order. */
-type DisplaySequence = {
- readonly id: string;
- readonly atoms: readonly { readonly id: string; readonly wordIds?: readonly string[] }[];
-};
-
-/** Which words each run covers, and in which Style. The Program decides this. */
-type Program = {
- readonly runs: readonly {
- readonly id: string;
- readonly styleId: string;
- readonly wordIds: readonly string[];
- }[];
-};
-
-/** How many Atoms share a screen when nobody has decided. */
-const ATOMS_PER_CUE = 3;
-
-/**
- * One run over the whole sequence, cut every few Atoms.
- *
- * Every Atom appears exactly once and in order, so the captions say what the
- * Source says; only where the line breaks fall is invented.
- */
-export function evenCaptionPlan(display: DisplaySequence, program: Program): unknown {
- const runs = program.runs.map((run) => {
- const words = new Set(run.wordIds);
- // An Atom belongs to the run that covers the words it holds, so the phrasing
- // never moves a word out of the Style the Program gave it.
- const own = display.atoms.filter((atom) => (atom.wordIds ?? []).some((id) => words.has(id)));
- const cues: { id: string; atomIds: string[]; fields: never[] }[] = [];
- for (let index = 0; index < own.length; index += ATOMS_PER_CUE) {
- const atoms = own.slice(index, index + ATOMS_PER_CUE);
- cues.push({
- id: `${run.id}:cue:${String(cues.length + 1).padStart(4, "0")}`,
- atomIds: atoms.map((atom) => atom.id),
- fields: [],
- });
- }
- return { id: run.id, styleId: run.styleId, cues };
- });
- return { runs };
-}
-
-/** Whether a sequence has anything to phrase at all. */
-export function hasAtoms(value: unknown): value is DisplaySequence {
- const held = value as DisplaySequence | undefined;
- return Array.isArray(held?.atoms) && held.atoms.length > 0;
-}
diff --git a/packages/svml-playground/src/pipeline/compile.ts b/packages/svml-playground/src/pipeline/compile.ts
deleted file mode 100644
index 097be15e..00000000
--- a/packages/svml-playground/src/pipeline/compile.ts
+++ /dev/null
@@ -1,135 +0,0 @@
-/**
- * Compile a Source exactly as a build does.
- *
- * The preview reads nothing itself. Every tag is decoded by the package that
- * declares it, so what the preview shows is what a build would produce, and a
- * Source that will not build does not silently preview.
- */
-import { createHash } from "node:crypto";
-import { readFileSync } from "node:fs";
-import { dirname, isAbsolute, relative, resolve } from "node:path";
-
-import { compileSourceClosure, resolveCompiledSourceExport } from "@hypit/elaborator";
-import type { Digest } from "@hypit/protocol";
-import { createRecordAdmitter } from "@hypit/validation";
-
-import { officialVideoDomain } from "../official-video.js";
-import { createObserver } from "./observe.js";
-import type { Observations } from "./observe.js";
-
-/** Bytes a Source named, kept so the preview can serve the exact file. */
-export type ServedFile = { readonly mediaType: string; readonly bytes: Uint8Array };
-
-export type CompiledSource = {
- readonly compiled: CompiledClosure;
- readonly observations: Observations;
- /** Assets the Source pulled in, by digest, ready to serve. */
- readonly served: ReadonlyMap<string, ServedFile>;
- /** Resolve a value the author named, such as `main.composition`. */
- readonly exportRef: (name: string) => string | undefined;
- /** Every export, so the preview can find what it needs by Type. */
- readonly exports: readonly { readonly name: string; readonly type: string; readonly ref: string }[];
-};
-
-type CompiledClosure = {
- readonly program: unknown;
- readonly elaboration: { readonly graph: { readonly id: string } };
- readonly exports: readonly {
- readonly name: string;
- readonly type: { readonly name: string };
- readonly ref: { readonly kind: string; readonly id: string };
- }[];
-};
-
-/** An error the author can act on, pointed at the tag that caused it. */
-export class CompileFailure extends Error {
- readonly range: { readonly start: number; readonly end: number } | undefined;
-
- constructor(message: string, range?: { readonly start: number; readonly end: number }) {
- super(message);
- this.name = "CompileFailure";
- this.range = range;
- }
-}
-
-/** Whether a path sits inside a directory, rather than merely starting with it. */
-function within(root: string, path: string): boolean {
- const inside = relative(root, path);
- return inside === "" || (!inside.startsWith("..") && !isAbsolute(inside));
-}
-
-function digestOfBytes(bytes: Uint8Array): Digest {
- return `sha256:${createHash("sha256").update(bytes).digest("hex")}`;
-}
-
-export async function compileSource(entryPath: string): Promise<CompiledSource> {
- const domain = await officialVideoDomain();
- const served = new Map<string, ServedFile>();
- // Everything a Source reads has to sit beside it, as it must in a build.
- const root = dirname(entryPath);
- const resolveModule = (request: { readonly from: string }) => {
- const found = domain.resolveModule(request.from);
- if (found === undefined) {
- throw new CompileFailure(`No package in this preview declares ${request.from}.`);
- }
- return found;
- };
- const observer = createObserver(domain.surfaces, resolveModule);
-
- let compiled: CompiledClosure;
- try {
- compiled = await compileSourceClosure({
- entry: { id: entryPath, name: "main.svml", text: readFileSync(entryPath, "utf8") },
- closure: domain.closure,
- frontends: domain.frontends(observer.surfaces),
- admitRecord: createRecordAdmitter(domain.validators),
- resolveSource(importer: { readonly id: string }, request: { readonly from: string }) {
- const path = resolve(dirname(importer.id), request.from);
- return { id: path, name: request.from, text: readFileSync(path, "utf8") };
- },
- resolveAsset(importer: { readonly id: string }, request: {
- readonly from: string;
- readonly mediaType: string;
- readonly bytes?: Uint8Array;
- }) {
- // A package Surface hands over its own bytes; an authored asset is a
- // path beside the Source, and a build will only read one that sits
- // inside the Source's own directory. Reading further would let the
- // preview show a Source no build would accept.
- if (request.bytes === undefined) {
- const asset = resolve(dirname(importer.id), request.from);
- if (!within(root, asset)) {
- throw new CompileFailure(
- `Source asset ${asset} is outside ${root}, so a build would refuse to read it.`,
- );
- }
- }
- const bytes = request.bytes ?? readFileSync(resolve(dirname(importer.id), request.from));
- const digest = digestOfBytes(bytes);
- served.set(digest, { mediaType: request.mediaType, bytes });
- return { artifact: { kind: "blob", digest, size: bytes.byteLength, mediaType: request.mediaType } };
- },
- } as never) as unknown as CompiledClosure;
- } catch (error) {
- const held = error as { message?: string; range?: { start: number; end: number } };
- // The tag that failed is the one the Surfaces were last handed.
- const last = observer.observations().placements.at(-1);
- throw new CompileFailure(held.message ?? String(error), held.range ?? last?.range);
- }
-
- const exports = compiled.exports.map((item) => ({
- name: item.name, type: item.type.name, ref: item.ref.id,
- }));
- return {
- compiled,
- observations: observer.observations(),
- served,
- exports,
- exportRef(name) {
- const found = exports.find((item) => item.name === name);
- return found?.ref;
- },
- };
-}
-
-export { resolveCompiledSourceExport };
diff --git a/packages/svml-playground/src/pipeline/estimate.ts b/packages/svml-playground/src/pipeline/estimate.ts
deleted file mode 100644
index a8221240..00000000
--- a/packages/svml-playground/src/pipeline/estimate.ts
+++ /dev/null
@@ -1,218 +0,0 @@
-/**
- * Provisional timings, for a Source nobody has recorded yet.
- *
- * When a Run Source carries measured timings the preview uses those and this
- * never runs. Otherwise every word still has to land somewhere, so each one is
- * given the time its own syllables would take at an ordinary delivery pace.
- * The identities and the rates are the packages' own - only the arithmetic that
- * spreads words across frames is here, and it is announced as an estimate
- * rather than presented as a measurement.
- */
-import {
- countSpeechEstimateUnits, resolveSpeechEstimateLanguage, resolveSpeechEstimateRate,
- sealSpeechEstimatePolicy,
-} from "@hypit/estimate";
-
-/** The Narrative a Script sealed, as the preview reads it. */
-type Narrative = {
- readonly segments: readonly {
- readonly id: string;
- readonly startAnchorId: string;
- readonly endAnchorId: string;
- }[];
- readonly tokens: readonly {
- readonly id: string;
- readonly segmentId: string;
- readonly startAnchorId: string;
- readonly endAnchorId: string;
- readonly text: string;
- }[];
-};
-
-export type EstimatedTiming = {
- readonly map: unknown;
- readonly space: unknown;
- readonly frameCount: number;
-};
-
-/**
- * Place every token, then close each Segment around the tokens it holds.
- *
- * Frames are accumulated from a running total rather than summed per token, so
- * rounding cannot drift across a long Script, and every token is given at least
- * one frame: a word that occupies no time cannot be pointed at.
- */
-export function estimateTiming(
- narrative: Narrative,
- frameRate: { readonly numerator: number; readonly denominator: number },
- /**
- * Seconds a Segment's own material declares, when it declares any. A take
- * that says it is eight seconds long will be eight seconds long, so its words
- * belong across those eight seconds rather than across a guess at how fast
- * they might be read.
- */
- declared: ReadonlyMap<string, number> = new Map(),
-): EstimatedTiming {
- const perSecond = frameRate.numerator / frameRate.denominator;
- // Ordinary delivery, with the clamps a whole-utterance estimate would apply
- // turned off: each word is placed on its own here.
- const policy = sealSpeechEstimatePolicy({
- language: "auto", pace: "normal",
- rounding: "none", minimumSec: 0, maximumSec: Number.MAX_SAFE_INTEGER,
- } as never);
- const spoken = narrative.tokens.map((token) => token.text).join(" ");
- const language = resolveSpeechEstimateLanguage(spoken, "auto" as never);
- const rate = resolveSpeechEstimateRate(policy as never, language);
-
- const anchors: { identity: string; frame: number }[] = [];
- // Anchors are how a marker addresses time, but a consumer that reads a window
- // over words - a Caption, say - reads the token ranges, so both are placed.
- const timed: {
- tokenId: string; segmentId: string;
- startFrame: number; endFrameExclusive: number;
- }[] = [];
- const at = new Map<string, number>();
- let seconds = 0;
- let frame = 0;
- const place = (identity: string, value: number): void => {
- at.set(identity, value);
- anchors.push({ identity, frame: value });
- };
-
- const bounds = new Map<string, { first: number; last: number }>();
- for (const token of narrative.tokens) {
- const began = frame;
- place(token.startAnchorId, began);
- const units = countSpeechEstimateUnits(token.text, language);
- // Punctuation carries no syllables and still occupies the frame it is on.
- seconds += Math.max(1 / perSecond, units / rate);
- frame = Math.max(began + 1, Math.round(seconds * perSecond));
- place(token.endAnchorId, frame);
- timed.push({
- tokenId: token.id, segmentId: token.segmentId,
- startFrame: began, endFrameExclusive: frame,
- });
- const held = bounds.get(token.segmentId);
- bounds.set(token.segmentId, { first: held?.first ?? began, last: frame });
- }
-
- // A Segment opens where its first word does and closes where its last one
- // ends, so a Segment with no words at all still spans nothing rather than
- // spanning the programme.
- for (const segment of narrative.segments) {
- const held = bounds.get(segment.id) ?? { first: frame, last: frame };
- if (!at.has(segment.startAnchorId)) place(segment.startAnchorId, held.first);
- if (!at.has(segment.endAnchorId)) place(segment.endAnchorId, held.last);
- }
- if (declared.size > 0) {
- return stretched(narrative, frameRate, anchors, timed, declared);
- }
- const frameCount = Math.max(1, frame);
- return {
- map: { tokens: timed, anchors },
- space: {
- durationSec: frameCount * frameRate.denominator / frameRate.numerator,
- frameRate: { ...frameRate },
- },
- frameCount,
- };
-}
-
-/**
- * Fit the guess to what the Source already knows.
- *
- * Word durations are a proportion, not a prediction: a syllable model says
- * which word takes longer than which, and nothing about how fast this speaker
- * talks. Where the material declares a length, that length is the truth, so
- * each Segment's words are stretched across it and the Segments laid end to
- * end. What is preserved is the shape of the speech; what is replaced is a
- * pace nobody claimed.
- */
-function stretched(
- narrative: Narrative,
- frameRate: { readonly numerator: number; readonly denominator: number },
- anchors: readonly { identity: string; frame: number }[],
- timed: readonly {
- tokenId: string; segmentId: string;
- startFrame: number; endFrameExclusive: number;
- }[],
- declared: ReadonlyMap<string, number>,
-): EstimatedTiming {
- const perSecond = frameRate.numerator / frameRate.denominator;
- const guessed = new Map<string, { first: number; last: number }>();
- for (const token of timed) {
- const held = guessed.get(token.segmentId);
- guessed.set(token.segmentId, {
- first: Math.min(held?.first ?? token.startFrame, token.startFrame),
- last: Math.max(held?.last ?? token.endFrameExclusive, token.endFrameExclusive),
- });
- }
-
- // Each Segment takes the length its material declares, or the length it was
- // guessed at when nothing declares one.
- const span = new Map<string, { from: number; scale: number }>();
- let cursor = 0;
- for (const segment of narrative.segments) {
- const held = guessed.get(segment.id);
- const natural = held === undefined ? 0 : held.last - held.first;
- const wanted = declared.has(segment.id)
- ? Math.max(1, Math.round(declared.get(segment.id)! * perSecond))
- : natural;
- span.set(segment.id, {
- from: cursor,
- scale: natural === 0 ? 0 : wanted / natural,
- });
- cursor += wanted;
- }
-
- const moved = new Map<string, number>();
- const at = (segmentId: string, frame: number): number => {
- const held = span.get(segmentId);
- const start = guessed.get(segmentId)?.first ?? 0;
- if (held === undefined) return frame;
- return Math.round(held.from + (frame - start) * held.scale);
- };
-
- const placedTokens = timed.map((token) => {
- const startFrame = at(token.segmentId, token.startFrame);
- const endFrameExclusive = Math.max(startFrame + 1, at(token.segmentId, token.endFrameExclusive));
- moved.set(`${token.tokenId}:start`, startFrame);
- moved.set(`${token.tokenId}:end`, endFrameExclusive);
- return {
- tokenId: token.tokenId, segmentId: token.segmentId,
- startFrame, endFrameExclusive,
- };
- });
-
- const byToken = new Map(narrative.tokens.map((token) => [token.id, token]));
- const placedAnchors = anchors.map((anchor) => {
- const token = narrative.tokens.find((item) =>
- item.startAnchorId === anchor.identity || item.endAnchorId === anchor.identity);
- if (token !== undefined) {
- const edge = token.startAnchorId === anchor.identity ? "start" : "end";
- const frame = moved.get(`${token.id}:${edge}`) ?? anchor.frame;
- return { identity: anchor.identity, frame };
- }
- // A Segment's own edges close around the words it holds.
- const segment = narrative.segments.find((item) =>
- item.startAnchorId === anchor.identity || item.endAnchorId === anchor.identity);
- if (segment === undefined) return anchor;
- const held = span.get(segment.id);
- const own = placedTokens.filter((item) => item.segmentId === segment.id);
- const frame = segment.startAnchorId === anchor.identity
- ? own[0]?.startFrame ?? held?.from ?? anchor.frame
- : own.at(-1)?.endFrameExclusive ?? held?.from ?? anchor.frame;
- return { identity: anchor.identity, frame };
- });
- void byToken;
-
- const frameCount = Math.max(1, cursor);
- return {
- map: { tokens: placedTokens, anchors: placedAnchors },
- space: {
- durationSec: frameCount * frameRate.denominator / frameRate.numerator,
- frameRate: { ...frameRate },
- },
- frameCount,
- };
-}
diff --git a/packages/svml-playground/src/pipeline/execute.ts b/packages/svml-playground/src/pipeline/execute.ts
deleted file mode 100644
index 1c8625aa..00000000
--- a/packages/svml-playground/src/pipeline/execute.ts
+++ /dev/null
@@ -1,87 +0,0 @@
-/**
- * Run a planned build with whatever this machine can actually serve.
- *
- * A preview is a Host like any other: it registers the Providers it has and
- * says plainly which Capabilities it cannot answer. Nothing here knows what a
- * Capability means - the Providers declare what they fulfil, and a Need nobody
- * can fulfil is reported rather than faked.
- */
-import { EndpointRegistry, MemoryArtifactStore, NodeDriver } from "@hypit/driver-node";
-import type { EndpointPackage } from "@hypit/endpoint-kit";
-import type { ArtifactStore } from "@hypit/runtime";
-import type { BuildState } from "@hypit/protocol";
-import { createLocalHyperframesProvider } from "@hypit/provider-hyperframes-local";
-import { createLocalMediaProvider } from "@hypit/provider-media-local";
-import { createLocalWhisperXProvider } from "@hypit/provider-whisperx-local";
-
-import { officialVideoDomain } from "../official-video.js";
-
-/** A Capability no Provider on this machine could answer. */
-export type Unserved = { readonly capability: string; readonly count: number };
-
-export type Executed = {
- readonly state: BuildState;
- readonly status: string;
- readonly unserved: readonly Unserved[];
- /** Producers that threw, with what they said. */
- readonly errors: readonly string[];
- readonly outcomes: readonly { readonly status: string; readonly message?: string }[];
-};
-
-/**
- * The Providers a developer's own machine can run. They are the same ones a
- * local build uses, so a picture the preview draws is a picture that renders.
- */
-function localProviders(): readonly EndpointPackage[] {
- const built: EndpointPackage[] = [];
- for (const create of [
- () => createLocalMediaProvider({ instance: "media.local", pool: "media.local" }),
- () => createLocalHyperframesProvider({ instance: "hyperframes.local", pool: "hyperframes.local" }),
- () => createLocalWhisperXProvider({ instance: "whisperx.local", pool: "whisperx.local" }),
- ]) {
- // A Provider whose tool is not installed is simply one the preview does
- // not have, which is the same as any other unserved Capability.
- try { built.push(create()); } catch { continue; }
- }
- return built;
-}
-
-async function endpoints(): Promise<EndpointRegistry> {
- const registry = new EndpointRegistry();
- // Each Provider installs the Capabilities it declares. The preview names
- // none of them, so a Provider that grows a Capability grows the preview too.
- for (const provider of localProviders()) {
- await provider.install(registry);
- }
- return registry;
-}
-
-export async function execute(planned: BuildState, artifacts: ArtifactStore): Promise<Executed> {
- const domain = await officialVideoDomain();
- const result = await new NodeDriver({
- producers: domain.producers,
- validators: domain.validators,
- endpoints: await endpoints(),
- artifacts,
- }).run(planned);
-
- // A Need that was answered stays on the state, so what is unserved is what
- // the driver could not move past.
- const counts = new Map<string, number>();
- for (const item of result.blocked) {
- const need = result.state.needs.find((candidate) => item.subject.includes(candidate.capability.name));
- const name = need?.capability.name ?? item.subject;
- counts.set(name, (counts.get(name) ?? 0) + 1);
- }
- return {
- state: result.state,
- status: result.status,
- unserved: [...counts].map(([capability, count]) => ({ capability, count })),
- outcomes: result.outcomes as never,
- errors: result.outcomes
- .filter((entry: { status: string }) => entry.status === "error")
- .map((entry: { message?: string }) => entry.message ?? "a Producer failed without saying why"),
- };
-}
-
-export { MemoryArtifactStore };
diff --git a/packages/svml-playground/src/pipeline/placeholder.ts b/packages/svml-playground/src/pipeline/placeholder.ts
deleted file mode 100644
index e8a71d82..00000000
--- a/packages/svml-playground/src/pipeline/placeholder.ts
+++ /dev/null
@@ -1,89 +0,0 @@
-/**
- * Stand-in footage, so a Source can be seen before anything has been shot.
- *
- * A Track cannot be built without the material it places, and refusing to draw
- * anything until every shot exists would make the preview useless for the part
- * of the work it is meant for. So material nobody has supplied becomes a black
- * frame of the right shape - announced as a placeholder, never as footage.
- */
-import { execFileSync } from "node:child_process";
-import { mkdtempSync, readFileSync, rmSync, writeFileSync } from "node:fs";
-import { tmpdir } from "node:os";
-import { join } from "node:path";
-
-export type Placeholder = { readonly bytes: Uint8Array; readonly mediaType: string };
-
-/** One black stand-in per shape and length, since each costs an ffmpeg run. */
-const cache = new Map<string, Placeholder | null>();
-
-/**
- * A picture the Source already points at, held for as long as the shot it
- * stands in for. A reference frame is not the take, but it is the right subject
- * in the right shape, which is what makes a preview worth looking at before
- * anything has been generated.
- */
-export function heldPicture(
- bytes: Uint8Array,
- seconds: number,
- frameRate: { readonly numerator: number; readonly denominator: number },
- size: { readonly width: number; readonly height: number },
-): Placeholder | undefined {
- const directory = mkdtempSync(join(tmpdir(), "svml-playground-held-"));
- const source = join(directory, "reference");
- const path = join(directory, "held.mp4");
- writeFileSync(source, bytes);
- try {
- execFileSync("ffmpeg", [
- "-v", "error", "-y",
- "-loop", "1", "-i", source,
- "-f", "lavfi", "-i", "anullsrc=channel_layout=stereo:sample_rate=48000",
- "-t", String(Math.max(1, seconds)),
- "-r", `${frameRate.numerator}/${frameRate.denominator}`,
- "-vf", `scale=${size.width}:${size.height}:force_original_aspect_ratio=increase,`
- + `crop=${size.width}:${size.height},setsar=1`,
- "-shortest", "-c:v", "libx264", "-pix_fmt", "yuv420p", "-c:a", "aac", path,
- ], { timeout: 120_000 });
- return { bytes: readFileSync(path), mediaType: "video/mp4" };
- } catch {
- // Without ffmpeg there is no stand-in of any kind, which the caller already
- // handles by leaving the material unsupplied.
- return undefined;
- } finally {
- rmSync(directory, { recursive: true, force: true });
- }
-}
-
-/**
- * Black at the Source's own frame rate, with silence, for as long as the shot
- * it stands in for declares. A stand-in of the wrong length would make the
- * timeline disagree with the picture about how long the programme is.
- */
-export function blackFrames(
- frameRate: { readonly numerator: number; readonly denominator: number },
- size: { readonly width: number; readonly height: number },
- seconds: number,
-): Placeholder | undefined {
- const key = `${frameRate.numerator}/${frameRate.denominator}:${size.width}x${size.height}:${seconds}`;
- const kept = cache.get(key);
- if (kept !== undefined) return kept ?? undefined;
- const directory = mkdtempSync(join(tmpdir(), "svml-playground-black-"));
- const path = join(directory, "black.mp4");
- const rate = `${frameRate.numerator}/${frameRate.denominator}`;
- try {
- execFileSync("ffmpeg", [
- "-v", "error", "-y",
- "-f", "lavfi", "-i",
- `color=c=black:s=${size.width}x${size.height}:r=${rate}:d=${Math.max(1, seconds)}`,
- "-f", "lavfi", "-i", "anullsrc=channel_layout=stereo:sample_rate=48000",
- "-shortest", "-c:v", "libx264", "-pix_fmt", "yuv420p", "-c:a", "aac", path,
- ], { timeout: 60_000 });
- cache.set(key, { bytes: readFileSync(path), mediaType: "video/mp4" });
- } catch {
- // No ffmpeg, so there is no stand-in either, and the Tracks that needed
- // material will say what they were waiting for.
- cache.set(key, null);
- } finally {
- rmSync(directory, { recursive: true, force: true });
- }
- return cache.get(key) ?? undefined;
-}
diff --git a/packages/svml-playground/src/pipeline/preview.ts b/packages/svml-playground/src/pipeline/preview.ts
deleted file mode 100644
index b1e92700..00000000
--- a/packages/svml-playground/src/pipeline/preview.ts
+++ /dev/null
@@ -1,589 +0,0 @@
-/**
- * Build the pictures a Source describes, with whatever it has been given.
- *
- * A preview asks for Tracks rather than for a film: a Track that cannot be
- * built costs only itself, so a Source waiting on one Provider still shows
- * everything else. Which Tracks exist is a question the packages answer - the
- * preview asks for every export that is a Track and knows nothing else about
- * them.
- */
-import { createHash } from "node:crypto";
-import { readFileSync } from "node:fs";
-import { dirname } from "node:path";
-
-import { createProvidedCandidate } from "@hypit/run";
-
-import { importedPackages, officialVideoDomain, usePreviewPackages } from "../official-video.js";
-import { compileSource } from "./compile.js";
-import type { CompiledSource, ServedFile } from "./compile.js";
-import type { Placement } from "./observe.js";
-import { evenCaptionPlan, hasAtoms } from "./caption-plan.js";
-import { estimateTiming } from "./estimate.js";
-import { blackFrames, heldPicture } from "./placeholder.js";
-import type { Placeholder } from "./placeholder.js";
-import { execute, MemoryArtifactStore } from "./execute.js";
-import type { Archive } from "./archive.js";
-import { applyRunSource, emptyRun } from "./run-source.js";
-import type { Refusal, RunPlan } from "./run-source.js";
-
-/** Types the preview can play. Anything else is a value, not a picture. */
-const PLAYABLE = new Set(["VisualTrack", "AudioTrack"]);
-/** The timings every Track is placed against. */
-const TIMING = "CompleteSemanticMap";
-const SPACE = "ProgramSpace";
-/** Material a Source names but nobody has supplied. */
-const MATERIAL = "BlobArtifact";
-/** Which words share a screen. A model decides this; a preview cannot. */
-const PHRASING = "CaptionPlan";
-
-export type BuiltTrack = {
- readonly name: string;
- readonly type: string;
- /** The Track value, or undefined when it could not be built. */
- readonly track?: unknown;
- /** Capabilities no Provider on this machine could answer. */
- readonly unserved: readonly string[];
- readonly errors: readonly string[];
-};
-
-export type Preview = {
- readonly source: CompiledSource;
- readonly tracks: readonly BuiltTrack[];
- readonly timing: "measured" | "estimated";
- readonly refused: readonly Refusal[];
- readonly served: ReadonlyMap<string, ServedFile>;
- /** Outputs that were shown as a black frame because no material was supplied. */
- readonly placeholders: readonly string[];
- /** Captions whose phrasing was cut mechanically because nobody planned it. */
- readonly phrasing: readonly string[];
- /** Shots shown as a picture the Source already points at, for want of the take. */
- readonly stoodIn: readonly string[];
- /** The Canvas and frame rate every Track was placed in. */
- readonly canvas: { readonly width: number; readonly height: number; readonly clearColor: string };
- readonly frameRate: { readonly numerator: number; readonly denominator: number };
- /** The Program Space the Tracks agree on, for the renderer. */
- readonly space: unknown;
- /** Anchor identity to frame, however the timings were arrived at. */
- readonly anchors: ReadonlyMap<string, number>;
- /** Token identity to the anchors that open and close it. */
- readonly tokens: readonly {
- readonly id: string;
- readonly startAnchorId: string;
- readonly endAnchorId: string;
- }[];
-};
-
-/**
- * The frame rate the Source declares, read off whatever compile-time Record
- * carries one. Every Track is placed in one Program Space, so the first is the
- * programme's.
- */
-function authoredFrameRate(compiled: unknown): { numerator: number; denominator: number } {
- const records = (compiled as { program: { records: readonly { value: { kind: string; value?: unknown } }[] } })
- .program.records;
- for (const record of records) {
- if (record.value.kind !== "inline") continue;
- const rate = (record.value.value as { frameRate?: { numerator?: number; denominator?: number } }).frameRate;
- if (typeof rate?.numerator === "number" && typeof rate.denominator === "number") {
- return { numerator: rate.numerator, denominator: rate.denominator };
- }
- }
- // Nothing declared one, so the preview picks the rate a Source most often has.
- return { numerator: 30, denominator: 1 };
-}
-
-/** The Canvas the Source declares, so a stand-in is the shape of the programme. */
-function authoredCanvas(compiled: unknown): { width: number; height: number } {
- const records = (compiled as { program: { records: readonly { value: { kind: string; value?: unknown } }[] } })
- .program.records;
- for (const record of records) {
- if (record.value.kind !== "inline") continue;
- const canvas = record.value.value as { widthPx?: number; heightPx?: number; contract?: string };
- if (canvas.contract === "hypit.canvas-space@1"
- && typeof canvas.widthPx === "number" && typeof canvas.heightPx === "number") {
- return { width: canvas.widthPx, height: canvas.heightPx };
- }
- }
- return { width: 1080, height: 1920 };
-}
-
-function inlineRecord(compiled: unknown, id: string): unknown {
- const records = (compiled as { program: { records: readonly { id: string; value: { kind: string; value?: unknown } }[] } })
- .program.records;
- const found = records.find((record) => record.id === id);
- return found?.value.kind === "inline" ? found.value.value : undefined;
-}
-
-/**
- * Read a Source, and every Track in it, as a build would.
- *
- * `runPath` names the Run Source that says which material and which timings to
- * read with. Without one, or where it leaves the timings unsaid, the Script's
- * own words are used to place them and the result is announced as an estimate.
- */
-export async function preview(
- entryPath: string,
- runPath?: string,
- archive?: Archive,
-): Promise<Preview> {
- // A Source may import a project-local package this application has never heard of; feed what it
- // names to the domain loader before the first compile, so `@hypit/local-*` resolves from the
- // project instead of being reported as uninstalled. (The session already does this, but preview
- // is also reached directly, and the domain is built once per process.)
- usePreviewPackages([...new Set(importedPackages(readFileSync(entryPath, "utf8")))], dirname(entryPath));
- const domain = await officialVideoDomain();
- const source = await compileSource(entryPath);
-
- let base: RunPlan;
- const unread: Refusal[] = [];
- if (runPath === undefined) base = await emptyRun(entryPath, source.compiled);
- else {
- try {
- base = await applyRunSource({
- runPath, compiled: source.compiled,
- served: source.served as Map<string, ServedFile>,
- ...(archive === undefined ? {} : { archive }),
- });
- } catch (error) {
- // A Run Source that names material this machine has never made is not a
- // broken Source. Read what it says, stand in for what it cannot reach,
- // and say which is which.
- unread.push({
- output: runPath,
- reason: (error as Error).message,
- });
- base = await emptyRun(entryPath, source.compiled);
- }
- }
-
- // What the author asked to build, when they asked for anything. That is how
- // a Source is taken only as far as one produced thing rather than all the
- // way to a film.
- // Only a target this preview can draw is worth honouring: nearly every Run
- // Source asks for the finished film, and a film is not something a timeline
- // can show. Asking for one produced Track, though, is exactly how a Source is
- // taken only as far as that Track.
- const asked = source.exports.filter((item) =>
- PLAYABLE.has(item.type) && base.targets.some((name) => name === item.ref || name === item.name));
- const targets = asked.length > 0
- ? asked
- : source.exports.filter((item) => PLAYABLE.has(item.type));
-
- // Timings a Run Source supplied are measurements. Where it said nothing, the
- // Script still has to be placed somewhere, so it is estimated and said so.
- const satisfied = new Set(base.run.graph.satisfactions.map((item) => item.output));
- const unsaid = source.exports.filter((item) =>
- (item.type === TIMING || item.type === SPACE) && !satisfied.has(item.ref));
- let timing: "measured" | "estimated" = unsaid.length === 0 ? "measured" : "estimated";
-
- let run = base.run;
- let anchors = new Map<string, number>();
- if (unsaid.length > 0) {
- const narrative = source.exports.find((item) => item.type === "Narrative");
- const value = narrative === undefined
- ? undefined
- : inlineRecord(source.compiled, narrative.ref);
- if (value === undefined) {
- // Nothing to estimate from either, so the Tracks that need timings will
- // report what they were waiting for rather than being invented.
- timing = "measured";
- } else {
- const estimated = estimateTiming(
- value as never, authoredFrameRate(source.compiled), declaredSpans(source),
- );
- anchors = new Map((estimated.map as { anchors: readonly { identity: string; frame: number }[] })
- .anchors.map((anchor) => [anchor.identity, anchor.frame]));
- const added: unknown[] = [];
- const satisfactions = [...base.run.graph.satisfactions];
- for (const output of unsaid) {
- const supplied = output.type === TIMING ? estimated.map : estimated.space;
- const type = outputType(source, output.ref);
- const stored = { kind: "inline" as const, value: supplied as never };
- const candidate = createProvidedCandidate({
- id: `playground:timing:${output.ref}`,
- type: type as never,
- value: stored,
- } as never);
- added.push(candidate);
- satisfactions.push({ output: output.ref, candidate: candidate.id });
- }
- run = {
- ...base.run,
- graph: {
- ...base.run.graph,
- candidates: [...base.run.graph.candidates, ...added],
- satisfactions,
- },
- };
- }
- }
-
- // Material nobody supplied is stood in for, so the shape of the programme can
- // be seen before it has been shot.
- const placeholders: string[] = [];
- const stoodIn: string[] = [];
- // Only something the graph produces can be missing. A Record the Source read
- // at compile time already is its value, and standing in for it would replace
- // a picture the author supplied.
- const satisfiedNow = new Set(run.graph.satisfactions.map((item) => item.output));
- // What a Candidate already supplies, by the output it satisfies. A picture an
- // earlier Build made arrives this way rather than as a compile-time Record.
- const byCandidate = new Map(run.graph.candidates.map((item) => [(item as { id: string }).id, item]));
- const supplied = new Map<string, string>();
- for (const item of run.graph.satisfactions) {
- const root = (byCandidate.get(item.candidate) as {
- root?: { value?: { digest?: string; value?: { digest?: string } } };
- } | undefined)?.root;
- const digest = root?.value?.digest ?? root?.value?.value?.digest;
- const named = source.exports.find((held) => held.ref === item.output)?.name;
- if (digest !== undefined && named !== undefined) supplied.set(named, digest);
- }
- const consumed = new Set(source.observations.placements.flatMap((item) => item.references));
- const unsupplied = source.exports.filter((item) =>
- item.type === MATERIAL && isOutput(source, item.ref)
- && !satisfiedNow.has(item.ref) && consumed.has(item.name));
- if (unsupplied.length > 0) {
- // Measured timings arrive as a Candidate the Run Source supplied; either way
- // the anchors are what places every word.
- if (anchors.size === 0) {
- for (const candidate of run.graph.candidates) {
- const root = (candidate as { root?: { value?: { kind?: string; value?: unknown } } }).root;
- const held = root?.value?.kind === "inline" ? root.value.value : undefined;
- const shape = held as {
- anchors?: readonly { identity: string; frame: number }[]; tokens?: readonly unknown[];
- };
- const listed = shape?.anchors;
- if (!Array.isArray(listed) || !Array.isArray(shape?.tokens)) continue;
- anchors = new Map((listed ?? []).map((anchor) => [anchor.identity, anchor.frame]));
- break;
- }
- }
- const narrativeExport = source.exports.find((item) => item.type === "Narrative");
- const narrativeValue = narrativeExport === undefined
- ? undefined
- : inlineRecord(source.compiled, narrativeExport.ref) as
- { tokens?: readonly { id: string; startAnchorId: string; endAnchorId: string }[] } | undefined;
-
- const canvas = authoredCanvas(source.compiled);
- const rate = authoredFrameRate(source.compiled);
- // Every stand-in is as long as the shot it stands in for, so the timeline
- // and the picture cannot disagree about how long the programme runs.
- const black = blackFrames(rate, canvas, 1);
- if (black !== undefined) {
- const digest = `sha256:${createHash("sha256").update(black.bytes).digest("hex")}`;
- (source.served as Map<string, ServedFile>).set(digest, {
- mediaType: black.mediaType, bytes: black.bytes,
- });
- const added = new Map<string, unknown>(
- run.graph.candidates.map((item) => [(item as { id: string }).id, item]));
- const satisfactions = [...run.graph.satisfactions];
- for (const output of unsupplied) {
- // A shot that points at a picture already in hand stands in as that
- // picture. It is not the take, but it is the right subject held for the
- // right length, which is what makes a preview worth looking at.
- const held = await standIn(source, output.name, rate, canvas, archive, supplied);
- const owner = output.name.includes(".")
- ? output.name.slice(0, output.name.indexOf("."))
- : output.name;
- const placement = source.observations.placements.find((item) => item.id === owner);
- const seconds = placement === undefined ? undefined : declaredSeconds(source, placement);
- const own = seconds === undefined ? undefined : blackFrames(rate, canvas, seconds);
- const dark: Placeholder = own ?? black;
- const darkDigest = dark === black
- ? digest
- : `sha256:${createHash("sha256").update(dark.bytes).digest("hex")}`;
- if (dark !== black) {
- (source.served as Map<string, ServedFile>).set(darkDigest, {
- mediaType: dark.mediaType, bytes: dark.bytes,
- });
- }
- const shown = held ?? { bytes: dark.bytes, mediaType: dark.mediaType, digest: darkDigest };
- if (held !== undefined) {
- (source.served as Map<string, ServedFile>).set(held.digest, {
- mediaType: held.mediaType, bytes: held.bytes,
- });
- }
- // The same bytes are the same Candidate, however many shots they cover.
- const candidate = createProvidedCandidate({
- id: `playground:stand-in:${shown.digest}`,
- type: outputType(source, output.ref) as never,
- value: {
- kind: "blob", digest: shown.digest,
- size: shown.bytes.byteLength, mediaType: shown.mediaType,
- } as never,
- } as never);
- added.set(candidate.id, candidate);
- satisfactions.push({ output: output.ref, candidate: candidate.id });
- (held === undefined ? placeholders : stoodIn).push(output.name);
- }
- run = { ...run, graph: { ...run.graph, candidates: [...added.values()], satisfactions } };
- }
- }
-
- // Everything a build produces has to be servable too: a picture references
- // the normalized material, not the file it came from.
- const store = new MemoryArtifactStore();
- const served = source.served as Map<string, ServedFile>;
- // Phrasing nobody planned is cut mechanically, so captions read the Source's
- // own words even where no model has grouped them.
- const phrasing: string[] = [];
- const unplanned = source.exports.filter((item) =>
- item.type === PHRASING && !new Set(run.graph.satisfactions.map((s) => s.output)).has(item.ref));
- if (unplanned.length > 0) {
- const display = source.exports.find((item) => item.type === "CaptionDisplaySequence");
- const sequence = display === undefined ? undefined : inlineRecord(source.compiled, display.ref);
- const programExport = source.exports.find((item) => item.type === "CaptionProgram");
- const program = programExport === undefined
- ? undefined
- : inlineRecord(source.compiled, programExport.ref) as { runs?: readonly never[] } | undefined;
- if (hasAtoms(sequence) && Array.isArray(program?.runs) && program.runs.length > 0) {
- const added = new Map<string, unknown>(
- run.graph.candidates.map((item) => [(item as { id: string }).id, item]));
- const satisfactions = [...run.graph.satisfactions];
- for (const output of unplanned) {
- const plan = evenCaptionPlan(sequence, program as never);
- const type = outputType(source, output.ref);
- const stored = { kind: "inline" as const, value: plan as never };
- const candidate = createProvidedCandidate({
- id: `playground:caption:${output.ref}`,
- type: type as never, value: stored,
- } as never);
- added.set(candidate.id, candidate);
- satisfactions.push({ output: output.ref, candidate: candidate.id });
- phrasing.push(output.name);
- }
- run = { ...run, graph: { ...run.graph, candidates: [...added.values()], satisfactions } };
- }
- }
-
- const artifacts = {
- // Material this Build produced is in the store; material an earlier Build
- // produced is in the archive. Both are addressed the same way.
- async get(digest: never) {
- const held = await store.get(digest);
- if (held !== undefined) return held;
- const kept = await archive?.read(digest as string);
- if (kept !== undefined) served.set(digest as string, { mediaType: "application/octet-stream", bytes: kept });
- return kept;
- },
- async put(bytes: Uint8Array, mediaType: string) {
- const ref = await store.put(bytes, mediaType);
- served.set((ref as { digest: string }).digest, { mediaType, bytes });
- return ref;
- },
- };
- const tracks: BuiltTrack[] = [];
- for (const target of targets) {
- const planned = base.plan(run, [target.ref]);
- for (const [, file] of [...served]) await artifacts.put(file.bytes, file.mediaType);
- const out = await execute(planned.state, artifacts as never);
- const selection = out.state.plan.selections.find((item) => item.output === target.ref);
- const record = out.state.records.find((item) => item.id === selection?.record);
- const stored = record?.value as { kind: string; value?: unknown } | undefined;
- // Why a Track has no value is the first thing anyone asks, so say it rather
- // than letting every cause collapse into one silent absence.
- const why = stored?.kind === "inline" ? undefined
- : selection === undefined ? `${target.name}: the plan selected nothing for this output (driver status ${out.status})`
- : record === undefined ? `${target.name}: the plan selected record ${String(selection.record)} and the driver never produced it (status ${out.status})`
- : `${target.name}: the record holds a ${String(stored?.kind)} value rather than an inline one`;
- tracks.push({
- name: target.name,
- type: target.type,
- ...(stored?.kind === "inline" ? { track: stored.value } : {}),
- unserved: out.unserved.map((item) => item.capability),
- errors: why === undefined ? out.errors : [...out.errors, why],
- });
- }
-
- // Measured timings arrive as a Candidate the Run Source supplied; either way
- // the anchors are what places every word.
- if (anchors.size === 0) {
- for (const candidate of run.graph.candidates) {
- const root = (candidate as { root?: { value?: { kind?: string; value?: unknown } } }).root;
- const held = root?.value?.kind === "inline" ? root.value.value : undefined;
- const shape = held as {
- anchors?: readonly { identity: string; frame: number }[]; tokens?: readonly unknown[];
- };
- const listed = shape?.anchors;
- if (!Array.isArray(listed) || !Array.isArray(shape?.tokens)) continue;
- anchors = new Map((listed ?? []).map((anchor) => [anchor.identity, anchor.frame]));
- break;
- }
- }
- const narrativeExport = source.exports.find((item) => item.type === "Narrative");
- const narrativeValue = narrativeExport === undefined
- ? undefined
- : inlineRecord(source.compiled, narrativeExport.ref) as
- { tokens?: readonly { id: string; startAnchorId: string; endAnchorId: string }[] } | undefined;
-
- const canvas = authoredCanvas(source.compiled);
- const frameRate = authoredFrameRate(source.compiled);
- // Whatever placed the words also says how long the programme is.
- const declaredFrames = Math.max(0, ...[...anchors.values()]);
- const space = builtSpace(tracks, declaredFrames, frameRate);
- return {
- source, tracks, timing, refused: [...base.refused, ...unread], served: source.served, placeholders, phrasing, stoodIn,
- canvas: { ...canvas, clearColor: authoredClearColor(source.compiled) },
- frameRate,
- space,
- anchors,
- tokens: narrativeValue?.tokens ?? [],
- };
-}
-
-/** The clear colour the Film declares, or black when it declares none. */
-function authoredClearColor(compiled: unknown): string {
- const records = (compiled as { program: { records: readonly { value: { kind: string; value?: unknown } }[] } })
- .program.records;
- for (const record of records) {
- if (record.value.kind !== "inline") continue;
- const held = record.value.value as { clearColor?: unknown; canvas?: { clearColor?: unknown } };
- const colour = held.clearColor ?? held.canvas?.clearColor;
- if (typeof colour === "string") return colour;
- }
- return "#000000";
-}
-
-/**
- * The Program Space every Track was placed in.
- *
- * How long a programme runs is what the Source says, not what this machine
- * managed to draw. A Track that could not be built because there is no tool to
- * draw a stand-in does not make the programme shorter, and saying it did put
- * the timeline and the words at odds on any machine without ffmpeg.
- */
-function builtSpace(
- tracks: readonly BuiltTrack[],
- declaredFrames: number,
- frameRate: { readonly numerator: number; readonly denominator: number },
-): unknown {
- const drawn = tracks.flatMap((track) =>
- ((track.track as { presents?: readonly { span: { endFrameExclusive: number } }[] } | undefined)?.presents ?? [])
- .map((present) => present.span.endFrameExclusive));
- const frameCount = Math.max(1, declaredFrames, ...drawn);
- return {
- durationSec: frameCount * frameRate.denominator / frameRate.numerator,
- frameRate: { ...frameRate },
- };
-}
-
-/**
- * A picture this output already points at.
- *
- * An element that names another value the Source can already produce - a
- * reference frame, a first frame - names something worth showing while the
- * shot itself does not exist. How long to hold it is what the element itself
- * declared, so the stand-in occupies the span the take would have.
- */
-async function standIn(
- source: CompiledSource,
- name: string,
- frameRate: { readonly numerator: number; readonly denominator: number },
- canvas: { readonly width: number; readonly height: number },
- archive: Archive | undefined,
- supplied: ReadonlyMap<string, string>,
-): Promise<{ readonly bytes: Uint8Array; readonly mediaType: string; readonly digest: string } | undefined> {
- const owner = name.includes(".") ? name.slice(0, name.indexOf(".")) : name;
- const placement = source.observations.placements.find((item) => item.id === owner);
- if (placement === undefined) return undefined;
- for (const path of placement.references) {
- const referenced = source.exports.find((item) => item.name === path);
- if (referenced?.type !== MATERIAL) continue;
- const bytes = await pictureFor(source, referenced.ref, archive, supplied.get(path));
- if (bytes === undefined) continue;
- const made = heldPicture(bytes, declaredSeconds(source, placement) ?? 2, frameRate, canvas);
- if (made === undefined) return undefined;
- return {
- ...made,
- digest: `sha256:${createHash("sha256").update(made.bytes).digest("hex")}`,
- };
- }
- return undefined;
-}
-
-/**
- * How long the shot was declared to run.
- *
- * An element may say so itself, or point at something that does - a Source that
- * estimates its own speech names that estimate rather than repeating a number.
- */
-function declaredSeconds(source: CompiledSource, placement: Placement): number | undefined {
- const own = Number(placement.attributes.duration);
- if (Number.isFinite(own) && own > 0) return own;
- for (const path of placement.references) {
- const referenced = source.exports.find((item) => item.name === path);
- if (referenced === undefined) continue;
- const value = inlineRecord(source.compiled, referenced.ref) as Record<string, unknown> | undefined;
- for (const key of ["seconds", "durationSec", "secondsExact"]) {
- const held = Number(value?.[key]);
- if (Number.isFinite(held) && held > 0) return held;
- }
- }
- return undefined;
-}
-
-/** Bytes already in hand for an output, if the Source read them at compile time. */
-async function pictureFor(
- source: CompiledSource,
- ref: string,
- archive: Archive | undefined,
- fromCandidate: string | undefined,
-): Promise<Uint8Array | undefined> {
- const value = inlineRecord(source.compiled, ref) as { digest?: string } | undefined;
- const digest = fromCandidate ?? value?.digest ?? blobDigest(source.compiled, ref);
- if (digest === undefined) return undefined;
- // A picture the Source read at compile time is in hand; one an earlier Build
- // produced is in the archive, and both are addressed the same way.
- return source.served.get(digest)?.bytes ?? await archive?.read(digest);
-}
-
-/** A Record stored as the blob it is, rather than wrapped. */
-function blobDigest(compiled: unknown, id: string): string | undefined {
- const records = (compiled as { program: { records: readonly { id: string; value: { kind: string; digest?: string } }[] } })
- .program.records;
- const found = records.find((record) => record.id === id);
- return found?.value.kind === "blob" ? found.value.digest : undefined;
-}
-
-/**
- * How long each Segment's own material says it is.
- *
- * A guess at reading pace is a proportion, not a prediction, and a Source that
- * already declares a length knows better. An element that names both a Segment
- * and something with a declared duration is that Segment's material, whichever
- * package wrote it.
- */
-function declaredSpans(source: CompiledSource): ReadonlyMap<string, number> {
- const spans = new Map<string, number>();
- const byId = new Map(source.observations.placements.map((item) => [item.id ?? "", item]));
- const declaredBy = (path: string): number | undefined => {
- const seconds = Number(byId.get(path.split(".")[0] ?? "")?.attributes.duration);
- return Number.isFinite(seconds) && seconds > 0 ? seconds : undefined;
- };
- for (const placement of source.observations.placements) {
- const groups = [placement.references, ...placement.children.map((child) => child.references)];
- for (const references of groups) {
- const segment = references.find((path) => path.includes(".segment."));
- const seconds = references.map(declaredBy).find((held) => held !== undefined);
- if (segment === undefined || seconds === undefined) continue;
- spans.set(segment.slice(segment.lastIndexOf(".") + 1), seconds);
- }
- }
- return spans;
-}
-
-/** Whether an export is something the graph produces rather than a Record read from the Source. */
-function isOutput(source: CompiledSource, ref: string): boolean {
- const compiled = source.compiled as unknown as {
- exports: readonly { ref: { kind: string; id: string } }[];
- };
- return compiled.exports.find((item) => item.ref.id === ref)?.ref.kind === "logical-output";
-}
-
-/** The declared Type of an export, as the compiler recorded it. */
-function outputType(source: CompiledSource, ref: string): unknown {
- const compiled = source.compiled as unknown as {
- exports: readonly { ref: { id: string }; type: unknown }[];
- };
- return compiled.exports.find((item) => item.ref.id === ref)?.type;
-}
diff --git a/packages/svml-playground/src/pipeline/run-source.ts b/packages/svml-playground/src/pipeline/run-source.ts
deleted file mode 100644
index 79cc0fcd..00000000
--- a/packages/svml-playground/src/pipeline/run-source.ts
+++ /dev/null
@@ -1,166 +0,0 @@
-/**
- * Apply a Run Source.
- *
- * Which material a Source is read with is an authoring decision, and a `.svrun`
- * is where it is written. The preview does not interpret that file: the Run
- * packages parse it, resolve its Candidates and overlay them on the compiled
- * graph, exactly as a build does. The only thing supplied here is how to read a
- * path, because that is the part a Host owns.
- */
-import { createHash } from "node:crypto";
-import { readFileSync } from "node:fs";
-import { dirname, resolve } from "node:path";
-
-import { NodeRunCompiler } from "@hypit/compiler-node";
-import type { PlannedBuild } from "@hypit/compiler-node";
-import type { Digest, StoredValue } from "@hypit/protocol";
-import {
- compileRunSource, RunFragmentRegistry, RunFrontendRegistry, resolveRunDocument,
-} from "@hypit/run";
-import { runMarkupFrontend } from "@hypit/run-markup";
-
-import { officialVideoDomain } from "../official-video.js";
-import type { Archive } from "./archive.js";
-import type { ServedFile } from "./compile.js";
-
-/** Material a Run Source named that the preview could not read, and why. */
-export type Refusal = { readonly output: string; readonly reason: string };
-
-/** The parts of a resolved Run Source the preview overlays and extends. */
-export type RunCompilation = {
- readonly graph: {
- readonly candidates: readonly unknown[];
- readonly operations: readonly unknown[];
- readonly satisfactions: readonly { readonly output: string; readonly candidate: string }[];
- readonly targets: readonly { readonly output: string }[];
- };
-};
-
-/** What the Run Source said, and how to build one target against it. */
-export type RunPlan = {
- readonly run: RunCompilation;
- readonly refused: readonly Refusal[];
- /** Targets the author asked for, when the Run Source names any. */
- readonly targets: readonly string[];
- /** Plan a single target. A Track that will not build costs only itself. */
- readonly plan: (run: RunCompilation, targets: readonly string[]) => PlannedBuild;
-};
-
-function digestOfBytes(bytes: Uint8Array): Digest {
- return `sha256:${createHash("sha256").update(bytes).digest("hex")}`;
-}
-
-async function planner(
- compiled: unknown,
- source: string,
- authorSource: string,
-): Promise<RunPlan["plan"]> {
- const domain = await officialVideoDomain();
- const frontends = new RunFrontendRegistry();
- frontends.register(runMarkupFrontend);
- const compiler = new NodeRunCompiler({
- frontends, closure: domain.closure, validators: domain.validators,
- } as never);
- return (run, targets) => compiler.planCompilation({
- source,
- authorSource,
- author: { ...(compiled as object), attachments: [] },
- program: (compiled as { program: never }).program,
- run: { ...run, graph: { ...run.graph, targets: targets.map((output) => ({ output })) } },
- attachments: [],
- } as never);
-}
-
-/** A Source read on its own: no material bound and nothing satisfied. */
-export async function emptyRun(entryPath: string, compiled: unknown): Promise<RunPlan> {
- return {
- run: { graph: { candidates: [], operations: [], satisfactions: [], targets: [] } },
- refused: [],
- targets: [],
- plan: await planner(compiled, entryPath, entryPath),
- };
-}
-
-/**
- * Resolve a Run Source against an already compiled Author Source. Files it
- * names are staged into `served` so the preview can hand the exact bytes to a
- * picture.
- */
-export async function applyRunSource(input: {
- readonly runPath: string;
- readonly compiled: unknown;
- readonly served: Map<string, ServedFile>;
- /** Where already-produced material can be read, when the preview was given one. */
- readonly archive?: Archive;
-}): Promise<RunPlan> {
- const refused: Refusal[] = [];
- const frontends = new RunFrontendRegistry();
- frontends.register(runMarkupFrontend);
-
- const text = readFileSync(input.runPath, "utf8");
- const { document } = await compileRunSource(
- { id: input.runPath, name: input.runPath, text } as never,
- frontends,
- );
-
- // A Run Source usually names several things, and one of them being out of
- // reach says nothing about the rest. Drop only what cannot be read, so the
- // footage and timings the author did supply are still used.
- const reachable = { ...document } as {
- candidates: readonly { kind: string; id: string; build?: string }[];
- satisfactions: readonly { candidate: string }[];
- };
- const unreadable = new Set<string>();
- for (const declaration of reachable.candidates) {
- if (declaration.kind !== "build-record") continue;
- const held = await input.archive?.readBuild(declaration.build!);
- if (held !== undefined) continue;
- unreadable.add(declaration.id);
- refused.push({
- output: declaration.id,
- reason: input.archive === undefined
- ? `build ${declaration.build} holds this material; pass --runtime to read it.`
- : `build ${declaration.build} is not in this machine's archive.`,
- });
- }
- const named = unreadable.size === 0 ? document : {
- ...document,
- candidates: reachable.candidates.filter((item) => !unreadable.has(item.id)),
- satisfactions: reachable.satisfactions.filter((item) => !unreadable.has(item.candidate)),
- };
-
- const beside = (from: string): string => resolve(dirname(input.runPath), from);
- const run = await resolveRunDocument(named as never, {
- compilation: input.compiled as never,
- fragments: new RunFragmentRegistry(),
- readStoredValue(from: string): StoredValue {
- return { kind: "inline", value: JSON.parse(readFileSync(beside(from), "utf8")) };
- },
- readFile(from: string, mediaType: string): StoredValue {
- const bytes = readFileSync(beside(from));
- const digest = digestOfBytes(bytes);
- input.served.set(digest, { mediaType, bytes });
- return { kind: "blob", digest, size: bytes.byteLength, mediaType };
- },
- // Only Builds already found reachable get this far.
- readBuild(id: string) {
- return input.archive?.readBuild(id);
- },
- resolveBuildOutput(id: string, output: string) {
- return input.archive?.resolveOutput(id, output) ?? output;
- },
- } as never);
-
- const resolved = run as unknown as RunCompilation;
- return {
- run: resolved,
- refused,
- // What the author asked to build. Honouring it is what lets a Source be
- // taken only as far as one produced thing.
- targets: resolved.graph.targets.map((target) => target.output),
- plan: await planner(
- input.compiled, input.runPath,
- (document as { author: { source: string } }).author.source,
- ),
- };
-}
diff --git a/packages/svml-playground/src/pipeline/session.ts b/packages/svml-playground/src/pipeline/session.ts
deleted file mode 100644
index 94cdfe79..00000000
--- a/packages/svml-playground/src/pipeline/session.ts
+++ /dev/null
@@ -1,81 +0,0 @@
-/**
- * One reading of a Source: compile it, build every Track in it, render the
- * result, and hand back what the panels display.
- */
-import { createHash } from "node:crypto";
-import { readFileSync } from "node:fs";
-
-import { renderPreview } from "../preview/render.js";
-import type { PlaygroundSnapshot } from "../shared.js";
-import { openArchive } from "./archive.js";
-import type { Archive } from "./archive.js";
-import type { ServedFile } from "./compile.js";
-import { preview } from "./preview.js";
-import { snapshot } from "./snapshot.js";
-
-export type Session = {
- readonly snapshot: PlaygroundSnapshot;
- /** Files the Source named, by digest, for the preview to serve. */
- readonly material: ReadonlyMap<string, ServedFile>;
-};
-
-export async function readSource(input: {
- readonly source: string;
- readonly run?: string;
- /** A Runtime profile, so material earlier builds produced can be read. */
- readonly runtime?: string;
- readonly packageRoot: string;
- readonly revision: number;
-}): Promise<Session> {
- const archive = input.runtime === undefined
- ? undefined
- : await openArchive(input.runtime, input.packageRoot);
- try {
- return await read(input, archive);
- } finally {
- await archive?.close();
- }
-}
-
-async function read(
- input: { readonly source: string; readonly run?: string; readonly revision: number; readonly packageRoot: string },
- archive: Archive | undefined,
-): Promise<Session> {
- const built = await preview(input.source, input.run, archive);
- const text = readFileSync(input.source, "utf8");
-
- // Only Tracks that were built can be drawn; the rest are reported as waiting.
- const drawable = built.tracks
- .map((track) => track.track)
- .filter((track): track is object => track !== undefined);
- const srcdoc = renderPreview({
- id: "preview",
- canvas: built.canvas,
- space: built.space as never,
- tracks: drawable as never,
- served: new Set(built.served.keys()),
- ...(audible(built) === undefined ? {} : { audibleTrack: audible(built)! }),
- });
-
- return {
- snapshot: snapshot(built, {
- revision: input.revision,
- path: input.source,
- text,
- digest: `sha256:${createHash("sha256").update(text).digest("hex")}`,
- canvas: built.canvas,
- frameRate: built.frameRate,
- preview: { kind: "hyperframes", srcdoc },
- }),
- material: built.served,
- };
-}
-
-/**
- * A preview is silent unless something carries the programme's speech. The
- * Audio Track a Source built is that thing, whichever package made it.
- */
-function audible(built: Awaited<ReturnType<typeof preview>>): string | undefined {
- const found = built.tracks.find((track) => track.type === "AudioTrack" && track.track !== undefined);
- return found === undefined ? undefined : (found.track as { id?: string }).id;
-}
diff --git a/packages/svml-playground/src/server.ts b/packages/svml-playground/src/server.ts
deleted file mode 100644
index 9baff059..00000000
--- a/packages/svml-playground/src/server.ts
+++ /dev/null
@@ -1,173 +0,0 @@
-import { resolve } from "node:path";
-
-import type { Plugin, ViteDevServer } from "vite";
-
-import type { ServedFile } from "./pipeline/compile.js";
-import { readSource } from "./pipeline/session.js";
-import type { PlaygroundFailure, PlaygroundSnapshot, Range } from "./shared.js";
-
-export type SvmlPlaygroundOptions = {
- readonly source: string;
- /** The directory the author invoked from, so displayed paths read as typed. */
- readonly root: string;
- /** A Run Source, read for material it already names. */
- readonly run?: string;
- /** A Runtime profile, so material earlier builds produced can be read. */
- readonly runtime?: string;
- /** Where the installed packages live, as the Runtime profile expects. */
- readonly packageRoot: string;
-};
-
-function json(response: import("node:http").ServerResponse, status: number, value: unknown): void {
- response.statusCode = status;
- response.setHeader("content-type", "application/json; charset=utf-8");
- response.end(`${JSON.stringify(value)}\n`);
-}
-
-/**
- * Hand over one piece of material.
- *
- * A picture is scrubbed, and a browser only seeks inside material its server
- * offers in parts: answer every request with the whole file and the media
- * element reports nothing as seekable, so every seek collapses to the first
- * frame and the take stands still while the playhead moves on. Serving the
- * asked-for bytes is what makes the timeline move real footage.
- */
-function serveMaterial(
- request: import("node:http").IncomingMessage,
- response: import("node:http").ServerResponse,
- file: ServedFile,
-): void {
- const bytes = Buffer.from(file.bytes);
- response.setHeader("content-type", file.mediaType);
- response.setHeader("cache-control", "no-store");
- response.setHeader("accept-ranges", "bytes");
-
- // One range is what a media element asks for. A request for several is met
- // with the whole file, which is a legitimate answer to any range request.
- const asked = /^bytes=(\d*)-(\d*)$/u.exec((request.headers.range ?? "").trim());
- const from = asked?.[1] === undefined || asked[1] === "" ? undefined : Number(asked[1]);
- const to = asked?.[2] === undefined || asked[2] === "" ? undefined : Number(asked[2]);
- const start = from ?? (to === undefined ? 0 : Math.max(0, bytes.length - to));
- const end = from === undefined && to !== undefined ? bytes.length - 1 : Math.min(to ?? bytes.length - 1, bytes.length - 1);
-
- if (asked === null || start > end || start >= bytes.length) {
- // An unsatisfiable range is worth saying so: answering 200 instead would
- // have the element decode bytes it did not ask for.
- if (asked !== null) {
- response.statusCode = 416;
- response.setHeader("content-range", `bytes */${bytes.length}`);
- response.end();
- return;
- }
- response.statusCode = 200;
- response.setHeader("content-length", String(bytes.length));
- response.end(request.method === "HEAD" ? undefined : bytes);
- return;
- }
-
- response.statusCode = 206;
- response.setHeader("content-range", `bytes ${start}-${end}/${bytes.length}`);
- response.setHeader("content-length", String(end - start + 1));
- response.end(request.method === "HEAD" ? undefined : bytes.subarray(start, end + 1));
-}
-
-function rangeOf(error: unknown): Range | undefined {
- if (typeof error !== "object" || error === null) return undefined;
- const range = (error as { range?: unknown }).range;
- if (typeof range === "object" && range !== null && "start" in range && "end" in range) {
- return range as Range;
- }
- // A parser error owns no element but does know where it gave up, which is
- // still the one place worth looking.
- const offset = (error as { offset?: unknown }).offset;
- return typeof offset === "number" && Number.isFinite(offset)
- ? { start: offset, end: offset + 1 }
- : undefined;
-}
-
-/**
- * Serve one Source as a read-only preview. The plugin owns no mutating route:
- * the Playground reads the file, watches it, and republishes. Nothing it exposes
- * can change what an author wrote.
- */
-export function svmlPlaygroundPlugin(options: SvmlPlaygroundOptions): Plugin {
- let snapshot: PlaygroundSnapshot | undefined;
- let failure: PlaygroundFailure | undefined;
- let material: ReadonlyMap<string, ServedFile> = new Map();
- let revision = 0;
- let server: ViteDevServer | undefined;
- let timer: ReturnType<typeof setTimeout> | undefined;
-
- const publish = async (): Promise<void> => {
- revision += 1;
- try {
- const result = await readSource({
- source: options.source,
- ...(options.run === undefined ? {} : { run: options.run }),
- ...(options.runtime === undefined ? {} : { runtime: options.runtime }),
- packageRoot: options.packageRoot,
- revision,
- });
- snapshot = result.snapshot;
- material = result.material;
- failure = undefined;
- server?.ws.send({ type: "custom", event: "svml:snapshot", data: snapshot });
- } catch (error) {
- const range = rangeOf(error);
- failure = {
- revision,
- error: error instanceof Error ? error.message : String(error),
- ...(range === undefined ? {} : { range }),
- };
- server?.ws.send({ type: "custom", event: "svml:error", data: failure });
- }
- };
-
- const schedule = (): void => {
- if (timer !== undefined) clearTimeout(timer);
- timer = setTimeout(() => void publish(), 80);
- };
-
- return {
- name: "hypit-svml-playground",
- configureServer(value) {
- server = value;
- value.watcher.add([options.source, ...(options.run === undefined ? [] : [options.run])]);
- value.watcher.on("change", (path) => {
- // Style sheets reached through a source import are watched too: their
- // Recipes decide placement and motion, so a change there changes the
- // timeline. Vite already watches everything under the project root.
- const changed = resolve(path);
- if (changed === options.source || changed === options.run || path.endsWith(".svs")) schedule();
- });
- value.middlewares.use((request, response, next) => {
- const url = new URL(request.url ?? "/", "http://hypit.local");
- if (request.method !== "GET" && request.method !== "HEAD") {
- next();
- return;
- }
- if (url.pathname === "/__svml/session") {
- void (async () => {
- if (snapshot === undefined && failure === undefined) await publish();
- if (snapshot !== undefined) json(response, 200, snapshot);
- else json(response, 500, failure);
- })();
- return;
- }
- const digest = /^\/__svml\/material\/(sha256:[a-f0-9]{64})$/u.exec(url.pathname)?.[1];
- if (digest !== undefined) {
- const file = material.get(digest);
- if (file === undefined) {
- response.statusCode = 404;
- response.end();
- return;
- }
- serveMaterial(request, response, file);
- return;
- }
- next();
- });
- },
- };
-}
diff --git a/packages/svml-playground/src/style.css b/packages/svml-playground/src/style.css
deleted file mode 100644
index 7eb45f65..00000000
--- a/packages/svml-playground/src/style.css
+++ /dev/null
@@ -1,243 +0,0 @@
-:root {
- color-scheme: dark; --bg:#09090b; --panel:#131316; --panel2:#18181c; --line:#2a2a30;
- --text:#f4f4f5; --muted:#96969f; --accent:#ee7b62; --marker:#ffd34d; --danger:#ff6868;
- --ok:#75d69b;
- font: 13px/1.45 Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
-}
-* { box-sizing:border-box; }
-/* Two fingers sideways over a timeline is how a reader moves through it, and
- on a trackpad it is also how the browser goes back. Losing the preview
- mid-scrub is worse than the gesture is useful, and this tool navigates
- nowhere, so the page keeps it. */
-html, body, #app { margin:0; height:100%; overflow:hidden; overscroll-behavior:none; background:var(--bg); color:var(--text); }
-#app { display:flex; flex-direction:column; position:relative; }
-
-.topbar { height:54px; flex:none; display:flex; align-items:center; gap:16px; padding:0 18px; border-bottom:1px solid var(--line); background:#101013; }
-.topbar strong { font-size:15px; letter-spacing:-.01em; }
-.topbar span { margin-left:10px; color:var(--muted); }
-.meta { color:#63636e; font-size:11px; font-variant-numeric:tabular-nums; white-space:pre; }
-.badges { display:flex; gap:6px; margin-left:auto; }
-.badge { padding:3px 8px; border-radius:999px; font-size:11px; border:1px solid var(--line); background:#101013; color:var(--muted); cursor:default; }
-.badge-measured { color:var(--ok); border-color:#2f6b48; }
-.badge-estimated { color:var(--marker); border-color:#6b5a25; }
-.status { color:var(--muted); font-size:12px; min-width:220px; text-align:right; }
-.status.ok { color:var(--ok); } .status.error { color:var(--danger); }
-
-main { flex:1; min-height:0; display:grid; grid-template-columns:minmax(0,1fr) auto 520px; }
-.left { min-width:0; min-height:0; display:flex; flex-direction:column; }
-.right { min-width:0; min-height:0; border-left:1px solid var(--line); background:var(--panel); display:flex; }
-
-.pane-heading { flex:none; display:flex; align-items:baseline; gap:10px; padding:13px 18px 10px; border-bottom:1px solid var(--line); background:var(--panel2); }
-.pane-heading h2 { margin:0; font-size:13px; }
-.pane-heading span { color:var(--muted); font-size:11px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
-
-.code { flex:1; min-width:0; display:flex; flex-direction:column; }
-.code-scroll { position:relative; flex:1; min-height:0; overflow-x:hidden; overflow-y:auto; padding:10px 10px 40px 0; font:12px/20px ui-monospace, SFMono-Regular, Menlo, monospace; }
-.code-line { position:relative; display:flex; align-items:flex-start; }
-.code-line .line-number { flex:none; width:46px; padding-right:22px; text-align:right; color:#55555f; user-select:none; }
-/* A line that binds a clip is clickable, and says so standing still. One bar
- per level it sits inside, outermost first, so a Selection inside a Segment
- reads as two bars side by side rather than as the inner one alone. */
-.code-line.bound { cursor:pointer; }
-.code-line .gutter-bar {
- position:absolute; top:0; bottom:0; width:3px;
- background:var(--tone, #ffffff); opacity:.9; pointer-events:none;
-}
-.code-line.bound:hover .gutter-bar { opacity:1; }
-.code-line.bound:hover .line-number { color:var(--tone, #ffffff); }
-.tok-marker { cursor:pointer; }
-/* Wrap rather than scroll sideways: a wrapped attribute list still reads, and a
- horizontal scrollbar would hide the right-hand end of every long line. */
-.code-line code { flex:1; min-width:0; font:inherit; color:#8a8a95; white-space:pre-wrap; overflow-wrap:break-word; }
-.tok-header { color:#5c5c68; font-style:italic; }
-.tok-comment { color:#5c5c68; font-style:italic; }
-.tok-punct { color:#6a6a76; }
-.tok-tag { color:#7fb4ff; }
-.tok-attr { color:#c2a0e8; }
-.tok-string { color:#8bd6a4; }
-.tok-reference { color:var(--accent); }
-.tok-marker { color:var(--marker); font-weight:650; }
-.tok-role { color:#f08faf; }
-
-/* One tone per nesting depth, shared with the timeline clip and the box on the
- picture, so a pair and what it places read as the same thing. */
-.tone-0 { --tone:#ffd34d; } .tone-1 { --tone:#6fd3f7; }
-.tone-2 { --tone:#9ee493; } .tone-3 { --tone:#f79ad3; }
-.tok-marker.tone-0, .tok-marker.tone-1,
-.tok-marker.tone-2, .tok-marker.tone-3 {
- color:var(--tone); background:color-mix(in srgb, var(--tone) 14%, transparent);
- box-shadow:inset 0 0 0 1px color-mix(in srgb, var(--tone) 38%, transparent);
- border-radius:3px; padding:0 1px;
-}
-.range-canvas { position:absolute; inset:0; pointer-events:none; z-index:0; }
-/* The word being spoken at the playhead, drawn over the text rather than
- wrapped around it so every measured offset stays where it was. */
-.spoken { position:absolute; z-index:0; pointer-events:none; border-radius:3px; background:#ffd34d26; box-shadow:inset 0 0 0 1px #ffd34d66; transition:left .08s linear, width .08s linear; }
-.range { transition:opacity .08s linear; }
-.range-element { fill:#ffffff14; stroke:#ffffff; stroke-width:1.5; }
-/* Drawn at this frame, but not the thing chosen. Present without competing.
- A solid outline of the same weight as the chosen one read as a second
- selection, so what the playhead is merely passing through is dashed and
- thinner: still legible as nesting, no longer a claim that it was picked. */
-.range-binding { fill:color-mix(in srgb, var(--tone, var(--marker)) 7%, transparent);
- stroke:color-mix(in srgb, var(--tone, var(--marker)) 55%, transparent);
- stroke-width:1; stroke-dasharray:3 3; }
-
-/* The picture takes the room that is left; the strip and the timeline are rows
- of the layout, so neither can ever cover the frame or the transport. */
-.left { display:grid; grid-template-rows:minmax(0,1fr) auto auto 288px; }
-.left > div { min-height:0; }
-
-/* Stage --------------------------------------------------------------- */
-.stage { height:100%; display:flex; flex-direction:column; background:#0d0d11; }
-.stage-viewport { flex:1; min-height:0; overflow:hidden; display:flex; align-items:center; justify-content:center; padding:14px; }
-.stage-scaler { position:relative; transform-origin:top left; }
-/* The picture is a rendered composition, not a document to interact with. An
- iframe would otherwise swallow every click before the stage could read it. */
-.stage iframe { display:block; transform-origin:top left; border:0; background:#000; pointer-events:none; box-shadow:0 20px 70px #0009, 0 0 0 1px #ffffff1c; }
-/* The scaler already carries the canvas aspect ratio, so a rendered programme
- fills it exactly and the letterbox falls outside, where the overlay is not. */
-.stage video { display:none; width:100%; height:100%; background:#000; pointer-events:none; box-shadow:0 20px 70px #0009, 0 0 0 1px #ffffff1c; }
-.stage-real iframe { display:none; }
-.stage-real video { display:block; }
-
-/* The overlay covers the letterboxed picture exactly, and its viewBox is the
- canvas, so a box is written in the composition's own pixels. */
-.stage-overlay { position:absolute; inset:0; width:100%; height:100%; pointer-events:none; overflow:visible; }
-.box { --tone:#ffffff; }
-.box-content { fill:color-mix(in srgb, var(--tone) 10%, transparent); stroke:var(--tone); stroke-width:2; }
-/* Where padded material will land; the placeholder paint fills the whole Frame. */
-.box-content-guide { fill:none; stroke:color-mix(in srgb, var(--tone) 45%, transparent); stroke-width:1; stroke-dasharray:3 4; }
-.box-label { fill:var(--tone); font:600 26px Inter, ui-sans-serif, sans-serif; paint-order:stroke; stroke:#000000cc; stroke-width:5px; }
-.box-elsewhere { opacity:.4; }
-.stage-scaler { cursor:default; }
-/* No scrubber here: the timeline below is the one place a playhead is dragged,
- and a second one would be a second answer to the same question. */
-.stage-bar { height:42px; flex:none; display:flex; align-items:center; justify-content:center; background:#0f0f12; border-top:1px solid var(--line); }
-.stage-bar button { display:flex; align-items:center; justify-content:center; width:34px; height:34px; padding:0; color:var(--muted); border:0; background:none; border-radius:50%; cursor:pointer; }
-.stage-bar button:hover { color:var(--text); background:#ffffff12; }
-.stage-bar button:active { background:#ffffff1f; }
-.stage-bar button:focus-visible { outline:2px solid #ffffff; outline-offset:2px; }
-.material-symbols-rounded { font-family:"Material Symbols Rounded"; font-size:26px; line-height:1; font-weight:400; font-style:normal; letter-spacing:normal; text-transform:none; white-space:nowrap; direction:ltr; -webkit-font-feature-settings:"liga"; font-variation-settings:"FILL" 1; }
-
-/* Inspector strip ----------------------------------------------------- */
-/* Not a scroll container: an overflow of any kind would clip the popover below
- rather than merely stack it. The cells wrap instead. */
-.inspector { position:relative; z-index:2; display:flex; flex-wrap:wrap; align-items:center; gap:6px 26px; min-height:52px; padding:8px 16px; background:var(--panel); border-top:1px solid var(--line); }
-.inspector .cell { min-width:0; display:flex; flex-direction:column; gap:2px; }
-.inspector .cell.wide { min-width:120px; }
-/* Written as they read. Letter-spacing only ever served the capitals. */
-.inspector dt { color:#63636e; font-size:11px; }
-.inspector dd { margin:0; font-size:12px; white-space:nowrap; font-variant-numeric:tabular-nums; }
-.inspector .cell.wide dd { color:var(--text); font-weight:600; }
-.skipped { margin-left:auto; position:relative; }
-.skipped summary { cursor:pointer; color:var(--muted); font-size:11px; white-space:nowrap; }
-.skipped-list { position:absolute; right:0; bottom:22px; z-index:6; display:flex; flex-direction:column; min-width:190px; max-height:40vh; overflow-y:auto; padding:6px; background:#131318; border:1px solid var(--line); border-radius:8px; box-shadow:0 12px 30px #000a; }
-.skipped-list button { padding:5px 8px; text-align:left; color:var(--muted); background:none; border:0; border-radius:5px; cursor:pointer; font:inherit; font-size:11px; }
-.skipped-list button:hover { color:var(--text); background:#20202a; }
-/* Timeline ------------------------------------------------------------- */
-.timeline { height:100%; min-height:0; display:flex; flex-direction:column; border-top:1px solid var(--line); background:#0d0d10; }
-.timeline .pane-heading { justify-content:space-between; }
-.timeline [data-readout] { font-variant-numeric:tabular-nums; }
-.timeline-body { flex:1; min-height:0; display:grid; grid-template-columns:104px minmax(0,1fr); overflow-x:hidden; overflow-y:auto; overscroll-behavior:contain; }
-.timeline-labels { position:sticky; left:0; z-index:3; border-right:1px solid var(--line); background:var(--panel2); }
-.label-corner { position:sticky; top:0; z-index:4; background:var(--panel2); height:24px; display:flex; align-items:center; justify-content:flex-end; padding-right:10px; border-bottom:1px solid var(--line); color:#55555f; font-size:10px; font-variant-numeric:tabular-nums; }
-.track-label { min-height:52px; min-width:0; display:flex; flex-direction:column; justify-content:center; gap:2px; padding:0 10px; border-bottom:1px solid var(--line); }
-.track-label strong { font-size:11px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
-.track-label small { color:#63636e; font-size:10px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
-.track-label.track-waiting strong { color:var(--muted); }
-
-.timeline-lanes { position:relative; min-width:0; cursor:crosshair; user-select:none; }
-.ruler { position:sticky; top:0; z-index:2; background:var(--panel); height:24px; border-bottom:1px solid var(--line); }
-.tick { position:absolute; top:0; padding-left:4px; border-left:1px solid #2f2f36; height:24px; line-height:24px; color:#55555f; font-size:10px; font-variant-numeric:tabular-nums; white-space:nowrap; }
-.lane { position:relative; min-height:52px; border-bottom:1px solid var(--line); background:#0f0f13; }
-
-.clip { position:absolute; margin-top:6px; height:40px; min-width:3px; display:flex; flex-direction:column; justify-content:center; gap:2px; padding:0 8px; overflow:hidden; text-align:left; border:1px solid transparent; border-radius:6px; color:var(--text); cursor:pointer; }
-.clip[class*="tone-"] {
- background:color-mix(in srgb, var(--tone) 20%, #14141b);
- border-color:color-mix(in srgb, var(--tone) 52%, transparent);
-}
-.clip[class*="tone-"] .clip-name { color:var(--tone); }
-.clip:hover { border-color:#7b7b8a; }
-/* Live means the playhead is inside it, which is a different claim from being
- selected, so it reads differently: lit rather than ringed. */
-.clip.live { box-shadow:inset 0 0 0 1px color-mix(in srgb, var(--tone, #fff) 60%, transparent); filter:brightness(1.25); }
-.clip-name { font-size:11px; font-weight:600; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
-.clip-meta { font-size:10px; color:#b6b6c2; font-variant-numeric:tabular-nums; }
-
-.playhead { position:absolute; top:0; bottom:0; width:1px; background:#ffffff; pointer-events:none; z-index:2; }
-.playhead-grip { position:sticky; top:0; display:block; margin-left:-5px; width:11px; height:9px; background:#ffffff; clip-path:polygon(0 0,100% 0,50% 100%); z-index:3; }
-
-.failure { position:absolute; left:18px; right:538px; bottom:18px; z-index:5; max-height:180px; overflow:auto; margin:0; padding:12px; color:#ffb0b0; background:#310f13e8; border:1px solid #8d3039; border-radius:8px; white-space:pre-wrap; }
-.failure:empty { display:none; }
-
-@media (max-width:1100px) { main { grid-template-columns:minmax(0,1fr) 400px; } .failure { right:418px; } }
-.inspector .cell.warn dt { color:var(--marker); }
-.inspector .cell.warn dd { color:var(--muted); white-space:normal; max-width:420px; }
-.badge-partial { color:#7fb4ff; border-color:#2f4a6b; }
-/* HyperFrames renders a silent picture; a preview is not a render, so the
- Spine's own material is allowed to sound and this turns it off again. */
-.stage-bar { gap:4px; }
-.stage-mute { width:30px; height:30px; }
-.stage-mute .material-symbols-rounded { font-size:20px; }
-
-/* A clip that is not the shot says so standing still: hatched for a stand-in
- picture, dimmed for a black frame. Reading the note is not the same as being
- able to see which of the two a clip is. */
-/* A stand-in is marked by a line down its leading edge rather than a texture. */
-.clip-stand-in-picture { box-shadow:inset 3px 0 0 var(--tone, var(--muted)); }
-.clip-stand-in-black { opacity:.5; }
-.clip-stand-in-black .clip-name::after { content:" (black)"; color:var(--muted); }
-
-/* The edge between two panels, wide enough to grab and quiet until pointed at. */
-.handle { background:transparent; }
-.handle-column { width:6px; cursor:col-resize; margin-left:-3px; }
-.handle-row { height:6px; cursor:row-resize; margin-bottom:-3px; }
-.handle:hover, .handle:focus-visible { background:#ffffff2e; outline:none; }
-
-/* A Track says what it is showing. Real material is unremarkable; anything
- standing in for a shot that has not been made says so without shouting. */
-.track-label small { display:block; }
-.track-label.source-made small { color:#63636e; }
-.track-label.source-stand-in small { color:var(--marker); }
-.track-label.source-black small { color:var(--muted); }
-.track-label.source-waiting small { color:var(--danger); }
-
-/* The whole programme, with the part on the timeline as a window inside it. */
-.timeline-zoom { flex:none; height:28px; padding:5px 10px 5px 114px; background:var(--panel2); border-top:1px solid var(--line); }
-.zoom { position:relative; height:18px; border-radius:8px; background:#0d0d10; box-shadow:inset 0 0 0 1px var(--line); cursor:pointer; }
-.zoom-window { position:absolute; top:0; bottom:0; border-radius:8px; background:#ffffff1f; box-shadow:inset 0 0 0 1px #ffffff5c; cursor:grab; }
-.zoom-window:active { cursor:grabbing; }
-.zoom-grip { position:absolute; top:50%; width:12px; height:12px; margin-top:-6px; border-radius:50%; background:#ffffffe6; box-shadow:0 1px 4px #0009; cursor:col-resize; }
-.zoom-grip-start { left:3px; }
-.zoom-grip-end { right:3px; }
-
-/* What a Track is showing is a footnote, not a sentence: an icon that opens the
- detail, so a long explanation cannot push the strip out of the panel. */
-.track-note { display:inline-flex; align-items:center; justify-content:center; width:15px; height:15px; margin-left:4px; padding:0; border:0; border-radius:50%; background:#ffffff1a; color:var(--muted); font-size:10px; line-height:1; cursor:pointer; vertical-align:middle; }
-.track-note:hover { background:#ffffff2e; color:var(--text); }
-.track-note.note-stand-in { color:var(--marker); }
-.track-note.note-black { color:var(--muted); }
-.track-note.note-waiting { color:var(--danger); }
-
-/* The final mark reads back from its own line, so no label hangs past the strip. */
-.tick-last { padding-left:0; padding-right:4px; transform:translateX(-100%); border-left:0; border-right:1px solid #2f2f36; }
-
-/* A footnote that appears where it is pointed at and leaves when the pointer
- does. A dialog for a sentence would stop the reader to say very little. */
-.track-note { position:relative; }
-.track-note .note-bubble {
- position:fixed; z-index:60; width:280px; padding:9px 11px; border-radius:8px;
- background:#1b1b21; box-shadow:0 10px 30px #000a, 0 0 0 1px var(--line);
- color:var(--text); font-size:11px; line-height:1.45; text-align:left;
- opacity:0; pointer-events:none; transition:opacity .1s linear;
-}
-.track-note:hover .note-bubble, .track-note:focus-visible .note-bubble { opacity:1; }
-
-.clip.selected { border-color:#ffffff; }
-/* A footnote wraps rather than running off the side of the window. */
-.track-note .note-bubble { white-space:normal; word-break:break-word; max-width:min(320px, 42vw); }
-
-/* Opening a Track shows the rows behind its front one. */
-.track-fold { margin-left:6px; padding:0 5px; height:15px; border:0; border-radius:7px; background:#ffffff1a; color:var(--muted); font-size:10px; line-height:15px; cursor:pointer; vertical-align:middle; }
-.track-fold:hover { background:#ffffff2e; color:var(--text); }
diff --git a/packages/svml-playground/src/ui/timeline.ts b/packages/svml-playground/src/ui/timeline.ts
deleted file mode 100644
index 75f74a4f..00000000
--- a/packages/svml-playground/src/ui/timeline.ts
+++ /dev/null
@@ -1,302 +0,0 @@
-import type { PlaygroundSnapshot } from "../shared.js";
-import { markerTones } from "./markers.js";
-import type { State, Store } from "./selection.js";
-import { createZoom } from "./zoom.js";
-
-export type Timeline = { readonly element: HTMLElement };
-
-/** Ruler ticks land on whole seconds until that gets too dense, then on 5s / 10s. */
-function tickSeconds(durationSec: number, widthPx: number): number {
- for (const step of [1, 2, 5, 10, 15, 30, 60]) {
- if (durationSec / step <= Math.max(2, widthPx / 64)) return step;
- }
- return 120;
-}
-
-function timecode(seconds: number): string {
- const whole = Math.floor(seconds);
- return `${Math.floor(whole / 60)}:${String(whole % 60).padStart(2, "0")}`;
-}
-
-/**
- * A cutting-room timeline read straight from the Source: the Speech Spine on the
- * bottom track, every Media Item above it on one shared track, exactly as an
- * editor would lay them out.
- */
-/** One row of one Track. A Track with overlapping clips is several rows tall. */
-const LANE_HEIGHT = 52;
-
-/** Tracks the reader has opened. A Track shows only its front row until then. */
-const opened = new Set<string>();
-
-/**
- * Where a frame sits across the strip, once the zoom window is taken into
- * account. Everything the timeline draws goes through here, so the ruler, the
- * clips and the playhead cannot disagree about where a moment is.
- */
-function place(frame: number, frameCount: number, shown: { start: number; end: number }): number {
- const span = Math.max(1e-6, shown.end - shown.start);
- return (frame / Math.max(1, frameCount) - shown.start) / span;
-}
-
-export function createTimeline(store: Store): Timeline {
- const element = document.createElement("section");
- element.className = "timeline";
- element.innerHTML = `
- <div class="pane-heading">
- <h2>Timeline</h2>
- <span data-readout></span>
- </div>
- <div class="timeline-body">
- <div class="timeline-labels" data-labels></div>
- <div class="timeline-lanes" data-lanes>
- <div class="ruler" data-ruler></div>
- <div class="lanes" data-rows></div>
- <div class="playhead" data-playhead><div class="playhead-grip"></div></div>
- </div>
- </div>
- <div class="timeline-zoom" data-zoom></div>`;
-
- const readout = element.querySelector<HTMLElement>("[data-readout]")!;
- const labels = element.querySelector<HTMLElement>("[data-labels]")!;
- const lanes = element.querySelector<HTMLElement>("[data-lanes]")!;
- // The whole programme as a bar, with the shown part as a window inside it.
- const zoom = createZoom();
- element.querySelector<HTMLElement>("[data-zoom]")!.append(zoom.element);
- // Positions are computed against the window rather than scaled, so a clip's
- // label stays the size it was however far in the reader has zoomed.
- const ruler = element.querySelector<HTMLElement>("[data-ruler]")!;
- const rows = element.querySelector<HTMLElement>("[data-rows]")!;
- const playhead = element.querySelector<HTMLElement>("[data-playhead]")!;
-
- let state: State | undefined;
- let built = -1;
-
- const fps = (snapshot: PlaygroundSnapshot): number =>
- snapshot.space.frameRate.numerator / snapshot.space.frameRate.denominator;
-
- const frameAt = (clientX: number): number => {
- const box = lanes.getBoundingClientRect();
- if (box.width === 0 || state === undefined) return 0;
- // Where the pointer is inside the window that is shown, not inside the
- // whole programme; zoomed in, the two are different places.
- const across = (clientX - box.left) / box.width;
- const shown = zoom.window();
- const ratio = shown.start + across * (shown.end - shown.start);
- return Math.floor(ratio * state.snapshot.space.frameCount);
- };
-
- const scrub = (event: PointerEvent): void => {
- // Capture keeps a drag alive past the edge of the lanes, but it is not
- // essential: never let it stop the seek that the author actually asked for.
- try { lanes.setPointerCapture(event.pointerId); } catch { /* drag stays local */ }
- store.seek(frameAt(event.clientX), "timeline");
- };
-
- lanes.addEventListener("pointerdown", (event) => {
- // A click on a clip selects it; a click on open track or the ruler moves the
- // playhead and lets go of whatever was selected, because open track is the
- // one place that plainly means "not that one".
- if ((event.target as HTMLElement).closest(".clip") !== null) return;
- store.clearSelection();
- scrub(event);
- });
- lanes.addEventListener("pointermove", (event) => {
- if (event.buttons === 1 && lanes.hasPointerCapture(event.pointerId)) {
- store.seek(frameAt(event.clientX), "timeline");
- }
- });
-
- const drawRuler = (snapshot: PlaygroundSnapshot): void => {
- ruler.replaceChildren();
- const width = lanes.clientWidth;
- const step = tickSeconds(snapshot.space.durationSec, width);
- for (let seconds = 0; seconds <= snapshot.space.durationSec; seconds += step) {
- const tick = document.createElement("span");
- tick.className = "tick";
- const frame = seconds * snapshot.space.frameRate.numerator / snapshot.space.frameRate.denominator;
- const at = place(frame, snapshot.space.frameCount, zoom.window());
- tick.style.left = `${at * 100}%`;
- // A label near the end would hang past the strip and give the panel a
- // width nothing occupies, so the last one reads back from its own mark.
- if (at > 0.94) tick.classList.add("tick-last");
- tick.textContent = timecode(seconds);
- ruler.append(tick);
- }
- };
-
- const build = (snapshot: PlaygroundSnapshot): void => {
- labels.replaceChildren();
- rows.replaceChildren();
- const tones = markerTones(snapshot);
-
- const corner = document.createElement("div");
- corner.className = "label-corner";
- corner.textContent = `${snapshot.space.frameCount}f`;
- labels.append(corner);
-
- for (const track of snapshot.tracks) {
- const label = document.createElement("div");
- label.className = track.waiting === undefined ? "track-label" : "track-label track-waiting";
- label.innerHTML = "<strong></strong><small></small>";
- label.querySelector("strong")!.textContent = track.label;
- // What this Track is showing. Real material at measured times needs no
- // remark; anything else is a footnote the reader can open, because the
- // full sentence would not fit beside the strip.
- const said = {
- made: "Material this Source names.",
- "stand-in": "This shot has not been made. It shows a picture the Source names for it.",
- black: "This shot has no material and names no picture, so it shows a black frame.",
- waiting: `Not built here: waiting on ${(track.waiting ?? []).join(", ")}.`,
- }[track.source];
- const timing = track.timing === "measured"
- ? "Times were supplied."
- : "No times were supplied, so words are placed at an ordinary delivery pace.";
- const plain = track.source === "made" && track.timing === "measured";
- label.querySelector("small")!.textContent =
- `${track.clips.length} clip${track.clips.length === 1 ? "" : "s"}`;
- if (!plain) {
- const note = document.createElement("button");
- note.type = "button";
- note.className = `track-note note-${track.source}`;
- note.append("i");
- note.setAttribute("aria-label", `${said} ${timing}`);
- const bubble = document.createElement("span");
- bubble.className = "note-bubble";
- bubble.textContent = `${said} ${timing}`;
- note.append(bubble);
- // Fixed to the viewport so the panel it hangs out of cannot clip it,
- // which means it has to be told where the note is each time.
- note.addEventListener("pointerenter", () => {
- const box = note.getBoundingClientRect();
- bubble.style.left = `${box.right + 8}px`;
- bubble.style.top = `${Math.max(8, box.top + box.height / 2 - 30)}px`;
- });
- label.querySelector("small")!.append(note);
- }
- labels.append(label);
-
- // Clips that overlap in time cannot share a row without hiding each
- // other, so a Track is as many rows tall as it needs. A board's panel
- // runs the whole programme and its rows settle underneath it.
- // Packed by what is in front: the topmost row holds whatever is drawn over
- // everything else, so a folded Track shows the picture the viewer sees.
- const freeFrom: number[] = [];
- const rowOf = new Map<string, number>();
- const ordered = [...track.clips].sort((a, b) =>
- b.stackOrder - a.stackOrder || a.startFrame - b.startFrame);
- for (const clip of ordered) {
- let row = freeFrom.findIndex((free) => free <= clip.startFrame);
- if (row < 0) { row = freeFrom.length; freeFrom.push(0); }
- freeFrom[row] = clip.endFrameExclusive;
- rowOf.set(clip.id, row);
- }
- const depth = Math.max(1, freeFrom.length);
- const folded = depth > 1 && !opened.has(track.id);
- const shownRows = folded ? 1 : depth;
- label.style.height = `${shownRows * LANE_HEIGHT}px`;
- if (depth > 1) {
- const fold = document.createElement("button");
- fold.type = "button";
- fold.className = "track-fold";
- fold.textContent = folded ? `+${depth - 1}` : "\u2212";
- fold.title = folded ? `Show all ${depth} rows` : "Show only what is in front";
- fold.setAttribute("aria-expanded", String(!folded));
- fold.addEventListener("click", (event) => {
- event.stopPropagation();
- if (opened.has(track.id)) opened.delete(track.id);
- else opened.add(track.id);
- build(snapshot);
- paint();
- });
- label.querySelector("small")!.append(fold);
- }
-
- const lane = document.createElement("div");
- lane.className = "lane";
- lane.style.height = `${shownRows * LANE_HEIGHT}px`;
- for (const clip of track.clips) {
- const node = document.createElement("button");
- node.type = "button";
- node.className = "clip";
- node.dataset.clip = clip.id;
- const from = place(clip.startFrame, snapshot.space.frameCount, zoom.window());
- const to = place(clip.endFrameExclusive, snapshot.space.frameCount, zoom.window());
- node.style.left = `${from * 100}%`;
- const row = rowOf.get(clip.id) ?? 0;
- if (folded && row > 0) continue;
- node.style.top = `${row * LANE_HEIGHT}px`;
- node.style.width = `${(to - from) * 100}%`;
- node.title = `${clip.label} (${clip.startFrame}-${clip.endFrameExclusive}f)`;
- node.innerHTML = `<span class="clip-name"></span><span class="clip-meta"></span>`;
- node.querySelector(".clip-name")!.textContent = clip.label;
- node.querySelector(".clip-meta")!.textContent =
- `${((clip.endFrameExclusive - clip.startFrame) / fps(snapshot)).toFixed(2)}s`;
- if (clip.standIn !== undefined) node.classList.add(`clip-stand-in-${clip.standIn}`);
- // Same tone as the Script marker this clip is named after.
- const tone = tones.get(clip.authoredId);
- if (tone !== undefined) node.classList.add(`tone-${tone}`);
- node.addEventListener("click", () => store.selectClip(clip.id, "timeline"));
- lane.append(node);
- }
- rows.append(lane);
- }
- drawRuler(snapshot);
- };
-
- const paint = (): void => {
- if (state === undefined) return;
- const { snapshot, selection, playhead: head } = state;
- const percent = place(head.frame, snapshot.space.frameCount, zoom.window()) * 100;
- playhead.style.left = `${percent}%`;
- readout.textContent =
- `${head.frame} / ${snapshot.space.frameCount - 1}f (${(head.frame / fps(snapshot)).toFixed(2)}s)`;
- for (const node of Array.from(rows.querySelectorAll<HTMLElement>(".clip"))) {
- const id = node.dataset.clip!;
- node.classList.toggle("selected", selection.kind === "clip" && selection.clipId === id);
- const clip = store.clip(id);
- node.classList.toggle(
- "live",
- clip !== undefined && head.frame >= clip.startFrame && head.frame < clip.endFrameExclusive,
- );
- }
- };
-
- // A trackpad pinch is a wheel event with ctrlKey set; two fingers sideways is
- // a wheel with deltaX. Both are how a reader expects to move around a strip.
- lanes.addEventListener("wheel", (event) => {
- if (event.ctrlKey) {
- event.preventDefault();
- const box = lanes.getBoundingClientRect();
- const at = box.width === 0 ? 0.5 : (event.clientX - box.left) / box.width;
- zoom.pinch(at, Math.exp(event.deltaY * 0.01));
- return;
- }
- if (Math.abs(event.deltaX) <= Math.abs(event.deltaY)) return;
- event.preventDefault();
- zoom.slide(event.deltaX / Math.max(1, lanes.clientWidth));
- }, { passive: false });
-
- // Subscribed here rather than where the zoom is made: it reports its window
- // at once, and there is nothing to redraw until a Source has been read.
- zoom.subscribe(() => {
- if (state === undefined) return;
- build(state.snapshot);
- paint();
- });
-
- store.subscribe((value) => {
- state = value;
- if (value.snapshot.revision !== built) {
- built = value.snapshot.revision;
- build(value.snapshot);
- }
- paint();
- });
-
- new ResizeObserver(() => {
- if (state !== undefined) drawRuler(state.snapshot);
- }).observe(lanes);
-
- return { element };
-}
diff --git a/packages/svml-playground/start.ts b/packages/svml-playground/start.ts
deleted file mode 100644
index 15f4b8db..00000000
--- a/packages/svml-playground/start.ts
+++ /dev/null
@@ -1,89 +0,0 @@
-import { readFileSync } from "node:fs";
-import { dirname, resolve } from "node:path";
-import { fileURLToPath } from "node:url";
-
-import { createServer } from "vite";
-
-import { importedPackages, usePreviewPackages } from "./src/official-video.js";
-import { svmlPlaygroundPlugin } from "./src/server.js";
-
-const here = dirname(fileURLToPath(import.meta.url));
-const repoRoot = resolve(here, "../..");
-
-function usage(message?: string): never {
- if (message !== undefined) process.stderr.write(`${message}\n\n`);
- process.stderr.write(`Usage:
- pnpm svml:playground -- --source <main.svml> [--run <build.svrun>]
- [--runtime <hypit.runtime.json>] [--port <number>]
-
-The Playground reads the Source. It never writes to it, and it never runs a
-Provider: with no build present it estimates timings from the Script text.
-A Run Source is read for material it already names.
-`);
- process.exit(1);
-}
-
-function argumentsByName(argv: readonly string[]): ReadonlyMap<string, string> {
- const result = new Map<string, string>();
- for (let index = 0; index < argv.length; index += 2) {
- const flag = argv[index];
- const value = argv[index + 1];
- if (flag === undefined || !flag.startsWith("--") || value === undefined || value.startsWith("--")) {
- usage(`Malformed argument near ${flag ?? "end of command"}`);
- }
- result.set(flag.slice(2), value);
- }
- return result;
-}
-
-const rawArguments = process.argv.slice(2);
-const values = argumentsByName(rawArguments[0] === "--" ? rawArguments.slice(1) : rawArguments);
-const sourceArgument = values.get("source");
-if (sourceArgument === undefined || !sourceArgument.trim()) usage("Missing --source");
-// `pnpm --filter … exec` runs inside the package directory, so a relative
-// --source must be resolved against the directory the author typed it in.
-const invokedFrom = process.env.INIT_CWD ?? process.cwd();
-const source = resolve(invokedFrom, sourceArgument);
-const runArgument = values.get("run");
-const run = runArgument === undefined ? undefined : resolve(invokedFrom, runArgument);
-// A Runtime profile says where material earlier builds produced is kept. Only a
-// Source that reuses an accepted take needs one.
-const runtimeArgument = values.get("runtime");
-const runtime = runtimeArgument === undefined ? undefined : resolve(invokedFrom, runtimeArgument);
-// Runtime packages belong to the project that selected them. Pointing into the
-// Hypit monorepo would make the preview work here and fail once installed.
-const packageRoot = invokedFrom;
-const port = Number(values.get("port") ?? "5179");
-if (!Number.isSafeInteger(port) || port <= 0) usage("--port must be a positive integer");
-
-// A Source may import a package this application has never heard of, which is
-// exactly what a project-local component is. Load what the Source names, from
-// the project that installed it, alongside the official list.
-usePreviewPackages(
- [source, ...(run === undefined ? [] : [run])]
- .flatMap((path) => importedPackages(readFileSync(path, "utf8"))),
- packageRoot,
-);
-
-const server = await createServer({
- configFile: false,
- root: here,
- server: {
- port,
- fs: {
- allow: [...new Set([
- repoRoot, dirname(source),
- ...(run === undefined ? [] : [dirname(run)]),
- ...(runtime === undefined ? [] : [dirname(runtime)]),
- ])],
- },
- },
- plugins: [svmlPlaygroundPlugin({
- source, root: invokedFrom, packageRoot,
- ...(run === undefined ? {} : { run }),
- ...(runtime === undefined ? {} : { runtime }),
- })],
-});
-
-await server.listen();
-server.printUrls();
diff --git a/packages/svml-playground/test/syntax.test.ts b/packages/svml-playground/test/syntax.test.ts
deleted file mode 100644
index e3d6dde5..00000000
--- a/packages/svml-playground/test/syntax.test.ts
+++ /dev/null
@@ -1,79 +0,0 @@
-import assert from "node:assert/strict";
-import { readFileSync } from "node:fs";
-import test from "node:test";
-
-import { tokenizeSvml } from "../src/ui/syntax.js";
-
-const SOURCE = readFileSync(
- new URL("../../../examples/talking-film-broll-preview/main.svml", import.meta.url),
- "utf8",
-);
-
-function kindsOf(source: string): readonly string[] {
- return tokenizeSvml(source).map((token) => source.slice(token.start, token.end) + `:${token.kind}`);
-}
-
-test("tokens are ordered and never overlap", () => {
- let previous = 0;
- for (const token of tokenizeSvml(SOURCE)) {
- assert.ok(token.start >= previous, `token at ${token.start} overlaps the one before it`);
- assert.ok(token.end > token.start, "a token must cover at least one character");
- previous = token.end;
- }
-});
-
-test("the rendered text reconstructs the source exactly", () => {
- // The code pane emits one text node per token and per gap, so any character
- // the tokenizer skipped or double-counted would corrupt the pane and every
- // offset the highlight geometry depends on.
- let rebuilt = "";
- let cursor = 0;
- for (const token of tokenizeSvml(SOURCE)) {
- rebuilt += SOURCE.slice(cursor, token.start) + SOURCE.slice(token.start, token.end);
- cursor = token.end;
- }
- rebuilt += SOURCE.slice(cursor);
- assert.equal(rebuilt, SOURCE);
-});
-
-test("the Source Header, tags, attributes and references are distinguished", () => {
- const kinds = kindsOf(`<?svml using="@hypit/markup@1"?>
-<svml>
- <space:Frame id="card-a" within={vertical} left="8%"/>
-</svml>
-`);
- assert.ok(kinds.includes(`<?svml using="@hypit/markup@1"?>:header`));
- assert.ok(kinds.includes("space:Frame:tag"));
- assert.ok(kinds.includes("id:attr"));
- assert.ok(kinds.includes(`"card-a":string`));
- assert.ok(kinds.includes("{vertical}:reference"));
-});
-
-test("Script markers and Role Cues are highlighted inside the Script body", () => {
- const kinds = kindsOf(`<svml>
- <script id="story">
- <opening><HOST>A @claim marked phrase@/claim ends here.</opening>
- </script>
-</svml>
-`);
- assert.ok(kinds.includes("@claim:marker"), "an opening marker is a marker");
- assert.ok(kinds.includes("@/claim:marker"), "a closing marker is a marker");
- assert.ok(kinds.includes("HOST:role"), "an upper-case Script tag is a Role Cue");
- assert.ok(kinds.includes("opening:tag"), "a lower-case Script tag is a Segment");
- // Prose between markers stays untokenized, so it renders in the plain colour.
- assert.ok(!kinds.some((entry) => entry.startsWith("marked phrase")));
-});
-
-test("comments are one token, including any markup inside them", () => {
- const kinds = kindsOf("<svml>\n <!-- <space:Frame id=\"x\"/> -->\n</svml>\n");
- assert.ok(kinds.includes(`<!-- <space:Frame id="x"/> -->:comment`));
- assert.ok(!kinds.includes("space:Frame:tag"), "markup inside a comment is not a tag");
-});
-
-test("an unterminated construct consumes the rest rather than looping", () => {
- for (const broken of ["<?svml using=", "<!-- open", "<space:Frame id=\"x", "<space:Frame id={x"]) {
- const tokens = tokenizeSvml(broken);
- assert.ok(tokens.length > 0, `${broken} produced no tokens`);
- assert.ok(tokens.at(-1)!.end <= broken.length);
- }
-});
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index 24f27104..18d10175 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -436,48 +436,6 @@ importers:
specifier: workspace:*
version: link:../script
- packages/caption-playground:
- dependencies:
- '@hypit/caption':
- specifier: workspace:*
- version: link:../caption
- '@hypit/caption-fine':
- specifier: workspace:*
- version: link:../caption-fine
- '@hypit/composition':
- specifier: workspace:*
- version: link:../composition
- '@hypit/fonts-open':
- specifier: workspace:*
- version: link:../fonts-open
- '@hypit/hyperframes':
- specifier: workspace:*
- version: link:../hyperframes
- '@hypit/narrative':
- specifier: workspace:*
- version: link:../narrative
- '@hypit/package-loader-node':
- specifier: workspace:*
- version: link:../package-loader-node
- '@hypit/program-space':
- specifier: workspace:*
- version: link:../program-space
- '@hypit/protocol':
- specifier: workspace:*
- version: link:../protocol
- '@hypit/svs':
- specifier: workspace:*
- version: link:../svs
- '@hypit/video-cli':
- specifier: workspace:*
- version: link:../video-cli
- '@hypit/workspace':
- specifier: workspace:*
- version: link:../workspace
- vite:
- specifier: 5.4.21
- version: 5.4.21(@types/[email protected])
-
packages/cli:
dependencies:
'@hypit/compiler-node':
@@ -1511,6 +1469,9 @@ importers:
'@hypit/speech':
specifier: workspace:*
version: link:../speech
+ '@hypit/svs':
+ specifier: workspace:*
+ version: link:../svs
packages/media-track:
dependencies:
@@ -1532,9 +1493,6 @@ importers:
'@hypit/media':
specifier: workspace:*
version: link:../media
- '@hypit/media-pipeline':
- specifier: workspace:*
- version: link:../media-pipeline
'@hypit/narrative':
specifier: workspace:*
version: link:../narrative
@@ -1664,6 +1622,9 @@ importers:
packages/program-space:
dependencies:
+ '@hypit/markup':
+ specifier: workspace:*
+ version: link:../markup
'@hypit/protocol':
specifier: workspace:*
version: link:../protocol
@@ -1674,7 +1635,7 @@ importers:
dependencies:
'@google/genai':
specifier: 1.52.0
- version: 1.52.0(@modelcontextprotocol/[email protected]([email protected]))
+ version: 1.52.0
'@hypit/caption':
specifier: workspace:*
version: link:../caption
@@ -1778,7 +1739,7 @@ importers:
version: link:../runtime-kit
hyperframes:
specifier: 0.7.101
- version: 0.7.101(@modelcontextprotocol/[email protected]([email protected]))(@types/[email protected])
+ version: 0.7.101(@types/[email protected])
devDependencies:
'@hypit/composition':
specifier: workspace:*
@@ -2086,7 +2047,7 @@ importers:
dependencies:
'@google/genai':
specifier: 1.52.0
- version: 1.52.0(@modelcontextprotocol/[email protected]([email protected]))
+ version: 1.52.0
'@hypit/driver-node':
specifier: workspace:*
version: link:../driver-node
@@ -2457,15 +2418,15 @@ importers:
'@hypit/media':
specifier: workspace:*
version: link:../media
- '@hypit/narrative':
- specifier: workspace:*
- version: link:../narrative
'@hypit/program-space':
specifier: workspace:*
version: link:../program-space
'@hypit/protocol':
specifier: workspace:*
version: link:../protocol
+ '@hypit/semantic-map':
+ specifier: workspace:*
+ version: link:../semantic-map
'@hypit/spatial':
specifier: workspace:*
version: link:../spatial
@@ -2475,6 +2436,9 @@ importers:
'@hypit/component-kit':
specifier: workspace:*
version: link:../component-kit
+ '@hypit/media':
+ specifier: workspace:*
+ version: link:../media
'@hypit/narrative':
specifier: workspace:*
version: link:../narrative
@@ -2531,6 +2495,9 @@ importers:
'@hypit/media-pipeline':
specifier: workspace:*
version: link:../media-pipeline
+ '@hypit/svs':
+ specifier: workspace:*
+ version: link:../svs
'@hypit/validation':
specifier: workspace:*
version: link:../validation
@@ -2564,15 +2531,15 @@ importers:
'@hypit/media-pipeline':
specifier: workspace:*
version: link:../media-pipeline
- '@hypit/narrative':
- specifier: workspace:*
- version: link:../narrative
'@hypit/program-space':
specifier: workspace:*
version: link:../program-space
'@hypit/protocol':
specifier: workspace:*
version: link:../protocol
+ '@hypit/semantic-map':
+ specifier: workspace:*
+ version: link:../semantic-map
'@hypit/spatial':
specifier: workspace:*
version: link:../spatial
@@ -2614,26 +2581,11 @@ importers:
specifier: workspace:*
version: link:../runtime
- packages/svml-playground:
+ packages/studio:
dependencies:
- '@hypit/audio-track':
- specifier: workspace:*
- version: link:../audio-track
- '@hypit/background-removal':
- specifier: workspace:*
- version: link:../background-removal
- '@hypit/caption':
- specifier: workspace:*
- version: link:../caption
- '@hypit/caption-fine':
- specifier: workspace:*
- version: link:../caption-fine
- '@hypit/caption-gemini':
- specifier: workspace:*
- version: link:../caption-gemini
- '@hypit/comment-sticker':
+ '@hypit/cli':
specifier: workspace:*
- version: link:../comment-sticker
+ version: link:../cli
'@hypit/compiler-node':
specifier: workspace:*
version: link:../compiler-node
@@ -2646,69 +2598,18 @@ importers:
'@hypit/core':
specifier: workspace:*
version: link:../core
- '@hypit/deck-track':
- specifier: workspace:*
- version: link:../deck-track
'@hypit/driver-node':
specifier: workspace:*
version: link:../driver-node
'@hypit/elaborator':
specifier: workspace:*
version: link:../elaborator
- '@hypit/endpoint-kit':
- specifier: workspace:*
- version: link:../endpoint-kit
- '@hypit/estimate':
- specifier: workspace:*
- version: link:../estimate
- '@hypit/film':
- specifier: workspace:*
- version: link:../film
- '@hypit/fonts-open':
- specifier: workspace:*
- version: link:../fonts-open
- '@hypit/gemini-omni':
- specifier: workspace:*
- version: link:../gemini-omni
- '@hypit/gpt-image':
- specifier: workspace:*
- version: link:../gpt-image
- '@hypit/grok-imagine':
- specifier: workspace:*
- version: link:../grok-imagine
'@hypit/hyperframes':
specifier: workspace:*
version: link:../hyperframes
- '@hypit/image-compose':
- specifier: workspace:*
- version: link:../image-compose
- '@hypit/image-transform':
- specifier: workspace:*
- version: link:../image-transform
'@hypit/markup':
specifier: workspace:*
version: link:../markup
- '@hypit/media':
- specifier: workspace:*
- version: link:../media
- '@hypit/media-pipeline':
- specifier: workspace:*
- version: link:../media-pipeline
- '@hypit/media-track':
- specifier: workspace:*
- version: link:../media-track
- '@hypit/mimo-tts':
- specifier: workspace:*
- version: link:../mimo-tts
- '@hypit/minimax-h3':
- specifier: workspace:*
- version: link:../minimax-h3
- '@hypit/nano-banana':
- specifier: workspace:*
- version: link:../nano-banana
- '@hypit/narrative':
- specifier: workspace:*
- version: link:../narrative
'@hypit/package-loader-node':
specifier: workspace:*
version: link:../package-loader-node
@@ -2718,72 +2619,30 @@ importers:
'@hypit/protocol':
specifier: workspace:*
version: link:../protocol
- '@hypit/provider-hyperframes-local':
- specifier: workspace:*
- version: link:../provider-hyperframes-local
- '@hypit/provider-media-local':
- specifier: workspace:*
- version: link:../provider-media-local
- '@hypit/provider-whisperx-local':
- specifier: workspace:*
- version: link:../provider-whisperx-local
- '@hypit/ranking':
- specifier: workspace:*
- version: link:../ranking
- '@hypit/render-hyperframes':
- specifier: workspace:*
- version: link:../render-hyperframes
'@hypit/run':
specifier: workspace:*
version: link:../run
- '@hypit/run-markup':
- specifier: workspace:*
- version: link:../run-markup
'@hypit/runtime':
specifier: workspace:*
version: link:../runtime
- '@hypit/runtime-local':
- specifier: workspace:*
- version: link:../runtime-local
- '@hypit/screen-overlay':
+ '@hypit/runtime-host-node':
specifier: workspace:*
- version: link:../screen-overlay
+ version: link:../runtime-host-node
'@hypit/script':
specifier: workspace:*
version: link:../script
- '@hypit/seedance':
- specifier: workspace:*
- version: link:../seedance
- '@hypit/seedream':
- specifier: workspace:*
- version: link:../seedream
- '@hypit/semantic-map':
- specifier: workspace:*
- version: link:../semantic-map
- '@hypit/spatial':
- specifier: workspace:*
- version: link:../spatial
- '@hypit/speech-spine':
- specifier: workspace:*
- version: link:../speech-spine
- '@hypit/svs':
- specifier: workspace:*
- version: link:../svs
- '@hypit/temporal':
- specifier: workspace:*
- version: link:../temporal
- '@hypit/text':
- specifier: workspace:*
- version: link:../text
- '@hypit/typography-track':
- specifier: workspace:*
- version: link:../typography-track
'@hypit/validation':
specifier: workspace:*
version: link:../validation
- '@hypit/whisperx':
+ '@hypit/video-cli':
specifier: workspace:*
- version: link:../whisperx
+ version: link:../video-cli
+ '@hypit/workspace':
+ specifier: workspace:*
+ version: link:../workspace
+ '@hypit/workspace-fs-node':
+ specifier: workspace:*
+ version: link:../workspace-fs-node
vite:
specifier: 5.4.21
version: 5.4.21(@types/[email protected])
@@ -2972,6 +2831,9 @@ importers:
'@hypit/markup':
specifier: workspace:*
version: link:../markup
+ '@hypit/media':
+ specifier: workspace:*
+ version: link:../media
'@hypit/media-pipeline':
specifier: workspace:*
version: link:../media-pipeline
@@ -2981,9 +2843,6 @@ importers:
'@hypit/protocol':
specifier: workspace:*
version: link:../protocol
- '@hypit/semantic-map':
- specifier: workspace:*
- version: link:../semantic-map
'@hypit/speech':
specifier: workspace:*
version: link:../speech
@@ -4281,16 +4140,6 @@ packages:
'@jridgewell/[email protected]':
resolution: {integrity: sha512-cYQ9310grqxueWbl+WuIUIaiUaDcj7WOq5fVhEljNVgRfOUhY9fy2zTvfoqWsnebh8Sl70VScFbICvJnLKB0Og==}
- '@modelcontextprotocol/[email protected]':
- resolution: {integrity: sha512-xKd8OIzlqNzcqcNumGAa6g+PW2kjD5vrpcKOnfldAUPP3j7lnqMPwlTXQm8gF+UwH72z0lqaRbjr9hqGz0eITA==}
- engines: {node: '>=18'}
- peerDependencies:
- '@cfworker/json-schema': ^4.1.1
- zod: ^3.25 || ^4.0
- peerDependenciesMeta:
- '@cfworker/json-schema':
- optional: true
-
'@napi-rs/[email protected]':
resolution: {integrity: sha512-oTXEIha4SsuXdTA4Iyskj0kpdx2yVXdhd75c2v3xGrHFfVMsbhTPZU/nMPL4sWKo4pBHm3aucLaqGlF696dTyQ==}
engines: {node: ^22.20 || ^24.12 || >=25}
@@ -4660,10 +4509,6 @@ packages:
'@vueuse/[email protected]':
resolution: {integrity: sha512-dznP38YzxZoNloI0qpEfpkms8knDtaoQ6Y/sfS0L7Yki4zh40LFHEhur0odJC6xTHG5dxWVPiUWBXn+wCG2s5w==}
- resolution: {integrity: sha512-5cvg6CtKwfgdmVqY1WIiXKc3Q1bkRqGLi+2W/6ao+6Y7gu/RCwRuAhGEzh5B4KlszSuTLgZYuqFqo5bImjNKng==}
- engines: {node: '>= 0.6'}
-
resolution: {integrity: sha512-HEHNfbars9v4pgpW6SO1KSPkfoS0xVOM/9UzkJltjlsHZmJasxg8aXkuZa7SMf8vKGIBhpUsPluQSqhJFCqebw==}
engines: {node: '>=0.4.0'}
@@ -4685,17 +4530,6 @@ packages:
resolution: {integrity: sha512-MnA+YT8fwfJPgBx3m60MNqakm30XOkyIoH1y6huTQvC0PwZG7ki8NacLBcrPbNoo8vEZy7Jpuk7+jMO+CUovTQ==}
engines: {node: '>= 14'}
- resolution: {integrity: sha512-8iUql50EUR+uUcdRQ3HDqa6EVyo3docL8g5WJ3FNcWmu62IbkGUue/pEyLBW8VGKKucTPgqeks4fIU1DA4yowQ==}
- peerDependencies:
- ajv: ^8.0.0
- peerDependenciesMeta:
- ajv:
- optional: true
-
- resolution: {integrity: sha512-Thbli+OlOj+iMPYFBVBfJ3OmCAnaSyNn4M1vz9T6Gka5Jt9ba/HIR56joy65tY6kx/FCF5VXNB819Y7/GUrBGA==}
-
resolution: {integrity: sha512-PrqppUmhT4ENdas2pH9caE7efUcxy6EcSFhWzosiVuQBzu2tQ5yLTI6jwomT/1cuBnivzGfxiJCqDNN9FRRh+Q==}
engines: {node: '>= 14.0.0'}
@@ -4769,10 +4603,6 @@ packages:
resolution: {integrity: sha512-KrayHS5pBi69Xi9JmvoqrIgYGDkD6mcSe/i6YKi3w5kekCLzrX4+nawcXqrj2tIp50Kw/mT/s3p+GVK0A0sKxw==}
- resolution: {integrity: sha512-2cGmJupaNgg+QUwVLAucDuWuoMZ6EX9iHDRswZ5lsNYEmwPaRknMPCLZz07yTzVq/83p4o/wzbDZbBrTvGGTIw==}
- engines: {node: '>=18'}
-
resolution: {integrity: sha512-DkVaaQHymRhpYEYo9x1oo7Q7B0Y6KJUsjm3c9eTyFDby4MHLBTwZ6ZDWBel5zrYxj1WsZgC5oLpiz+93MluXeA==}
engines: {node: '>=20.19.0'}
@@ -4800,18 +4630,6 @@ packages:
resolution: {integrity: sha512-tjwM5exMg6BGRI+kNmTntNsvdZS1X8BFYS6tnJ2hdH0kVxM6/eVZ2xy+FqStSWvYmtfFMDLIxurorHwDKfDz5Q==}
engines: {node: '>=18'}
- resolution: {integrity: sha512-/Nf7TyzTx6S3yRJObOAV7956r8cr2+Oj8AC5dt8wSP3BQAoeX58NoHyCU8P8zGkNXStjTSi6fzO6F0pBdcYbEg==}
- engines: {node: '>= 0.8'}
-
- resolution: {integrity: sha512-Sp1ablJ0ivDkSzjcaJdxEunN5/XvksFJ2sMBFfq6x0ryhQV/2b/KwFe21cMpmHtPOSij8K99/wSfoEuTObmuMQ==}
- engines: {node: '>= 0.4'}
-
- resolution: {integrity: sha512-+ys997U96po4Kx/ABpBCqhA9EuxJaQWDQg7295H4hBphv3IZg0boBKuwYpt4YXp6MZ5AmZQnU/tyMTlRpaSejg==}
- engines: {node: '>= 0.4'}
-
resolution: {integrity: sha512-4tYFyifaFfGacoiObjJegolkwSU4xQNGbVgUiNYVUxbQ2x2lUsFvY4hVgVzGiIe6WLOPqycWXA40l+PWsxthUw==}
@@ -4858,38 +4676,10 @@ packages:
resolution: {integrity: sha512-MWufYdFw53ccGjCA+Ol7XJYpAlW6/prSMzuPOTRnJGcGzuhLn4Scrz7qf6o8bROZ514ltazcIFJZevcfbo0x7A==}
engines: {'0': node >= 6.0}
- resolution: {integrity: sha512-5jRCH9Z/+DRP7rkvY83B+yGIGX96OYdJmzngqnw2SBSxqCFPd0w2km3s5iawpGX8krnwSGmF0FW5Nhr0Hfai3g==}
- engines: {node: '>=18'}
-
- resolution: {integrity: sha512-nTjqfcBFEipKdXCv4YDQWCfmcLZKm81ldF0pAopTvyrFGVbcR6P/VAAd5G7N+0tTr8QqiU0tFadD6FK4NtJwOA==}
- engines: {node: '>= 0.6'}
-
- resolution: {integrity: sha512-mj7UPXE0jaqaOsukNZRUEfEi2AcL7C/vwmwcHV0O97eO1E1pxBZuyjlZrx5seTaNBg1U6+o35wpa35Qfcc+7ag==}
- engines: {node: '>=18'}
-
- resolution: {integrity: sha512-D76uU73ulSXrD1UXF4KE2TMxVVwhsnCgfAyTg9k8P6KGZjlXKrOLe4dJQKI3Bxi5wjesZoFXJWElNWBjPZMbhg==}
- engines: {node: '>=6.6.0'}
-
- resolution: {integrity: sha512-yki5XnKuf750l50uGTllt6kKILY4nQ1eNIQatoXEByZ5dWgnKqbnqmTrBE5B4N7lrMJKQ2ytWMiTO2o0v6Ew/w==}
- engines: {node: '>= 0.6'}
-
resolution: {integrity: sha512-7Vv6asjS4gMOuILabD3l739tsaxFQmC+a7pLZm02zyvs8p977bL3zEgq3yDk5rn9B0PbYgIv++jmHcuUab4RhA==}
engines: {node: '>=18'}
- resolution: {integrity: sha512-tJtZBBHA6vjIAaF6EnIaq6laBBP9aq/Y3ouVJjEfoHbRBcHBAHYcMh/w8LDrk2PvIMMq8gmopa5D4V8RmbrxGw==}
- engines: {node: '>= 0.10'}
-
- resolution: {integrity: sha512-uV2QOWP2nWzsy2aMp8aRibhi9dlzF5Hgh5SHaB9OiTGEyDTiJJyx0uy51QXdyWbtAHNua4XJzUKca3OzKUd3vA==}
- engines: {node: '>= 8'}
-
resolution: {integrity: sha512-snmjEVXy+1LnwXdxhYvTMj1d9tOh4HxkA1YmoayVBeeyR2C14Pum7fcxJIm4SswYspVy866eYNwlH6xC3/VH5g==}
engines: {node: '>=20.19.0'}
@@ -4942,10 +4732,6 @@ packages:
resolution: {integrity: sha512-8QmQKqEASLd5nx0U1B1okLElbUuuttJ/AnYmRXbbbGDWh6uS208EjD4Xqq/I9wK7u0v6O08XhTWnt5XtEbR6Dg==}
engines: {node: '>= 0.4'}
- resolution: {integrity: sha512-g7nH6P6dyDioJogAAGprGpCtVImJhpPk/roCzdb3fIh61/s/nPsfR6onyMwkCAR/OlC3yBC0lESvUoQEAssIrw==}
- engines: {node: '>= 0.8'}
-
resolution: {integrity: sha512-0je+qPKHEMohvfRTCEo3CrPG6cAzAYgmzKyxRiYSSDkS6eGJdyVJm7WaYA5ECaAD9wLB2T4EEeymA5aFVcYXCA==}
engines: {node: '>=6'}
@@ -4995,26 +4781,15 @@ packages:
resolution: {integrity: sha512-qI4JLRKnSzqFqr7hAlS5xQDusBCjKSEG4t4+7aNrIQMHBcsC2TGEhuyABJdYkgSewL57PNLYEiibY2iPKhKpaA==}
engines: {node: '>=20.19.0'}
- resolution: {integrity: sha512-KIN/nDJBQRcXw0MLVhZE9iQHmG68qAVIBg9CqmUYjmQIhgij9U5MFvrqkUL5FbtyyzZuOeOt0zdeRe4UY7ct+A==}
- engines: {node: '>= 0.4'}
-
resolution: {integrity: sha512-nagl3RYrbNv6kQkeJIpt6NJZy8twLB/2vtz6yN9Z4vRKHN4/QZJIEbqohALSgwKdnksuY3k5Addp5lg8sVoVcQ==}
- resolution: {integrity: sha512-WMwm9LhRUo+WUaRN+vRuETqG89IgZphVSNkdFgeb6sS/E4OrDIN7t48CAewSHXc6C8lefD8KKfr5vY61brQlow==}
-
resolution: {integrity: sha512-LRlerrMYoIDrT6jgpeZ2YYl/L8EulRTt5hQcYjy5AInh7HWXKimpqx68aknBFpGL2+/IcogTcaydJEgaTmOpDg==}
resolution: {integrity: sha512-toUI84YS5YmxW219erniWD0CIVOo46xGKColeNQRgOzDorgBi1v4D71/OFzgD9GO2UGKIv1C3Sp8DAn0+j5w7A==}
- resolution: {integrity: sha512-Q0n9HRi4m6JuGIV1eFlmvJB7ZEVxu93IrMyiMsGC0lrMJMWzRgx6WGquyfQgZVb31vhGgXnfmPNNXmxnOkRBrg==}
- engines: {node: '>= 0.8'}
-
resolution: {integrity: sha512-ooEGc6HP26xXq/N+GCGOT0JKCLDGrq2bQUZrQ7gyrJiZANJ/8YDTxTpQBXGMn+WbIQXNVpyWymm7KYVICQnyOg==}
@@ -5042,10 +4817,6 @@ packages:
resolution: {integrity: sha512-Zf5H2Kxt2xjTvbJvP2ZWLEICxA6j+hAmMzIlypy4xcBg1vKVnx89Wy0GbS+kf5cwCVFFzdCFh2XSCFNULS6csw==}
engines: {node: '>= 0.4'}
- resolution: {integrity: sha512-HWcBoN6NileqtSydK2FqHbS/LoDd2pqrnQHLyJzBj4kOp/ky2MWMN694xOfkK8/SnUsW2DH7EfyVlydKCsm1Zw==}
- engines: {node: '>= 0.4'}
-
resolution: {integrity: sha512-Um/+FxMr9CISWh0bi5Zv0iOD+4cFh5qLeks1qhAopKVAJw3drgKbKySikp7wGhDL0HPeaja0P5ULZrxLkniUVg==}
@@ -5068,9 +4839,6 @@ packages:
resolution: {integrity: sha512-WUj2qlxaQtO4g6Pq5c29GTcWGDyd8itL8zTlipgECz3JesAiiOKotd8JU6otB3PACgG6xkJUyVhboMS+bje/jA==}
engines: {node: '>=6'}
- resolution: {integrity: sha512-NiSupZ4OeuGwr68lGIeym/ksIZMJodUGOSCZ/FSnTxcrekbvqrgdUxlJOMpijaKZVjAJrWrGs/6Jy8OMuyj9ow==}
-
resolution: {integrity: sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==}
engines: {node: '>=10'}
@@ -5083,31 +4851,9 @@ packages:
resolution: {integrity: sha512-Rfkk/Mp/DL7JVje3u18FxFujQlTNR2q6QfMSMB7AvCBx91NGj/ba3kCfza0f6dVDbw7YlRf/nDrn7pQrCCyQ/w==}
- resolution: {integrity: sha512-aIL5Fx7mawVa300al2BnEE4iNvo1qETxLrPI/o05L7z6go7fCw1J6EQmbK4FmJ2AS7kgVF/KEZWufBfdClMcPg==}
- engines: {node: '>= 0.6'}
-
resolution: {integrity: sha512-LUd5euvbMLpwOF8m6ivPCbhQeSiYVNb8Vs0fQ8QjXo0JTkEHpz8pxdQf0gStltaPpw0Cca8b39KxvK9cfKRiAw==}
- resolution: {integrity: sha512-EKN1vKAMcZ8MlYMpaNuxN6R9yakzH6uajHcHVTqWJzvu5pWw9DyhbP35HH8MVBQ+dZjAfDxk+A8NiR9KWaXiyQ==}
- engines: {node: '>=18.0.0'}
-
- resolution: {integrity: sha512-CRT1WTyuQoD771GW56XEZFQ/ZoSfWid1alKGDYMmkt2yl8UXrVR4pspqWNEcqKvVIzg6PAltWjxcSSPrboA4iA==}
- engines: {node: '>=18.0.0'}
-
- resolution: {integrity: sha512-YH4ru+eOJxQABscKFfRCy9R7x9QFGdezclVMwwgFFndzS2Xnm0uo6B0ABZsLhcpeptGv2qvuJVWlQr9gQZoC3A==}
- engines: {node: '>= 16'}
- peerDependencies:
- express: '>= 4.11'
-
- resolution: {integrity: sha512-hIS4idWWai69NezIdRt2xFVofaF4j+6INOpJlVOLDO8zXGpUVEVzIYk12UUi2JzjEzWL3IOAxcTubgz9Po0yXw==}
- engines: {node: '>= 18'}
-
resolution: {integrity: sha512-fjquC59cD7CyW6urNXK0FBufkZcoiGG80wTuPujX590cB5Ttln20E2UB4S/WARVqhXffZl2LNgS+gQdPIIim/g==}
@@ -5117,9 +4863,6 @@ packages:
resolution: {integrity: sha512-/d9sfos4yxzpwkDkuN7k2SqFKtYNmCTzgfEpz82x34IM9/zc8KGxQoXg1liNC/izpRM/MBdt44Nmx41ZWqk+FQ==}
- resolution: {integrity: sha512-gHwA1O9LDIcKunMKhObS/HimwtehO1nPUECKAu5TpKgaO19fcWEl4bliWe1jWxVFvIXztJjjQ4L8XQ1EU9f7Jw==}
-
resolution: {integrity: sha512-7yAQpD2UMJzLi1Dqv7qFYnPbaPx7ZfFK6PiIxQ4PfkGPyNyl2Ugx+a/umUonmKqjhM4DnfbMvdX6otXq83soQQ==}
engines: {node: ^12.20 || >= 14.13}
@@ -5131,10 +4874,6 @@ packages:
resolution: {integrity: sha512-Dvpa9uhVMOYivhHKWLGDoa512J751qN1WZAIO+Xw4L/mrUSPxS4DApzSUDbCFE/LUq2+xYnznEahTd63AqBSpA==}
- resolution: {integrity: sha512-S8KoZgRZN+a5rNwqTxlZZePjT/4cnm0ROV70LedRHZ0p8u9fRID0hJUZQpkKLzro8LfmC8sx23bY6tVNxv8pQA==}
- engines: {node: '>= 18.0.0'}
-
resolution: {integrity: sha512-/yNdlIkpWbM0ptxno3ONTuf+2g318kh2ez3KSeZN5dZ8YC6AAmgeWz+GasYYiBJPFaYcSAPeu4GfhUaChzIJXA==}
@@ -5145,22 +4884,11 @@ packages:
resolution: {integrity: sha512-buewHzMvYL29jdeQTVILecSaZKnt/RJWjoZCF5OW60Z67/GmSLBkOFM7qh1PI3zFNtJbaZL5eQu1vLfazOwj4g==}
engines: {node: '>=12.20.0'}
- resolution: {integrity: sha512-buRG0fpBtRHSTCOASe6hD258tEubFoRLb4ZNA6NxMVHNw2gOcwHo9wyablzMzOA5z9xA9L1KNjk/Nt6MT9aYow==}
- engines: {node: '>= 0.6'}
-
- resolution: {integrity: sha512-Rx/WycZ60HOaqLKAi6cHRKKI7zxWbJ31MhntmtwMoaTeF7XFH9hhBp8vITaMidfljRQ6eYWCKkaTK+ykVJHP2A==}
- engines: {node: '>= 0.8'}
-
resolution: {integrity: sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==}
engines: {node: ^8.16.0 || ^10.6.0 || >=11.0.0}
os: [darwin]
- resolution: {integrity: sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==}
-
resolution: {integrity: sha512-RB5vLV+vvQeoFPCX4QMK6/hjVkbIamPp1QSUD0CiZcnj12qbpiL+pLbYtgD+oZkWl0tl9z+o2Utp+MpM3QRhBA==}
engines: {node: '>=18'}
@@ -5177,14 +4905,6 @@ packages:
resolution: {integrity: sha512-QRbvDIbx6YklUe6RxeTeleMR0yv3cYH6PsPZHcnVn7xv7zO1BHN8r0XETu8n6Ye3Q+ahtSarc3WgtNWmehIBfA==}
engines: {node: '>=18'}
- resolution: {integrity: sha512-9fSjSaos/fRIVIp+xSJlE6lfwhES7LNtKaCBIamHsjr2na1BiABJPo0mOjjz8GJDURarmCPGqaiVg5mfjb98CQ==}
- engines: {node: '>= 0.4'}
-
- resolution: {integrity: sha512-sTSfBjoXBp89JvIKIefqw7U2CCebsc74kiY6awiGogKtoSGbgjYE/G/+l9sF3MWFPNc9IcoOC4ODfKHfxFmp0g==}
- engines: {node: '>= 0.4'}
-
resolution: {integrity: sha512-yTb+8DXzDREzgvYmh6s9vHsSVCHeC0G3PI5bEXNBHtmshPnO+S5O7qgLEOn0I5QvMy6kpZN8K1NKGyilLb93wA==}
@@ -5215,14 +4935,6 @@ packages:
resolution: {integrity: sha512-55JNKuIW+vq4Ke1BjOTjM2YctQIvCT7GFzHwmfZPGo5wnrgkid0YQtnAleFSqumZm4az3n2BS+erby5ipJdgrg==}
- resolution: {integrity: sha512-1cDNdwJ2Jaohmb3sg4OmKaMBwuC48sYni5HUw2DvsC8LjGTLK9h+eb1X6RyuOHe4hT0ULCW68iomhjUoKUqlPQ==}
- engines: {node: '>= 0.4'}
-
- resolution: {integrity: sha512-T2UbfbBEF32wiepXIsMlTW9+dDYC6wMh/t/vYA4tuOMKqWz/n3vr1NFSxQiyP+zk2mXsoMA/i/7qV6LKut1t1A==}
- engines: {node: '>= 0.4'}
-
resolution: {integrity: sha512-OguPdidb+fbHQSU4Q4ZiLKnzWo8Wwsf5bZfbvu7//a9oTYoqD/fWpe96NuHkoS9h0ccGOTe0C4NGXdtS0iObOw==}
@@ -5245,10 +4957,6 @@ packages:
resolution: {integrity: sha512-VTZkM9GWRAtEpveh7MSF6SjjrpNVNNVJfFup7xTY3UpFtm67foy9HDVXneLtFVt4pMz5kZtgNcvCniNFb1hlEQ==}
- resolution: {integrity: sha512-4FbRdAX+bSdmo4AUFuS0WNiPz8NgFt+r8ThgNWmlrjQjt1Q7ZR9+zTlce2859x4KSXrwIsaeTqDoKQmtP8pLmQ==}
- engines: {node: '>= 0.8'}
-
resolution: {integrity: sha512-bqX0XTF6fnXSQcEJ2Iuyr75yVakyjIDCqroJQ/aHfSdlM743Cwqoi2nDYMzLGWUcuTWGWy8AAvOKXTfiv6q9RA==}
@@ -5265,10 +4973,6 @@ packages:
engines: {node: '>=22'}
hasBin: true
- resolution: {integrity: sha512-IKXpvIzjnC9XTAUbVBcMfGS0EPaIXtW6v+zr+RRp+hqULEpo0owZax6wyRwPOJbWbzjYspQwusTsfVr0ifh4uQ==}
- engines: {node: '>=0.10.0'}
-
resolution: {integrity: sha512-hsBTNUqQTDwkWtcdYI2i06Y/nUBEsNEDJKjWdigLvegy8kDuJAS8uRlpkkcQpyEXL0Z/pjDy5HBmMjRCJ2gq+g==}
engines: {node: '>= 4'}
@@ -5276,14 +4980,6 @@ packages:
resolution: {integrity: sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==}
- resolution: {integrity: sha512-R5SnVLJmgYYvf2F2ZgwSBnelz5G4q5AxIC277GDfUaNbrZKNANcBC7RHqYYePlszf4kBolVkJauG0ZjHHFh55g==}
- engines: {node: '>= 12'}
-
- resolution: {integrity: sha512-0KI/607xoxSToH7GjN1FfSbLoU0+btTicjsQSWQlh/hZykN8KpmMf7uYwPW3R+akZ6R/w18ZlXSHBYXiYUPO3g==}
- engines: {node: '>= 0.10'}
-
resolution: {integrity: sha512-eljcgEDlEns/7AXFosB5K/2nCM4P7FQPkGc/DWLy5rmFEWvZayGrik1d9/QIY5nJ4f9YsVvBkA6kJpHn9rISdQ==}
engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0}
@@ -5294,9 +4990,6 @@ packages:
engines: {node: '>=14.16'}
hasBin: true
- resolution: {integrity: sha512-hvpoI6korhJMnej285dSg6nu1+e6uxs7zG3BYAm5byqDsgJNWwxzM6z6iZiAgQR4TJ30JmBTOwqZUw3WlyH3AQ==}
-
resolution: {integrity: sha512-oG7cgbmg5kLYae2N5IVd3jm2s+vldjxJzK1pcu9LfpGuQ93MQSzo0okvRna+7y5ifrD+20FE8FvjusyGaz14fw==}
engines: {node: '>=18'}
@@ -5305,21 +4998,9 @@ packages:
resolution: {integrity: sha512-e6rvdUCiQCAuumZslxRJWR/Doq4VpPR82kqclvcS0efgt430SlGIk05vdCN58+VrzgtIcfNODjozVielycD4Sw==}
engines: {node: '>=16'}
- resolution: {integrity: sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==}
-
- resolution: {integrity: sha512-XrchZOFZUl/T3vTwRe8XK+cJrGtMF4th1ARnDfwbBXFKThGhlsxEE4Zu03AD/bjJSt/9jT/mxrOCkJWOg77aPA==}
-
resolution: {integrity: sha512-SiPv/8VpZuWbvLSMtTDU8hEfrZWg/mH/nV/b4o0CYbSxu1UIQPLdwKOCIyLQX+VIPO5vrLX3i8qtqFyhdPSUSQ==}
- resolution: {integrity: sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug==}
-
- resolution: {integrity: sha512-fQhoXdcvc3V28x7C7BMs4P5+kNlgUURe2jmUT1T//oBRMDrqy1QPelJimwZGo7Hg9VPV3EQV5Bnq4hbFy2vetA==}
-
resolution: {integrity: sha512-ZClg6AaYvamvYEE82d3Iyd3vSSIjQ+odgjaTzRuO3s7toCdFKczob2i0zCh7JE8kWn17yvAWhUVxvqGwUalsRA==}
@@ -5355,21 +5036,9 @@ packages:
resolution: {integrity: sha512-OkeDaAZ/bQCxeFAozM55PKcKU0yJMPGifLwV4Qgjitu+5MoAfSQN4lsLJeXZ1b8w0x+/Emda6MZgXS1jvsapng==}
engines: {node: '>=10'}
- resolution: {integrity: sha512-/IXtbwEk5HTPyEwyKX6hGkYXxM9nbj64B+ilVJnC/R6B0pH5G4V3b0pVbL7DBj4tkhBAppbQUlf6F6Xl9LHu1g==}
- engines: {node: '>= 0.4'}
-
resolution: {integrity: sha512-cctsq2wp5vTsLIcaymblUriiTcZd0CwWtCbLvrOzYCDZoWyMNV8sZ7krj09FSnsiJi3WVsHLM4k6Dq/yaPyCXA==}
- resolution: {integrity: sha512-yz3xRaG20c6/BOzvYoDaGtPmGscs7YivItZEEqe6GbwNfHuxu9YNmvnEkMzKldAGY4/80pRcQRZSEnhquk9XuQ==}
- engines: {node: '>= 0.8'}
-
- resolution: {integrity: sha512-Snk314V5ayFLhp3fkUREub6WtjBfPdCPY1Ln8/8munuLuiYhsABgBVWsozAG+MWMbVEvcdcpbi9R7ww22l9Q3g==}
- engines: {node: '>=18'}
-
resolution: {integrity: sha512-wv8tdUTJ3thSFFFJKtpYKOYiGP2+v96Hvk4Tu8KpCAsTMs6yi+nVmGh1syvSCsaxz45J6Jbw+9DD6g97+NV67Q==}
@@ -5385,14 +5054,6 @@ packages:
resolution: {integrity: sha512-Yw0ECSpJoViF1qTU4DC6NwtC4aWGt1EkzaQB8KPPyCRR8z9TWeV0HbEFGTO+ZY1wB22zmxnJqhPyTpOVCpeHTA==}
- resolution: {integrity: sha512-aU5EJuIN2WDemCcAp2vFBfp/m4EAhWJnUNSSw0ixs7/kXbd6Pg64EmwJkNdFhB8aWt1sH2CTXrLxo/iAGV3oPQ==}
- engines: {node: '>= 0.6'}
-
- resolution: {integrity: sha512-Lbgzdk0h4juoQ9fCKXW4by0UJqj+nOOrI9MJ1sSj4nI8aI2eo1qmvQEie4VD1glsS250n15LsWsYtCugiStS5A==}
- engines: {node: '>=18'}
-
resolution: {integrity: sha512-tEBHqDnIoM/1rXME1zgka9g6Q2lcoCkxHLuc7ODJ5BxbP5d4c2Z5cGgtXAku59200Cx7diuHTOYfSBD8n6mm8A==}
engines: {node: '>=16 || 14 >=14.17'}
@@ -5419,10 +5080,6 @@ packages:
engines: {node: ^10 || ^12 || ^13.7 || ^14 || >=15.0.1}
hasBin: true
- resolution: {integrity: sha512-8Ofs/AUQh8MaEcrlq5xOX0CQ9ypTF5dl78mjlMNfOK08fzpgTHQRQPBxcPlEtIw0yRpws+Zo/3r+5WRby7u3Gg==}
- engines: {node: '>= 0.6'}
-
resolution: {integrity: sha512-/jKZoMpw0F8GRwl4/eLROPA3cfcXtLApP0QzLmUT/HuPCZWyB7IY9ZrMeKw2O/nFIqPQB3PVM9aYm0F312AXDQ==}
engines: {node: '>=10.5.0'}
@@ -5436,22 +5093,10 @@ packages:
resolution: {integrity: sha512-GX0gsdbGVCgnRgbeGaubfjpBXyYRWOOCVeYh08bSQvDZqxz5ndXs1OTfAt/h36G1xvI94YIspsI0sVFqAV9+RQ==}
engines: {node: '>=20.19.0'}
- resolution: {integrity: sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg==}
- engines: {node: '>=0.10.0'}
-
- resolution: {integrity: sha512-W67iLl4J2EXEGTbfeHCffrjDfitvLANg0UlX3wFUUSTx92KXRFegMHUVgSqE+wvhAbi4WqjGg9czysTV2Epbew==}
- engines: {node: '>= 0.4'}
-
resolution: {integrity: sha512-NuAESUOUMrlIXOfHKzD6bpPu3tYt3xvjNdRIQ+FeT0lNb4K8WR70CaDxhuNguS2XG+GjkyMwOzsN5ZktImfhLA==}
engines: {node: '>= 0.4'}
- resolution: {integrity: sha512-oVlzkg3ENAhCk2zdv7IJwd/QUD4z2RxRwpkcGY8psCVcCYZNq4wYnVWALHM+brtuJjePWiYF/ClmuDr8Ch5+kg==}
- engines: {node: '>= 0.8'}
-
resolution: {integrity: sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==}
@@ -5479,27 +5124,12 @@ packages:
resolution: {integrity: sha512-60zvsJReQPX5/QP0Kzfd/VrpjScIQ7SHBW6bFCYfEP+fp0Eppr1SHhIO5nd1PjZtvclzSzES9D/p5nFJurwfWg==}
- resolution: {integrity: sha512-CiyeOxFT/JZyN5m0z9PfXw4SCBJ6Sygz1Dpl0wqjlhDEGGBP1GnsUVEL0p63hoG1fcj3fHynXi9NYO4nWOL+qQ==}
- engines: {node: '>= 0.8'}
-
- resolution: {integrity: sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==}
- engines: {node: '>=8'}
-
- resolution: {integrity: sha512-qRcuIdP69NPm4qbACK+aDogI5CBDMi1jKe0ry5rSQJz8JVLsC7jV8XpiJjGRLLol3N+R5ihGYcrPLTno6pAdBA==}
-
resolution: {integrity: sha512-xCy9V055GLEqoFaHoC1SoLIaLmWctgCUaBaWxDZ7/Zx4CTyX7cJQLJOok/orfjZAh9kEYpjJa4d0KcJmCbctZA==}
resolution: {integrity: sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA==}
- resolution: {integrity: sha512-wQ0b/W4Fr01qtpHlqSqspcj3EhBvimsdh0KlHhH8HRZnMsEa0ea2fTULOXOS9ccQr3om+GcGRk4e+isrZWV8qQ==}
- engines: {node: '>=16.20.0'}
-
resolution: {integrity: sha512-KvvtD7SrlBP7dlgkBghEE3r84CABm5SmV2aNcG4oCA+qDnJ/tvKonFVvwWAyyWUEwxuNawdfEAZKP9zM3oZ2Uw==}
engines: {node: '>=4'}
@@ -5532,10 +5162,6 @@ packages:
resolution: {integrity: sha512-/FPD0nUc9jH6rfFjji9IBqOz4pcSE3CsT1m7Ep6Mdb0LxSUMj8hgl6GomOvZzpNpAqqGaXA0P3VSrZLFzIhQrw==}
engines: {node: '>=12.0.0'}
- resolution: {integrity: sha512-llQsMLSUDUPT44jdrU/O37qlnifitDP+ZwrmmZcoSKyLKvtZxpyV0n2/bD/N4tBAAZ/gJEdZU7KMraoK1+XYAg==}
- engines: {node: '>= 0.10'}
-
resolution: {integrity: sha512-VS7sjc6KR7e1ukRFhQSY5LM2uBWAUPiOPa/A3mkKmiMwSmRFUITt0xuj+/lesgnCv+dPIEYlkzrcyXgquIHMcA==}
@@ -5548,18 +5174,6 @@ packages:
engines: {node: '>=22.12.0'}
hasBin: true
- resolution: {integrity: sha512-O9gl3zCl5h5blw1KGUzQKhA5oUXSl8rwUIM5o0S3nCXMliSvy5Dzx7/DJcI+SwgICv+IneSZwhBh1oSyEHA71A==}
- engines: {node: '>=0.6'}
-
- resolution: {integrity: sha512-hek2mFQpPuI4E1BBKrSto+BU3e3x4xuarsbiwr3+lf7p44juvFMV0XFWQAP3xUyqXA4RrXLIoaSUGbSt056ZMw==}
- engines: {node: '>= 0.6'}
-
- resolution: {integrity: sha512-K5zQjDllxWkf7Z5xJdV0/B0WTNqx6vxG70zJE4N0kBs4LovmEYWJzQGxC9bS9RAKu3bgM40lrd5zoLJ12MQ5BA==}
- engines: {node: '>= 0.10'}
-
resolution: {integrity: sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA==}
engines: {node: '>= 6'}
@@ -5577,10 +5191,6 @@ packages:
resolution: {integrity: sha512-6VwtthbV4o/7+OaAF9I5L5V3llLEsoPyq9P1JVXkedTP33c7MfCG0/5NOPcSJn0TzXcG9YUrR0gQSWioew3LDg==}
- resolution: {integrity: sha512-Xf0nWe6RseziFMu+Ap9biiUbmplq6S9/p+7w7YXP/JBHhrUDDUhwa+vANyubuqfZWTveU//DYVGsDG7RKL/vEw==}
- engines: {node: '>=0.10.0'}
-
resolution: {integrity: sha512-seS2Tj26TBVOC2NIc2rOe2y2ZO7efxITtLZcGSOnHHNOQ7CkiUBfw0Iw2ck6xkIhPwLhKNLS8BO+hEpngQlqzw==}
@@ -5603,10 +5213,6 @@ packages:
engines: {node: '>=18.0.0', npm: '>=8.0.0'}
hasBin: true
- resolution: {integrity: sha512-nLTrUKm2UyiL7rlhapu/Zl45FwNgkZGaCpZbIHajDYgwlJCOzLSk+cIPAnsEqV955GjILJnKbdQC1nVPz+gAYQ==}
- engines: {node: '>= 18'}
-
resolution: {integrity: sha512-DPe5pVFaAsinSaV6QjQ6gdiedWDcRCbUuiQfQa2wmWV7+xC9bGulGI8+TdRmoFkAPaBXk8CrAbnlY2ISniJ47Q==}
engines: {node: '>=18'}
@@ -5614,9 +5220,6 @@ packages:
resolution: {integrity: sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==}
- resolution: {integrity: sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==}
-
resolution: {integrity: sha512-RQPdCYTa8A68uM2jwxoY842xDhvx3E5LFL1LxvxCNMev4o5mLuokczhzjAgGwUZBAmOKZknArSxLKmXtIi2AxQ==}
@@ -5628,21 +5231,10 @@ packages:
engines: {node: '>=10'}
hasBin: true
- resolution: {integrity: sha512-1gnZf7DFcoIcajTjTwjwuDjzuz4PPcY2StKPlsGAQ1+YH20IRVrBaXSWmdjowTJ6u8Rc01PoYOGHXfP1mYcZNQ==}
- engines: {node: '>= 18'}
-
resolution: {integrity: sha512-8I8TjW5KMOKsZQTvoxjuSIa7foAwPWGOts+6o7sgjz41/qMD9VQHEDxi6PBvK2l0MXUmqZyNpUK+T2tQaaElvw==}
engines: {node: '>=10'}
- resolution: {integrity: sha512-xRXBn0pPqQTVQiC8wyQrKs2MOlX24zQ0POGaj0kultvoOCstBQM5yvOhAVSUwOMjQtTvsPWoNCHfPGwaaQJhTw==}
- engines: {node: '>= 18'}
-
- resolution: {integrity: sha512-E5LDX7Wrp85Kil5bhZv46j8jOeboKq5JMmYM3gVGdGH8xFpPWXUMsNrlODCrkoxMEeNi/XZIwuRvY4XNwYMJpw==}
-
resolution: {integrity: sha512-ej0zVHuZGHCiABXcNxeYhpRnPNPAcvbG8RMdBAhDAxLKkCRVSpK3Iyu7qbqw3JMzoj0REeM6f3tJLtVwl0023Q==}
engines: {node: '>=20.9.0'}
@@ -5652,33 +5244,9 @@ packages:
'@types/node':
optional: true
- resolution: {integrity: sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==}
- engines: {node: '>=8'}
-
- resolution: {integrity: sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==}
- engines: {node: '>=8'}
-
resolution: {integrity: sha512-mI//trrsaiCIPsja5CNfsyNOqgAZUb6VpJA+340toL42UpzQlXpwRV9nch69X6gaUxrr9kaOOa6e3y3uAkGFxQ==}
- resolution: {integrity: sha512-mjn/0bi/oUURjc5Xl7IaWi/OJJJumuoJFQJfDDyO46+hBWsfaVM65TBHq2eoZBhzl9EchxOijpkbRC8SVBQU0w==}
- engines: {node: '>= 0.4'}
-
- resolution: {integrity: sha512-VCjCNfgMsby3tTdo02nbjtM/ewra6jPHmpThenkTYh8pG9ucZ/1P8So4u4FGBek/BjpOVsDCMoLA/iuBKIFXRA==}
- engines: {node: '>= 0.4'}
-
- resolution: {integrity: sha512-WPS/HvHQTYnHisLo9McqBHOJk2FkHO/tlpvldyrnem4aeQp4hai3gythswg6p01oSoTl58rcpiFAjF2br2Ak2A==}
- engines: {node: '>= 0.4'}
-
- resolution: {integrity: sha512-6x6dK6zJdpTzF4sQeNYxwtvBzf6Eg4GtlesS94HOvTudUeyK2WXAaIfmDgsyslYrRBeFIlsi54AYsFGUuhmvrQ==}
- engines: {node: '>= 0.4'}
-
resolution: {integrity: sha512-UXWMKhLOwVKb728IUtQPXxfYU+usdybtUrK/8uGE8CQMvrhOpwvzDBwj0QhSL7MQc7vIsISBG8VQ8+IDQxpfQA==}
engines: {node: '>=0.10.0'}
@@ -5697,10 +5265,6 @@ packages:
resolution: {integrity: sha512-Oo+0REFV59/rz3gfJNKQiBlwfHaSESl1pcGyABQsnnIfWOFt6JNj5gCog2U6MLZ//IGYD+nA8nI+mTShREReaA==}
- resolution: {integrity: sha512-DvEy55V3DB7uknRo+4iOGT5fP1slR8wQohVdknigZPMpMstaKJQWhwiYBACJE3Ul2pTnATihhBYnRhZQHGBiRw==}
- engines: {node: '>= 0.8'}
-
resolution: {integrity: sha512-1Yowhzjf0ivGMrTIkY9hav5TxobO9qIVqUE41fiCGMGgc3CLlf4MY+9AHmZqBWgDTue0fY9zWjYFVyf6Diuobw==}
@@ -5751,10 +5315,6 @@ packages:
resolution: {integrity: sha512-+FbBPE1o9QAYvviau/qC5SE3caw21q3xkvWKBtja5vgqOWIHHJ3ioaq1VPfn/Szqctz2bU/oYeKd9/z5BL+PVg==}
- resolution: {integrity: sha512-o5sSPKEkg/DIQNmH43V0/uerLrpzVedkUh8tGNvaeXpfpuwjKenlSox/2O/BTlZUtEe+JG7s5YhEz608PlAHRA==}
- engines: {node: '>=0.6'}
-
resolution: {integrity: sha512-kRj8B+YHZCc9kQYdWfJB2/oUl9rA99qbowYYBtr4ui4mZyAQ2JpvVBd/6U2YloATfqBhBTSMhTpgBHtU0Mf3Rg==}
@@ -5770,10 +5330,6 @@ packages:
resolution: {integrity: sha512-34R7HTnG0XIJcBSn5XhDd7nNFPRcXYRZrBB2O2jdKqYODldSzBAqzsWoZYYvduky73toYS/ESqxPvkDf/F0XMg==}
engines: {node: '>=10'}
- resolution: {integrity: sha512-faYHw0anBbc/kWF3zFTEnxSFOAGUX9GFbOBthvDdLsIlEoWOFOtS0zgCiQYwIskL9iGXZL3kAXD8OoZ4GmMATA==}
- engines: {node: '>= 18'}
-
resolution: {integrity: sha512-EOPFbyIub4ngnEdqi2yOcNeDLaX/0jcE1JoAXQDDMIthap7FoN795lc/SHfIq2d416VufXpM8z/lD+WRm2gfOQ==}
@@ -5812,17 +5368,9 @@ packages:
resolution: {integrity: sha512-m+vIdyeCOpdr/QeQCu2EzxX/ohgS8KbnPDgFni4dQsfSCtpz8UqDyY5GjRru8PDKuYn7Fq19j1CQ+nJSsGKOzg==}
- resolution: {integrity: sha512-pjy2bYhSsufwWlKwPc+l3cN7+wuJlK6uz0YdJEOlQDbl6jo/YlPi4mb8agUkVC8BF7V8NuzeyPNqRksA3hztKQ==}
- engines: {node: '>= 0.8'}
-
resolution: {integrity: sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==}
- resolution: {integrity: sha512-BNGbWLfd0eUPabhkXUVm0j8uuvREyTh5ovRa/dyow/BqAbZJyC+5fU+IzQOzmAKzYqYRAISoRhdQr3eIZ/PXqg==}
- engines: {node: '>= 0.8'}
-
resolution: {integrity: sha512-QTHzsGd1EhbZs4AsQ20JX1rC3cOlt/IWJruk893DfLRr57lcnOeMaWG4K0JrRta4mIJZKth2Au3mM3u03/JWKw==}
@@ -5891,11 +5439,6 @@ packages:
resolution: {integrity: sha512-VSV+fzfChirL3e7jay2yUC7B4HQCGtEWEg/MSSQbK+qWbqeGlRLlXTzPpYr3XGUvbpDHumWZBJxgesg4N7dbtA==}
- resolution: {integrity: sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==}
- engines: {node: '>= 8'}
- hasBin: true
-
resolution: {integrity: sha512-42AtmgqjV+X1VpdOfyTGOYRi0/zsoLqtXQckTmqTeybT+BDIbM/Guxo7x3pE2vtpr1ok6xRqM9OpBe+Jyoqyww==}
engines: {node: '>=18'}
@@ -5935,11 +5478,6 @@ packages:
resolution: {integrity: sha512-2rAgRKu54VsHkqI0/tYkmluGXHD4KW7yZoycuqDQ15QOTnc2VVfy0nN/1eMhnQLO00A+dwtK20xuCnc1YGeUyg==}
engines: {node: ^20.19.0 || ^22.12.0 || >=23}
- resolution: {integrity: sha512-O/PgfnpT1xKSDeQYSCfRI5Gy3hPf91mKVDuYLUHZJMiDFptvP41MSnWofm8dnCm0256ZNfZIM7DSzuSMAFnjHA==}
- peerDependencies:
- zod: ^3.25.28 || ^4
-
resolution: {integrity: sha512-gzUt/qt81nXsFGKIFcC3YnfEAx5NkunCfnDlvuBSSFS02bcXu4Lmea0AFIUwbLWxWPx3d9p8S5QoaujKcNQxcQ==}
@@ -6756,14 +6294,12 @@ snapshots:
'@fontsource/[email protected]': {}
- '@google/[email protected](@modelcontextprotocol/[email protected]([email protected]))':
+ '@google/[email protected]':
dependencies:
google-auth-library: 10.9.1
p-retry: 4.6.2
protobufjs: 7.6.5
ws: 8.21.1
- optionalDependencies:
- '@modelcontextprotocol/sdk': 1.30.0([email protected])
transitivePeerDependencies:
- bufferutil
- supports-color
@@ -7008,29 +6544,6 @@ snapshots:
'@jridgewell/[email protected]': {}
- '@modelcontextprotocol/[email protected]([email protected])':
- dependencies:
- '@hono/node-server': 2.0.12([email protected])
- ajv: 8.20.0
- ajv-formats: 3.0.1([email protected])
- content-type: 1.0.5
- cors: 2.8.6
- cross-spawn: 7.0.6
- eventsource: 3.0.7
- eventsource-parser: 3.1.1
- express: 5.2.1
- express-rate-limit: 8.6.2([email protected])
- hono: 4.12.32
- jose: 6.2.9
- json-schema-typed: 8.0.2
- pkce-challenge: 5.0.1
- raw-body: 3.0.2
- zod: 3.25.76
- zod-to-json-schema: 3.25.2([email protected])
- transitivePeerDependencies:
- - supports-color
- optional: true
-
'@napi-rs/[email protected]':
optional: true
@@ -7356,12 +6869,6 @@ snapshots:
transitivePeerDependencies:
- typescript
- dependencies:
- mime-types: 3.0.2
- negotiator: 1.0.0
- optional: true
-
dependencies:
acorn: 8.18.0
@@ -7378,19 +6885,6 @@ snapshots:
- optionalDependencies:
- ajv: 8.20.0
- optional: true
-
- dependencies:
- fast-deep-equal: 3.1.3
- fast-uri: 3.1.5
- json-schema-traverse: 1.0.0
- require-from-string: 2.0.2
- optional: true
-
dependencies:
'@algolia/abtesting': 1.22.0
@@ -7455,21 +6949,6 @@ snapshots:
- dependencies:
- bytes: 3.1.2
- content-type: 2.1.0
- debug: 4.4.3
- http-errors: 2.0.1
- iconv-lite: 0.7.3
- on-finished: 2.4.1
- qs: 6.15.3
- raw-body: 3.0.2
- type-is: 2.1.0
- transitivePeerDependencies:
- - supports-color
- optional: true
-
@@ -7490,21 +6969,6 @@ snapshots:
dependencies:
run-applescript: 7.1.0
- optional: true
-
- dependencies:
- es-errors: 1.3.0
- function-bind: 1.1.2
- optional: true
-
- dependencies:
- call-bind-apply-helpers: 1.0.2
- get-intrinsic: 1.3.0
- optional: true
-
@@ -7544,38 +7008,10 @@ snapshots:
readable-stream: 3.6.2
typedarray: 0.0.6
- optional: true
-
- optional: true
-
- optional: true
-
- optional: true
-
- optional: true
-
dependencies:
is-what: 5.5.0
- dependencies:
- object-assign: 4.1.1
- vary: 1.1.2
- optional: true
-
- dependencies:
- path-key: 3.1.1
- shebang-command: 2.0.0
- which: 2.0.2
- optional: true
-
dependencies:
boolbase: 2.0.0
@@ -7619,9 +7055,6 @@ snapshots:
has-property-descriptors: 1.0.2
object-keys: 1.1.1
- optional: true
-
@@ -7672,27 +7105,14 @@ snapshots:
domelementtype: 3.0.0
domhandler: 6.0.1
- dependencies:
- call-bind-apply-helpers: 1.0.2
- es-errors: 1.3.0
- gopd: 1.2.0
- optional: true
-
dependencies:
safe-buffer: 5.2.1
- optional: true
-
- optional: true
-
dependencies:
once: 1.4.0
@@ -7709,11 +7129,6 @@ snapshots:
- dependencies:
- es-errors: 1.3.0
- optional: true
-
@@ -7802,84 +7217,24 @@ snapshots:
- optional: true
-
- optional: true
-
dependencies:
bare-events: 2.9.1
transitivePeerDependencies:
- bare-abort-controller
- optional: true
-
- dependencies:
- eventsource-parser: 3.1.1
- optional: true
-
- dependencies:
- debug: 4.4.3
- express: 5.2.1
- ip-address: 10.5.0
- transitivePeerDependencies:
- - supports-color
- optional: true
-
- dependencies:
- accepts: 2.0.0
- body-parser: 2.3.0
- content-disposition: 1.1.0
- content-type: 1.0.5
- cookie: 0.7.2
- cookie-signature: 1.2.2
- debug: 4.4.3
- depd: 2.0.0
- encodeurl: 2.0.0
- escape-html: 1.0.3
- etag: 1.8.1
- finalhandler: 2.1.1
- fresh: 2.0.0
- http-errors: 2.0.1
- merge-descriptors: 2.0.0
- mime-types: 3.0.2
- on-finished: 2.4.1
- once: 1.4.0
- parseurl: 1.3.3
- proxy-addr: 2.0.7
- qs: 6.15.3
- range-parser: 1.3.0
- router: 2.2.0
- send: 1.2.1
- serve-static: 2.2.1
- statuses: 2.0.2
- type-is: 2.1.0
- vary: 1.1.2
- transitivePeerDependencies:
- - supports-color
- optional: true
-
- optional: true
-
dependencies:
node-domexception: 1.0.0
@@ -7896,18 +7251,6 @@ snapshots:
- dependencies:
- debug: 4.4.3
- encodeurl: 2.0.0
- escape-html: 1.0.3
- on-finished: 2.4.1
- parseurl: 1.3.3
- statuses: 2.0.2
- transitivePeerDependencies:
- - supports-color
- optional: true
-
dependencies:
tabbable: 6.5.0
@@ -7928,18 +7271,9 @@ snapshots:
dependencies:
fetch-blob: 3.2.0
- optional: true
-
- optional: true
-
optional: true
- optional: true
-
dependencies:
extend: 3.0.2
@@ -7960,26 +7294,6 @@ snapshots:
- dependencies:
- call-bind-apply-helpers: 1.0.2
- es-define-property: 1.0.1
- es-errors: 1.3.0
- es-object-atoms: 1.1.2
- function-bind: 1.1.2
- get-proto: 1.0.1
- gopd: 1.2.0
- has-symbols: 1.1.0
- hasown: 2.0.4
- math-intrinsics: 1.1.0
- optional: true
-
- dependencies:
- dunder-proto: 1.0.1
- es-object-atoms: 1.1.2
- optional: true
-
dependencies:
resolve-pkg-maps: 1.0.0
@@ -8019,14 +7333,6 @@ snapshots:
dependencies:
es-define-property: 1.0.1
- optional: true
-
- dependencies:
- function-bind: 1.1.2
- optional: true
-
dependencies:
'@types/hast': 3.0.5
@@ -8060,15 +7366,6 @@ snapshots:
domutils: 3.2.2
entities: 7.0.1
- dependencies:
- depd: 2.0.0
- inherits: 2.0.4
- setprototypeof: 1.2.0
- statuses: 2.0.2
- toidentifier: 1.0.1
- optional: true
-
dependencies:
'@types/node': 10.17.60
@@ -8087,7 +7384,7 @@ snapshots:
transitivePeerDependencies:
- supports-color
dependencies:
'@hono/node-server': 2.0.12([email protected])
'@puppeteer/browsers': 3.1.0
@@ -8107,7 +7404,7 @@ snapshots:
puppeteer-core: 25.5.0
sharp: 0.35.3(@types/[email protected])
optionalDependencies:
- '@google/genai': 1.52.0(@modelcontextprotocol/[email protected]([email protected]))
+ '@google/genai': 1.52.0
transitivePeerDependencies:
- '@modelcontextprotocol/sdk'
- '@types/node'
@@ -8117,52 +7414,26 @@ snapshots:
- utf-8-validate
- yauzl
- dependencies:
- safer-buffer: 2.1.2
- optional: true
-
- optional: true
-
- optional: true
-
dependencies:
is-docker: 3.0.0
- optional: true
-
dependencies:
is-inside-container: 1.0.0
- optional: true
-
- optional: true
-
dependencies:
bignumber.js: 9.3.1
- optional: true
-
- optional: true
-
@@ -8198,9 +7469,6 @@ snapshots:
dependencies:
escape-string-regexp: 4.0.0
- optional: true
-
dependencies:
'@types/hast': 3.0.5
@@ -8213,12 +7481,6 @@ snapshots:
unist-util-visit: 5.1.0
vfile: 6.0.3
- optional: true
-
- optional: true
-
dependencies:
micromark-util-symbol: 2.0.1
@@ -8236,14 +7498,6 @@ snapshots:
- optional: true
-
- dependencies:
- mime-db: 1.54.0
- optional: true
-
@@ -8260,9 +7514,6 @@ snapshots:
- optional: true
-
@@ -8275,19 +7526,8 @@ snapshots:
dependencies:
boolbase: 2.0.0
- optional: true
-
- optional: true
-
- dependencies:
- ee-first: 1.1.1
- optional: true
-
dependencies:
wrappy: 1.0.2
@@ -8322,22 +7562,10 @@ snapshots:
- optional: true
-
- optional: true
-
- optional: true
-
- optional: true
-
dependencies:
cssesc: 3.0.0
@@ -8371,12 +7599,6 @@ snapshots:
'@types/node': 24.10.1
long: 5.3.2
- dependencies:
- forwarded: 0.2.0
- ipaddr.js: 1.9.1
- optional: true
-
dependencies:
end-of-stream: 1.4.5
@@ -8410,23 +7632,6 @@ snapshots:
- utf-8-validate
- yauzl
- dependencies:
- es-define-property: 1.0.1
- side-channel: 1.1.1
- optional: true
-
- optional: true
-
- dependencies:
- bytes: 3.1.2
- http-errors: 2.0.1
- iconv-lite: 0.7.3
- unpipe: 1.0.0
- optional: true
-
dependencies:
inherits: 2.0.4
@@ -8451,9 +7656,6 @@ snapshots:
dependencies:
regex-utilities: 2.3.0
- optional: true
-
@@ -8503,64 +7705,20 @@ snapshots:
'@rollup/rollup-win32-x64-msvc': 4.62.4
fsevents: 2.3.3
- dependencies:
- debug: 4.4.3
- depd: 2.0.0
- is-promise: 4.0.0
- parseurl: 1.3.3
- path-to-regexp: 8.4.2
- transitivePeerDependencies:
- - supports-color
- optional: true
-
- optional: true
-
- dependencies:
- debug: 4.4.3
- encodeurl: 2.0.0
- escape-html: 1.0.3
- etag: 1.8.1
- fresh: 2.0.0
- http-errors: 2.0.1
- mime-types: 3.0.2
- ms: 2.1.3
- on-finished: 2.4.1
- range-parser: 1.3.0
- statuses: 2.0.2
- transitivePeerDependencies:
- - supports-color
- optional: true
-
dependencies:
type-fest: 0.13.1
- dependencies:
- encodeurl: 2.0.0
- escape-html: 1.0.3
- parseurl: 1.3.3
- send: 1.2.1
- transitivePeerDependencies:
- - supports-color
- optional: true
-
- optional: true
-
dependencies:
'@img/colour': 1.1.0
@@ -8594,14 +7752,6 @@ snapshots:
'@img/sharp-win32-x64': 0.35.3
'@types/node': 24.10.1
- dependencies:
- shebang-regex: 3.0.0
- optional: true
-
- optional: true
-
dependencies:
'@shikijs/core': 2.5.0
@@ -8613,38 +7763,6 @@ snapshots:
'@shikijs/vscode-textmate': 10.0.2
'@types/hast': 3.0.5
- dependencies:
- es-errors: 1.3.0
- object-inspect: 1.13.4
- optional: true
-
- dependencies:
- call-bound: 1.0.4
- es-errors: 1.3.0
- get-intrinsic: 1.3.0
- object-inspect: 1.13.4
- optional: true
-
- dependencies:
- call-bound: 1.0.4
- es-errors: 1.3.0
- get-intrinsic: 1.3.0
- object-inspect: 1.13.4
- side-channel-map: 1.0.1
- optional: true
-
- dependencies:
- es-errors: 1.3.0
- object-inspect: 1.13.4
- side-channel-list: 1.0.1
- side-channel-map: 1.0.1
- side-channel-weakmap: 1.0.2
- optional: true
-
@@ -8655,9 +7773,6 @@ snapshots:
- optional: true
-
dependencies:
events-universal: 1.0.1
@@ -8745,9 +7860,6 @@ snapshots:
- optional: true
-
@@ -8761,13 +7873,6 @@ snapshots:
- dependencies:
- content-type: 2.1.0
- media-typer: 1.1.1
- mime-types: 3.0.2
- optional: true
-
@@ -8811,14 +7916,8 @@ snapshots:
unist-util-is: 6.0.1
unist-util-visit-parents: 6.0.2
- optional: true
-
- optional: true
-
dependencies:
'@types/unist': 3.0.3
@@ -8906,11 +8005,6 @@ snapshots:
- dependencies:
- isexe: 2.0.0
- optional: true
-
dependencies:
ansi-styles: 6.2.3
@@ -8940,11 +8034,6 @@ snapshots:
y18n: 5.0.8
yargs-parser: 22.0.0
- dependencies:
- zod: 3.25.76
- optional: true
-