Clone any viral video with AI agents. Not just a script, the whole workflow: swap the face, the words, the B-roll, ship 100 variants in one command, and get your 100M views.
TypeScript agentic-aiaiai-agentsai-videocompilerdslffmpeggenerative-aillmmarkup-languagemonorepoplugin-systemprogramming-languagetext-to-videotypescriptvideovideo-automationvideo-clonevideo-editingvideo-generation
refactor: split Studio domain companions
kashorin0587a48741df
diff --git a/docs/guide/packages.md b/docs/guide/packages.mdindex 4fd6c29a..5a634e52 100644--- a/docs/guide/packages.md+++ b/docs/guide/packages.md@@ -157,7 +157,7 @@ queues, stores, credentials and process lifecycle; they never define author synt@hypit/cli generic command engine (requires explicit Distribution)@hypit/video-cli video command application (selects Markup compiler, no built-in author packages)@hypit/studio-adapter stable Studio companion ABI and presentation DTOs-@hypit/studio-video-adapters official video-domain Studio interpretation+@hypit/*-studio independent official Studio companions selected explicitly by the Distribution@hypit/studio development preview for a Run, never runs a Provider```diff --git a/docs/zh/guide/packages.md b/docs/zh/guide/packages.mdindex 20bcc6ae..e7422d4f 100644--- a/docs/zh/guide/packages.md+++ b/docs/zh/guide/packages.md@@ -149,7 +149,7 @@ Frontend;不存在一个认识全部语法的中央解析器。@hypit/cli generic command engine (requires explicit Distribution)@hypit/video-cli video command application (selects Markup compiler, no built-in author packages)@hypit/studio-adapter stable Studio companion ABI and presentation DTOs-@hypit/studio-video-adapters official video-domain Studio interpretation+@hypit/*-studio 由 Distribution 显式选择的独立官方 Studio Companion@hypit/studio development preview for a Run, never runs a Provider```diff --git a/package.json b/package.jsonindex 8b578c00..53ed5f85 100644--- a/package.json+++ b/package.json@@ -61,14 +61,18 @@"@hypit/artifact-store-fs": "workspace:*","@hypit/artifact-store-s3": "workspace:*","@hypit/audio-track": "workspace:*",+ "@hypit/audio-track-studio": "workspace:*","@hypit/background-removal": "workspace:*","@hypit/caption": "workspace:*","@hypit/caption-fine": "workspace:*",+ "@hypit/caption-fine-studio": "workspace:*","@hypit/comment-sticker": "workspace:*",+ "@hypit/comment-sticker-studio": "workspace:*","@hypit/composition": "workspace:*","@hypit/credential-store-env": "workspace:*","@hypit/credential-store-os": "workspace:*","@hypit/deck-track": "workspace:*",+ "@hypit/deck-track-studio": "workspace:*","@hypit/estimate": "workspace:*","@hypit/film": "workspace:*","@hypit/fonts-open": "workspace:*",@@ -81,6 +85,7 @@"@hypit/media": "workspace:*","@hypit/media-pipeline": "workspace:*","@hypit/media-track": "workspace:*",+ "@hypit/media-track-studio": "workspace:*","@hypit/mimo-tts": "workspace:*","@hypit/minimax-h3": "workspace:*","@hypit/nano-banana": "workspace:*",@@ -96,6 +101,7 @@"@hypit/provider-whisperx-local": "workspace:*","@hypit/provider-xiaomi-mimo": "workspace:*","@hypit/ranking": "workspace:*",+ "@hypit/ranking-studio": "workspace:*","@hypit/raster": "workspace:*","@hypit/render-hyperframes": "workspace:*","@hypit/run-markup": "workspace:*",@@ -103,6 +109,7 @@"@hypit/runtime-kit": "workspace:*","@hypit/runtime-local": "workspace:*","@hypit/screen-overlay": "workspace:*",+ "@hypit/screen-overlay-studio": "workspace:*","@hypit/script": "workspace:*","@hypit/seedance": "workspace:*","@hypit/seedance-kits": "workspace:*",@@ -113,13 +120,14 @@"@hypit/speech-alignment": "workspace:*","@hypit/speech-evidence": "workspace:*","@hypit/speech-track": "workspace:*",+ "@hypit/speech-track-studio": "workspace:*","@hypit/store-sqlite": "workspace:*","@hypit/studio-adapter": "workspace:*",- "@hypit/studio-video-adapters": "workspace:*","@hypit/svs": "workspace:*","@hypit/temporal": "workspace:*","@hypit/text": "workspace:*","@hypit/typography-track": "workspace:*",+ "@hypit/typography-track-studio": "workspace:*","@hypit/visual-ir": "workspace:*","@hypit/whisperx": "workspace:*","@types/node": "24.10.1",diff --git a/packages/audio-track-studio/README.md b/packages/audio-track-studio/README.mdnew file mode 100644index 00000000..fbaef546--- /dev/null+++ b/packages/audio-track-studio/README.md@@ -0,0 +1,3 @@+# `@hypit/audio-track-studio`++Hypit Studio Companion for `@hypit/audio-track`. The domain package does not depend on this package.diff --git a/packages/audio-track-studio/package.json b/packages/audio-track-studio/package.jsonnew file mode 100644index 00000000..3842cde6--- /dev/null+++ b/packages/audio-track-studio/package.json@@ -0,0 +1,13 @@+{+ "name": "@hypit/audio-track-studio",+ "version": "0.0.0-dev",+ "license": "SEE LICENSE IN LICENSE",+ "private": true,+ "type": "module",+ "exports": { ".": "./src/index.ts" },+ "hypit": { "activation": "./src/activation.ts" },+ "dependencies": {+ "@hypit/audio-track": "workspace:*",+ "@hypit/studio-adapter": "workspace:*"+ }+}diff --git a/packages/audio-track-studio/src/activation.ts b/packages/audio-track-studio/src/activation.tsnew file mode 100644index 00000000..6e8d10a7--- /dev/null+++ b/packages/audio-track-studio/src/activation.ts@@ -0,0 +1,7 @@+import { createStudioAdapterHostFacet } from "@hypit/studio-adapter";+import { audioTrackStudioAdapters } from "./index.js";++export default {+ format: "hypit.node-package@1" as const,+ hostFacets: [createStudioAdapterHostFacet(audioTrackStudioAdapters)],+};diff --git a/packages/audio-track-studio/src/index.ts b/packages/audio-track-studio/src/index.tsnew file mode 100644index 00000000..0bd430db--- /dev/null+++ b/packages/audio-track-studio/src/index.ts@@ -0,0 +1,55 @@+import type { AudioTrackProgram } from "@hypit/audio-track";+import type { StudioAdapter, StudioAdapterContext, StudioEntityDraft } from "@hypit/studio-adapter";+import { artifactPreview, childEntities, previewLayer, projectedWindowTimelineEdits, requiredSurfaceValue, temporalLineageFor } from "@hypit/studio-adapter";++function projectAudio(context: StudioAdapterContext): readonly StudioEntityDraft[] {+ const program = requiredSurfaceValue(context, "program") as AudioTrackProgram;+ const items = program.items.map((item) => ({+ id: item.id,+ subjectId: item.subjectId,+ startFrame: item.window.startFrame,+ endFrameExclusive: item.window.endFrameExclusive,+ stackOrder: Number.MIN_SAFE_INTEGER,+ preview: artifactPreview("audio", item.source.artifact.digest),+ }));+ return childEntities(context, items, "audio-clip", "standard").map((entity, index) => {+ const item = items[index]!;+ const temporal = temporalLineageFor(context, item.id, "window");+ return {+ ...entity,+ display: { ...entity.display, layers: [previewLayer(item.preview, "waveform")] },+ ...(temporal?.source.kind === "program" || temporal?.source.id === undefined+ ? {}+ : { markerId: temporal.source.id }),+ ...(temporal === undefined ? {} : { temporal }),+ };+ });+}++export const audioTrackStudioAdapters: readonly StudioAdapter[] = [+ {+ id: "track", role: "track",+ output: { type: "AudioTrack", surface: "track", modules: ["@hypit/audio-track"] },+ family: "audio", tone: "green", icon: "waveform",+ timelineEdits: projectedWindowTimelineEdits({ start: "start", end: "end", duration: "for" }),+ parameters: [+ { name: "source", label: "Source", writable: false },+ { name: "start", label: "Start", writable: true },+ { name: "end", label: "End", writable: true },+ { name: "for", label: "For", writable: true },+ { name: "trim-start", label: "Trim source start", writable: true },+ { name: "trim-end", label: "Trim source end", writable: true },+ {+ name: "playback", label: "Playback", control: "select", writable: true,+ options: ["once", "once-start", "once-end", "loop", "loop-start", "loop-end", "stretch"],+ },+ { name: "min-rate", label: "Minimum rate", control: "number", writable: true },+ { name: "max-rate", label: "Maximum rate", control: "number", writable: true },+ { name: "gain", label: "Gain", control: "number", writable: true },+ { name: "fade-in", label: "Fade in", writable: true },+ { name: "fade-out", label: "Fade out", writable: true },+ ],+ requiredValues: ["program"], project: projectAudio,+ lane: { heightPx: 48 },+ },+];diff --git a/packages/audio-track/src/program.ts b/packages/audio-track/src/program.tsindex 0df7586c..8530d243 100644--- a/packages/audio-track/src/program.ts+++ b/packages/audio-track/src/program.ts@@ -115,6 +115,7 @@ function realizedItems(const fadeOutSamples = temporalDurationInSamples(spec.mix.fadeOut, space);const addition = {id: window.id,+ subjectId: spec.id,window: { ...window.span },source: structuredClone(source),trim: { startSample: trimStart, endSampleExclusive: trimEnd },@@ -165,6 +166,7 @@ export function assertAudioTrackProgram(value: AudioTrackProgram): void {const ids = new Set<string>();for (const item of value.items) {assertIdentity(item.id, "AudioItemProgram.id");+ assertIdentity(item.subjectId, "AudioItemProgram.subjectId");assert(!ids.has(item.id), `AudioTrackProgram contains duplicate Item ${item.id}.`);ids.add(item.id);assert(Number.isSafeInteger(item.window.startFrame) && item.window.startFrame >= 0@@ -219,6 +221,7 @@ function terminalClip(item: AudioItemProgram, space: ProgramSpace): AudioClip {`Audio Item ${item.id} fade exceeds its audible interval.`);return {id: item.id,+ subjectId: item.subjectId,artifact: structuredClone(item.source.artifact),target: { startSample: targetStart, endSampleExclusive: targetEnd },source: {diff --git a/packages/audio-track/src/types.ts b/packages/audio-track/src/types.tsindex 1caf1621..4650b858 100644--- a/packages/audio-track/src/types.ts+++ b/packages/audio-track/src/types.ts@@ -33,6 +33,8 @@ export type AudioTrackHeader = {export type AudioItemProgram = {readonly id: string;+ /** Author-owned Item realized by this externally projected window. */+ readonly subjectId: string;readonly window: FrameSpan;readonly source: {readonly artifact: BlobRef;diff --git a/packages/caption-fine-studio/README.md b/packages/caption-fine-studio/README.mdnew file mode 100644index 00000000..967250b5--- /dev/null+++ b/packages/caption-fine-studio/README.md@@ -0,0 +1,3 @@+# `@hypit/caption-fine-studio`++Hypit Studio Companion for `@hypit/caption-fine`. It projects the public Caption Schedule and owns the Inspector layout.diff --git a/packages/caption-fine-studio/package.json b/packages/caption-fine-studio/package.jsonnew file mode 100644index 00000000..067cccb8--- /dev/null+++ b/packages/caption-fine-studio/package.json@@ -0,0 +1,14 @@+{+ "name": "@hypit/caption-fine-studio",+ "version": "0.0.0-dev",+ "license": "SEE LICENSE IN LICENSE",+ "private": true,+ "type": "module",+ "exports": { ".": "./src/index.ts" },+ "hypit": { "activation": "./src/activation.ts" },+ "dependencies": {+ "@hypit/caption-fine": "workspace:*",+ "@hypit/narrative": "workspace:*",+ "@hypit/studio-adapter": "workspace:*"+ }+}diff --git a/packages/caption-fine-studio/src/activation.ts b/packages/caption-fine-studio/src/activation.tsnew file mode 100644index 00000000..a69980f4--- /dev/null+++ b/packages/caption-fine-studio/src/activation.ts@@ -0,0 +1,7 @@+import { createStudioAdapterHostFacet } from "@hypit/studio-adapter";+import { captionFineStudioAdapters } from "./index.js";++export default {+ format: "hypit.node-package@1" as const,+ hostFacets: [createStudioAdapterHostFacet(captionFineStudioAdapters)],+};diff --git a/packages/caption-fine-studio/src/index.ts b/packages/caption-fine-studio/src/index.tsnew file mode 100644index 00000000..7815c657--- /dev/null+++ b/packages/caption-fine-studio/src/index.ts@@ -0,0 +1,129 @@+import { captionFineMarkupSurfaces } from "@hypit/caption-fine";+import type { FineCaptionSchedule } from "@hypit/caption-fine";+import type { CaptionDocument } from "@hypit/narrative";+import type {+ StudioAdapter,+ StudioAdapterContext,+ StudioEntityDraft,+ StudioRecipeParameterDeclaration,+} from "@hypit/studio-adapter";+import { requiredSurfaceValue, temporalLineageFor, textLayer } from "@hypit/studio-adapter";++const WHERE_PROPERTIES = new Set([+ "stack-order", "x", "y", "width", "height", "anchor-x", "anchor-y", "align", "block-align",+ "inline-size", "wrap", "overflow", "max-lines", "max-words-per-line", "direction", "line-height",+ "letter-spacing", "word-gap",+]);++const TIMED_ACTIVE_BOX_PROPERTIES = new Set([+ "active-box", "active-box-continuity", "active-box-enter", "active-box-exit", "active-box-transition-frames",+]);++function groupFor(name: string): "where" | "how" | "when" {+ if (WHERE_PROPERTIES.has(name)) return "where";+ if (name === "lead-frames" || name === "tail-frames" || name === "handoff"+ || name === "karaoke" || name === "karaoke-transition" || name === "active-underline"+ || name.startsWith("cue-enter") || name.startsWith("cue-exit") || name.startsWith("atom-")+ || name.startsWith("active-response") || name.startsWith("loop")+ || name === "slide-distance" || name === "active-scale" || TIMED_ACTIVE_BOX_PROPERTIES.has(name)) return "when";+ return "how";+}++function sectionFor(name: string, group: "where" | "how" | "when"): string {+ if (group === "where") return ["x", "y", "width", "height", "anchor-x", "anchor-y", "stack-order"].includes(name)+ ? "region" : "flow";+ if (group === "when") {+ if (["lead-frames", "tail-frames", "handoff"].includes(name)) return "envelope";+ if (name.startsWith("cue-")) return "cue";+ if (name.startsWith("loop")) return "loop";+ return "token";+ }+ if (["size", "kerning", "caps", "text-transform"].includes(name)) return "typography";+ if (name === "background" || name === "border-color" || name === "border-width" || name === "padding"+ || name === "radius" || name.startsWith("cue-shadow")) return "cue-box";+ if (name.startsWith("active-box") || name.includes("underline")) return "decoration";+ return name.startsWith("active-") ? "active-paint" : "base-paint";+}++const styleSurface = captionFineMarkupSurfaces.find((surface) => surface.name === "style");+const recipeVocabulary = styleSurface?.vocabulary.attributes+ .find((attribute) => attribute.name === "recipe")?.recipe ?? [];++export const captionFineRecipeParameters: readonly StudioRecipeParameterDeclaration[] = recipeVocabulary.map((property) => {+ const group = groupFor(property.name);+ return { name: property.name, group, section: sectionFor(property.name, group) };+});++function captionDocument(context: StudioAdapterContext, id: string): CaptionDocument | undefined {+ for (const value of context.values.values()) {+ if (value === null || typeof value !== "object" || Array.isArray(value)) continue;+ const candidate = value as Partial<CaptionDocument>;+ if (candidate.id === id && Array.isArray(candidate.units) && Array.isArray(candidate.words)) {+ return candidate as CaptionDocument;+ }+ }+ return undefined;+}++function cueText(document: CaptionDocument | undefined, unitIds: readonly string[]): string {+ if (document === undefined) return "";+ const selected = new Set(unitIds);+ return document.words+ .filter((word) => selected.has(word.unitId))+ .map((word) => word.text)+ .join(" ")+ .replace(/([\p{Script=Han}\p{Script=Hiragana}\p{Script=Katakana}])\s+(?=[\p{Script=Han}\p{Script=Hiragana}\p{Script=Katakana}])/gu, "$1")+ .trim();+}++function projectCaption(context: StudioAdapterContext): readonly StudioEntityDraft[] {+ const schedule = requiredSurfaceValue(context, "schedule") as FineCaptionSchedule;+ const document = captionDocument(context, schedule.documentId);+ const rendered = new Map(context.generic().flatMap((entity) =>+ entity.presentId === undefined ? [] : [[entity.presentId, entity] as const]));+ return schedule.cues.map((cue): StudioEntityDraft => {+ const base = rendered.get(cue.id);+ const label = cueText(document, cue.units.map((unit) => unit.unitId));+ const temporal = temporalLineageFor(context, cue.id);+ const authoredId = context.placement?.id ?? cue.id;+ return {+ ...(base ?? {+ id: `${context.track.outputRef}:entity:${cue.id}`,+ authoredId: cue.id,+ display: { title: "Caption", layers: [] },+ startFrame: cue.visibleStartFrame,+ endFrameExclusive: cue.visibleEndFrameExclusive,+ stackOrder: 0,+ presentId: cue.id,+ renderIds: [cue.id],+ }),+ authoredId,+ ...(context.placement === undefined ? {} : { elementRange: context.placement.range }),+ display: {+ title: "Caption",+ layers: label.length === 0 ? [] : [textLayer(label)],+ },+ startFrame: cue.visibleStartFrame,+ endFrameExclusive: cue.visibleEndFrameExclusive,+ presentation: { entity: "caption-cue", chrome: "standard" },+ parameterReferences: { program: cue.styleId },+ ...(temporal === undefined ? {} : { temporal }),+ };+ });+}++export const captionFineStudioAdapters: readonly StudioAdapter[] = [+ {+ id: "track", role: "track",+ output: { type: "VisualTrack", surface: "track", modules: ["@hypit/caption-fine"] },+ family: "caption", tone: "magenta", icon: "captions",+ parameters: [+ {+ name: "program", label: "Program", writable: false,+ recipe: { through: ["recipe"], parameters: captionFineRecipeParameters },+ },+ ],+ requiredValues: ["schedule"], project: projectCaption,+ lane: { heightPx: 48 },+ },+];diff --git a/packages/caption-fine-studio/test/adapter.test.ts b/packages/caption-fine-studio/test/adapter.test.tsnew file mode 100644index 00000000..688a59f3--- /dev/null+++ b/packages/caption-fine-studio/test/adapter.test.ts@@ -0,0 +1,71 @@+import assert from "node:assert/strict";+import test from "node:test";++import type { FineCaptionSchedule } from "@hypit/caption-fine";+import type { CaptionDocument } from "@hypit/narrative";+import type { StudioAdapterContext, StudioEntityDraft } from "@hypit/studio-adapter";++import { captionFineRecipeParameters, captionFineStudioAdapters } from "../src/index.js";++test("Caption Companion owns Inspector grouping", () => {+ const declared = (name: string) => captionFineRecipeParameters.find((property) => property.name === name);+ assert.equal(declared("x")?.group, "where");+ assert.equal(declared("x")?.section, "region");+ assert.equal(declared("cue-shadow-blur")?.group, "how");+ assert.equal(declared("active-box-enter")?.group, "when");+ assert.equal(declared("lead-frames")?.section, "envelope");+});++test("Caption Companion projects Cue text and Style from public domain values", () => {+ const schedule: FineCaptionSchedule = {+ documentId: "story.caption",+ cues: [{+ id: "cue-1",+ styleId: "caption-alt",+ semanticStartFrame: 10,+ semanticEndFrameExclusive: 20,+ visibleStartFrame: 8,+ visibleEndFrameExclusive: 24,+ units: [{ unitId: "unit-1", startFrame: 10, endFrameExclusive: 20 }],+ }],+ };+ const document: CaptionDocument = {+ id: "story.caption",+ units: [{ id: "unit-1", segmentId: "segment-1", turnId: "turn-1", wordIds: ["word-1", "word-2"], sourceTokenIds: ["token-1"] }],+ words: [+ { id: "word-1", unitId: "unit-1", segmentId: "segment-1", turnId: "turn-1", text: "真实", attributes: [] },+ { id: "word-2", unitId: "unit-1", segmentId: "segment-1", turnId: "turn-1", text: "字幕", attributes: [] },+ ],+ cueBreaks: [],+ };+ const base: StudioEntityDraft = {+ id: "captions.track:cue-1", authoredId: "captions", display: { title: "cue-1", layers: [] },+ startFrame: 8, endFrameExclusive: 24, stackOrder: 70, presentId: "cue-1",+ elementRange: { start: 0, end: 80 },+ };+ const context = {+ track: {+ name: "captions.track", type: "VisualTrack", outputRef: "captions.track",+ candidateOrigin: "source", role: "track",+ trace: {+ surface: "track", module: "@hypit/caption-fine", authoredId: "captions",+ outputPorts: [{ name: "schedule", ref: "captions.schedule", type: "FineCaptionSchedule" }],+ references: [],+ },+ value: { visualIr: "hypit.visual-ir@1", id: "captions", presents: [] },+ },+ spans: [{ id: "cue-1", startFrame: 8, endFrameExclusive: 24, stackOrder: 70 }],+ values: new Map<string, unknown>([["captions.schedule", schedule], ["story.caption", document]]),+ temporalBindings: [],+ semantic: { presentation: { family: "speech", tone: "teal", icon: "timeline", lane: { heightPx: 45 } }, anchors: [], segments: [], tokens: [], selections: [], moments: [], provenance: { output: "speech", outputRef: "speech", origin: "source", status: "resolved", errors: [] } },+ generic: () => [base],+ } satisfies StudioAdapterContext;+ const adapter = captionFineStudioAdapters.find((candidate) => candidate.id === "track")!;+ const [cue] = adapter.project!(context);+ assert.deepEqual(cue?.display, {+ title: "Caption",+ layers: [{ kind: "text", role: "content", text: "真实字幕" }],+ });+ assert.deepEqual(cue?.parameterReferences, { program: "caption-alt" });+ assert.deepEqual([cue?.startFrame, cue?.endFrameExclusive], [8, 24]);+});diff --git a/packages/caption-fine/src/fragment.ts b/packages/caption-fine/src/fragment.tsindex ca2815c7..6dc48cc9 100644--- a/packages/caption-fine/src/fragment.ts+++ b/packages/caption-fine/src/fragment.ts@@ -4,7 +4,7 @@ import { sealGraphFragment } from "@hypit/elaborator";import { narrativeTypes } from "@hypit/narrative";import { semanticTrackTypes } from "@hypit/semantic-track";-import { captionFineProducers } from "./manifest.js";+import { captionFineProducers, captionFineTypes } from "./manifest.js";const input = (name: string) => ({ kind: "fragment-input" as const, name });const operation = (id: string) => ({ kind: "fragment-operation" as const, operation: id });@@ -43,9 +43,16 @@ export const fineCaptionTrackFragment = sealGraphFragment({result: { kind: "output", name: "track" },},],- exports: [{- name: "track",- type: compositionTypes.visualTrack,- root: operation("caption-fine:render"),- }],+ exports: [+ {+ name: "schedule",+ type: captionFineTypes.schedule,+ root: operation("caption-fine:schedule"),+ },+ {+ name: "track",+ type: compositionTypes.visualTrack,+ root: operation("caption-fine:render"),+ },+ ],});diff --git a/packages/caption-fine/src/manifest.ts b/packages/caption-fine/src/manifest.tsindex ca750143..78e46725 100644--- a/packages/caption-fine/src/manifest.ts+++ b/packages/caption-fine/src/manifest.ts@@ -2,7 +2,6 @@ import { readFile } from "node:fs/promises";import { captionManifest, captionModuleRef, captionTypes } from "@hypit/caption";import { compositionDependency, compositionTypes } from "@hypit/composition";-import type { SurfaceRecipePropertyVocabulary } from "@hypit/markup";import { mediaDependency, mediaTypes } from "@hypit/media";import { narrativeDependency, narrativeTypes } from "@hypit/narrative";import type { ModuleManifest, ProducerRef } from "@hypit/protocol";@@ -17,57 +16,6 @@ const previewImage = (file: string) => ({open: async () => Uint8Array.from(await readFile(new URL(`../preview/${file}`, import.meta.url))),});-const WHERE_PROPERTIES = new Set([- "stack-order", "x", "y", "width", "height", "anchor-x", "anchor-y", "align", "block-align",- "inline-size", "wrap", "overflow", "max-lines", "max-words-per-line", "direction", "line-height",- "letter-spacing", "word-gap",-]);--const TIMED_ACTIVE_BOX_PROPERTIES = new Set([- "active-box",- "active-box-continuity",- "active-box-enter",- "active-box-exit",- "active-box-transition-frames",-]);--function fineCaptionRecipeGroup(name: string): "where" | "how" | "when" {- if (WHERE_PROPERTIES.has(name)) return "where";- if (name === "lead-frames" || name === "tail-frames" || name === "handoff"- || name === "karaoke" || name === "karaoke-transition"- || name === "active-underline"- || name.startsWith("cue-enter") || name.startsWith("cue-exit")- || name.startsWith("atom-") || name.startsWith("active-response")- || name.startsWith("loop") || name === "slide-distance" || name === "active-scale"- || TIMED_ACTIVE_BOX_PROPERTIES.has(name)) return "when";- return "how";-}--function fineCaptionRecipeSection(name: string, group: "where" | "how" | "when"): string {- if (group === "where") return ["x", "y", "width", "height", "anchor-x", "anchor-y", "stack-order"].includes(name)- ? "region" : "flow";- if (group === "when") {- if (["lead-frames", "tail-frames", "handoff"].includes(name)) return "envelope";- if (name.startsWith("cue-")) return "cue";- if (name.startsWith("loop")) return "loop";- return "token";- }- if (["size", "kerning", "caps", "text-transform"].includes(name)) return "typography";- if (name === "background" || name === "border-color" || name === "border-width" || name === "padding"- || name === "radius" || name.startsWith("cue-shadow")) return "cue-box";- if (name.startsWith("active-box") || name.includes("underline")) return "decoration";- return name.startsWith("active-") ? "active-paint" : "base-paint";-}--function withFineCaptionRecipeGroups<const T extends readonly SurfaceRecipePropertyVocabulary[]>(- properties: T,-): readonly SurfaceRecipePropertyVocabulary[] {- return properties.map((property) => {- const group = fineCaptionRecipeGroup(property.name);- return { ...property, group, section: fineCaptionRecipeSection(property.name, group) };- });-}-export const captionFineModuleRef = { name: "@hypit/caption-fine", version: "1" } as const;export const captionFineTypes = {schedule: { module: captionFineModuleRef, name: "FineCaptionSchedule" },@@ -87,7 +35,7 @@ export const captionFineMarkupSurfaces = [summary: "Names this Style so a Caption Program can assign it." },{ name: "recipe", kind: "reference", required: true, accepts: [svsRecipeType],summary: "Chooses the Recipe that carries Cue geometry, Paint and local motion.",- recipe: withFineCaptionRecipeGroups([+ recipe: [{ name: "stack-order", required: true,summary: "Places this Style's Cues in the Track's drawing order, low behind high." },{ name: "x", required: true,@@ -319,7 +267,7 @@ export const captionFineMarkupSurfaces = [summary: "Keeps the Cue visible this many Frames after its last semantic Word without extending any Word timing." },{ name: "handoff", required: false, values: ["cut", "overlap"], fallback: "cut",summary: "Chooses whether adjacent Cue visibility envelopes meet without overlap or may coexist." },- ]) },+ ] },{ name: "font", kind: "reference", required: true,accepts: [mediaTypes.fontArtifact, mediaTypes.fontStack],summary: "Chooses the primary face, or a whole reusable stack that already carries its own fallbacks." },@@ -344,7 +292,7 @@ export const captionFineMarkupSurfaces = [},},{- name: "track", tag: "Track", mode: "structured", outputs: [compositionTypes.visualTrack],+ name: "track", tag: "Track", mode: "structured", outputs: [captionFineTypes.schedule, compositionTypes.visualTrack],vocabulary: {summary: "Joins the authored CaptionDocument against the SemanticTrack and renders it as one ordinary peer VisualTrack.",appearance: "One block of caption text wrapped into lines inside a rounded Cue box, placed at a Recipe-chosen point on the Canvas and spanning a fraction of its width. Cues follow the speech one after another, each arriving and leaving with its own motion, and the Words of a Cue either stand there together from its first Frame or uncover as they are spoken. As the speech advances, the Word being spoken, or every Word up to it, is repainted in the active Paint, snapping at the Word boundary or sweeping across the glyphs, and it may take a rule beneath it, a rounded highlight capsule behind it and a brief pop at the moment it becomes the spoken one. That capsule either stands alone on each Atom or grows as one continuous run over everything already read, following the Words across line breaks.\n\nEvery Word of every Cue is drawn in one typeface, the one its Style names: emphasis varies by Word through the active Paint, never by typeface, and lines exist only where the text wraps, so a line cannot be given a face, colour or weight of its own. A caption whose lines are set in different typefaces is outside what this Track can draw.",@@ -360,6 +308,8 @@ export const captionFineMarkupSurfaces = [summary: "Chooses the Style assignment that decides which Style each run is rendered in." },],ports: [+ { name: "schedule", type: captionFineTypes.schedule,+ summary: "The visible Cue schedule consumed by the renderer and other declared tools." },{ name: "track", type: compositionTypes.visualTrack,summary: "The rendered Caption as one self-contained VisualTrack." },],diff --git a/packages/caption-fine/src/render.ts b/packages/caption-fine/src/render.tsindex 61267645..366d6fc2 100644--- a/packages/caption-fine/src/render.ts+++ b/packages/caption-fine/src/render.ts@@ -639,7 +639,6 @@ function cueElements({ name: "text-align", value: parameters.layout.textAlign },{ name: "width", value: parameters.layout.inlineSize === "fixed" ? "100%" : "max-content" },],- attributes: [{ name: "data-caption-style", value: styleId }],});if (parameters.activeBox.mode === "trail" && parameters.activeBox.continuity === "joined") {@@ -814,7 +813,6 @@ function cueElements(style: glyphStyle(parameters, parameters.basePaint, parameters.underline),...glyphPaintFields(parameters.basePaint),fonts,- attributes: [{ name: "data-caption-word", value: wordId }],});}const addActivatedTextLayer = (diff --git a/packages/caption-fine/src/surface.ts b/packages/caption-fine/src/surface.tsindex b09f3c3d..55b91573 100644--- a/packages/caption-fine/src/surface.ts+++ b/packages/caption-fine/src/surface.ts@@ -129,7 +129,7 @@ export const decodeFineCaptionTrackSurface: StructuredSurfaceHandler = ({ elemeninputs: {document: document.ref, semantic: semantic.ref, program: program.ref,},- outputs: { track: `${id}.track` },+ outputs: { schedule: `${id}.schedule`, track: `${id}.track` },range: element.range,}],fragments: [fineCaptionTrackFragment],diff --git a/packages/caption-fine/test/caption-fine.test.ts b/packages/caption-fine/test/caption-fine.test.tsindex 276b3eec..fb0601f1 100644--- a/packages/caption-fine/test/caption-fine.test.ts+++ b/packages/caption-fine/test/caption-fine.test.ts@@ -9,7 +9,6 @@ import type { SvsRecipe } from "@hypit/svs";import { fixtureDigest } from "../../../test/fixture-digest.js";import {- captionFineMarkupSurfaces,fineCaptionParameters,fineCaptionStyle,renderFineCaption,@@ -111,14 +110,6 @@ test("Fine Caption freezes complete Where, How and visible-envelope parameters",assert.equal(parameters.basePaint.shadow.spreadPx, 1);assert.deepEqual(parameters.timing, { leadFrames: 4, tailFrames: 6, handoff: "cut" });- const vocabulary = captionFineMarkupSurfaces.find((surface) => surface.name === "style")!- .vocabulary.attributes.find((attribute) => attribute.name === "recipe")!.recipe!;- const declared = (name: string) => vocabulary.find((property) => property.name === name);- assert.equal(declared("x")?.group, "where");- assert.equal(declared("cue-shadow-blur")?.group, "how");- assert.equal(declared("active-box-background")?.group, "how");- assert.equal(declared("active-box-enter")?.group, "when");- assert.equal(declared("cue-enter")?.group, "when");});test("Fine Caption schedules visibility outside semantic Word timing and cuts only the handoff", () => {diff --git a/packages/comment-sticker-studio/README.md b/packages/comment-sticker-studio/README.mdnew file mode 100644index 00000000..ff81444c--- /dev/null+++ b/packages/comment-sticker-studio/README.md@@ -0,0 +1,3 @@+# `@hypit/comment-sticker-studio`++Hypit Studio Companion for `@hypit/comment-sticker`.diff --git a/packages/comment-sticker-studio/package.json b/packages/comment-sticker-studio/package.jsonnew file mode 100644index 00000000..d6963fbf--- /dev/null+++ b/packages/comment-sticker-studio/package.json@@ -0,0 +1,13 @@+{+ "name": "@hypit/comment-sticker-studio",+ "version": "0.0.0-dev",+ "license": "SEE LICENSE IN LICENSE",+ "private": true,+ "type": "module",+ "exports": { ".": "./src/index.ts" },+ "hypit": { "activation": "./src/activation.ts" },+ "dependencies": {+ "@hypit/comment-sticker": "workspace:*",+ "@hypit/studio-adapter": "workspace:*"+ }+}diff --git a/packages/comment-sticker-studio/src/activation.ts b/packages/comment-sticker-studio/src/activation.tsnew file mode 100644index 00000000..b5cf0887--- /dev/null+++ b/packages/comment-sticker-studio/src/activation.ts@@ -0,0 +1,7 @@+import { createStudioAdapterHostFacet } from "@hypit/studio-adapter";+import { commentStickerStudioAdapters } from "./index.js";++export default {+ format: "hypit.node-package@1" as const,+ hostFacets: [createStudioAdapterHostFacet(commentStickerStudioAdapters)],+};diff --git a/packages/comment-sticker-studio/src/index.ts b/packages/comment-sticker-studio/src/index.tsnew file mode 100644index 00000000..1af11b9a--- /dev/null+++ b/packages/comment-sticker-studio/src/index.ts@@ -0,0 +1,85 @@+import { commentStickerMarkupSurfaces } from "@hypit/comment-sticker";+import type { CommentStickerProgram } from "@hypit/comment-sticker";+import type { StudioAdapter, StudioAdapterContext, StudioEntityDraft, StudioParameterDeclaration, StudioRecipeParameterDeclaration } from "@hypit/studio-adapter";+import { artifactPreview, childEntities, previewLayer, projectedWindowTimelineEdits, requiredSurfaceValue, temporalLineageFor, textLayer } from "@hypit/studio-adapter";++const frameParameters: readonly StudioParameterDeclaration[] = [+ { name: "within", label: "Within", writable: false },+ { name: "left", label: "Left", writable: true },+ { name: "top", label: "Top", writable: true },+ { name: "right", label: "Right", writable: true },+ { name: "bottom", label: "Bottom", writable: true },+ { name: "x", label: "X", writable: true },+ { name: "y", label: "Y", writable: true },+ { name: "width", label: "Width", writable: true },+ { name: "height", label: "Height", writable: true },+];++const commentRecipe: readonly StudioRecipeParameterDeclaration[] = (commentStickerMarkupSurfaces+ .find((surface) => surface.name === "style")?.vocabulary.attributes+ .find((attribute) => attribute.name === "recipe")?.recipe ?? []).map((property) => {+ const when = property.name.startsWith("enter") || property.name.startsWith("exit");+ const where = /(?:width|height|padding|offset|size|gap|stack)/u.test(property.name);+ return {+ name: property.name,+ group: when ? "when" : where ? "where" : "how",+ section: when ? "motion" : where ? "layout" : "appearance",+ };+ });++function projectComments(context: StudioAdapterContext): readonly StudioEntityDraft[] {+ const program = requiredSurfaceValue(context, "program") as CommentStickerProgram;+ const items = program.items.map((item) => ({+ id: item.id,+ subjectId: item.subjectId,+ startFrame: item.span.startFrame,+ endFrameExclusive: item.span.endFrameExclusive,+ stackOrder: item.style.stackingOrder,+ }));+ return childEntities(context, items, "comment-sticker", "standard").map((entity, index) => {+ const item = program.items[index];+ if (item === undefined) return entity;+ const temporal = temporalLineageFor(context, item.id, "window");+ return {+ ...entity,+ display: {+ title: entity.display.title,+ layers: [+ ...(item.avatar === undefined ? [] : [previewLayer(artifactPreview("image", item.avatar.digest), "contain", "decoration")]),+ textLayer(item.content.comment),+ ],+ },+ ...(temporal?.source.kind === "program" || temporal?.source.id === undefined+ ? {}+ : { markerId: temporal.source.id }),+ ...(temporal === undefined ? {} : { temporal }),+ };+ });+}++export const commentStickerStudioAdapters: readonly StudioAdapter[] = [+ {+ id: "track", role: "track",+ output: { type: "VisualTrack", surface: "track", modules: ["@hypit/comment-sticker"] },+ family: "comment-sticker", tone: "orange", icon: "component",+ timelineEdits: projectedWindowTimelineEdits({ start: "start", end: "end", duration: "for" }),+ parameters: [+ { name: "frame", label: "Frame", writable: false, referenced: frameParameters },+ {+ name: "style", label: "Style", writable: false,+ recipe: { through: ["recipe"], parameters: commentRecipe },+ },+ { name: "comment", label: "Comment", writable: true },+ { name: "author", label: "Author", writable: true },+ { name: "header", label: "Header", writable: true },+ { name: "meta", label: "Meta", writable: true },+ { name: "avatar", label: "Avatar", writable: false },+ { name: "start", label: "Start", writable: true },+ { name: "end", label: "End", writable: true },+ { name: "for", label: "For", writable: true },+ ],+ requiredValues: ["program"], project: projectComments,+ poster: { source: "surface-preview" },+ lane: { heightPx: 52 },+ },+];diff --git a/packages/comment-sticker/src/program.ts b/packages/comment-sticker/src/program.tsindex e7d48fa0..9b753ad4 100644--- a/packages/comment-sticker/src/program.ts+++ b/packages/comment-sticker/src/program.ts@@ -210,6 +210,7 @@ function realized(if (avatar !== undefined) assertAvatar(avatar);const addition: CommentStickerItemProgram = {id: window.id,+ subjectId: spec.id,span: { ...window.span },frame: structuredClone(frame),style: structuredClone(style),@@ -242,6 +243,7 @@ export function assertCommentStickerProgram(value: CommentStickerProgram): voidconst ids = new Set<string>();for (const item of value.items) {identity(item.id, "CommentStickerItemProgram.id");+ identity(item.subjectId, "CommentStickerItemProgram.subjectId");assert(!ids.has(item.id), `Duplicate Comment Sticker Item ${item.id}.`);ids.add(item.id);assert(item.span.startFrame >= 0 && item.span.endFrameExclusive > item.span.startFrame,@@ -592,6 +594,7 @@ export function renderCommentSticker(canvas: CanvasSpace, space: ProgramSpace, pid: program.id,presents: program.items.map((item) => ({id: item.id,+ subjectId: item.subjectId,span: { ...item.span },stacking: { order: item.style.stackingOrder, tieBreak: item.tieBreak },elements: stickerElements(item),diff --git a/packages/comment-sticker/src/types.ts b/packages/comment-sticker/src/types.tsindex ad38cb85..79d490d3 100644--- a/packages/comment-sticker/src/types.ts+++ b/packages/comment-sticker/src/types.ts@@ -89,6 +89,8 @@ export type CommentStickerHeader = {export type CommentStickerItemProgram = {readonly id: string;+ /** Author-owned Item realized by this externally projected window. */+ readonly subjectId: string;readonly span: FrameSpan;readonly frame: SpatialFrame;readonly style: CommentStickerStyle;diff --git a/packages/composition/src/track.ts b/packages/composition/src/track.tsindex 4c5c946c..f4fd5c2b 100644--- a/packages/composition/src/track.ts+++ b/packages/composition/src/track.ts@@ -345,6 +345,8 @@ export type VisualElement = VisualBoxElement | VisualMaskElement | VisualTextEleexport type VisualPresent = {readonly id: string;+ /** Optional domain entity implemented by this renderer Present. */+ readonly subjectId?: string;readonly span: FrameSpan;/** Absolute paint position for this Present, not for its authoring Track. */readonly stacking: {@@ -365,6 +367,8 @@ export type VisualTrack = {export type AudioClip = {readonly id: string;+ /** Optional domain entity implemented by this renderer Clip. */+ readonly subjectId?: string;/** Bytes only. Exact duration belongs to source.sampleFrames, not duplicated floating metadata. */readonly artifact: BlobRef;/** Exact audible placement in the canonical 48 kHz ProgramSpace sample domain. */@@ -909,6 +913,7 @@ function assertAnimation(animation: VisualAnimation | undefined, _durationFramesfunction assertPresent(present: VisualPresent, programSpace: ProgramSpace | undefined, trackId: string): void {const totalFrames = programSpace === undefined ? Number.MAX_SAFE_INTEGER : programSpaceFrameCount(programSpace);assertNonEmpty(present.id, `${trackId} Present id`);+ if (present.subjectId !== undefined) assertNonEmpty(present.subjectId, `${trackId}.${present.id} subjectId`);assertFrameSpan(present.span, totalFrames, `${trackId}.${present.id}.span`);assertNonEmpty(present.stacking.tieBreak, `${trackId}.${present.id} stacking tieBreak`);if (!Number.isSafeInteger(present.stacking.order)) {@@ -1195,6 +1200,7 @@ function visualTrackContent(value: Omit<VisualTrack, "kind">): VisualTrack {presents: [...value.presents].map((present) => ({id: present.id,+ ...(present.subjectId === undefined ? {} : { subjectId: present.subjectId }),span: { ...present.span },stacking: { ...present.stacking },elements: [...present.elements].map(normalizeElement).sort((a, b) => a.order - b.order || a.id.localeCompare(b.id)),@@ -1213,6 +1219,7 @@ function audioTrackContent(value: Omit<AudioTrack, "kind">): AudioTrack {clips: [...value.clips].map((clip) => ({id: clip.id,+ ...(clip.subjectId === undefined ? {} : { subjectId: clip.subjectId }),artifact: { ...clip.artifact },target: { ...clip.target },source: { ...clip.source },@@ -1259,6 +1266,7 @@ export function assertAudioTrackIdentity(track: AudioTrack, programSpace?: Progrif (clipIds.has(clip.id)) throw new Error(`${track.id} has duplicate clip ${clip.id}.`);clipIds.add(clip.id);assertNonEmpty(clip.id, `${track.id} clip id`);+ if (clip.subjectId !== undefined) assertNonEmpty(clip.subjectId, `${track.id}.${clip.id} subjectId`);assertAudioArtifact(clip.artifact, `${track.id}.${clip.id}.artifact`);if (!Number.isSafeInteger(clip.target.startSample) || clip.target.startSample < 0|| !Number.isSafeInteger(clip.target.endSampleExclusive)diff --git a/packages/deck-track-studio/README.md b/packages/deck-track-studio/README.mdnew file mode 100644index 00000000..e581bd30--- /dev/null+++ b/packages/deck-track-studio/README.md@@ -0,0 +1,3 @@+# `@hypit/deck-track-studio`++Hypit Studio Companion for `@hypit/deck-track`.diff --git a/packages/deck-track-studio/package.json b/packages/deck-track-studio/package.jsonnew file mode 100644index 00000000..bcb9cbde--- /dev/null+++ b/packages/deck-track-studio/package.json@@ -0,0 +1,13 @@+{+ "name": "@hypit/deck-track-studio",+ "version": "0.0.0-dev",+ "license": "SEE LICENSE IN LICENSE",+ "private": true,+ "type": "module",+ "exports": { ".": "./src/index.ts" },+ "hypit": { "activation": "./src/activation.ts" },+ "dependencies": {+ "@hypit/deck-track": "workspace:*",+ "@hypit/studio-adapter": "workspace:*"+ }+}diff --git a/packages/deck-track-studio/src/activation.ts b/packages/deck-track-studio/src/activation.tsnew file mode 100644index 00000000..e544c187--- /dev/null+++ b/packages/deck-track-studio/src/activation.ts@@ -0,0 +1,7 @@+import { createStudioAdapterHostFacet } from "@hypit/studio-adapter";+import { deckTrackStudioAdapters } from "./index.js";++export default {+ format: "hypit.node-package@1" as const,+ hostFacets: [createStudioAdapterHostFacet(deckTrackStudioAdapters)],+};diff --git a/packages/deck-track-studio/src/index.ts b/packages/deck-track-studio/src/index.tsnew file mode 100644index 00000000..c52bf838--- /dev/null+++ b/packages/deck-track-studio/src/index.ts@@ -0,0 +1,77 @@+import { depthStackMarkupSurfaces } from "@hypit/deck-track";+import type { DepthStackProgram } from "@hypit/deck-track";+import type { StudioAdapter, StudioAdapterContext, StudioEntityDraft, StudioRecipeParameterDeclaration } from "@hypit/studio-adapter";+import { projectedPointTimelineEdits, requiredSurfaceValue, temporalLineageFor } from "@hypit/studio-adapter";++const deckAppearanceRecipe: readonly StudioRecipeParameterDeclaration[] = (depthStackMarkupSurfaces+ .find((surface) => surface.name === "track")?.vocabulary.attributes+ .find((attribute) => attribute.name === "appearance")?.recipe ?? []).map((property) => {+ const when = property.name.includes("frames") || property.name.includes("easing") || property.name.includes("duration");+ const where = /(?:^|[-])(x|y|scale|rotation|stacking|visible)(?:$|[-])/u.test(property.name);+ return {+ name: property.name,+ group: when ? "when" : where ? "where" : "how",+ section: when ? "motion" : where ? "depth" : "appearance",+ };+ });++function cardTitle(card: DepthStackProgram["cards"][number]): string {+ if (card.label.kind === "none") return card.id;+ const text = card.label.document.paragraphs.flatMap((paragraph) => paragraph.inlines)+ .flatMap((inline) => inline.kind === "text" ? [inline.text] : [" "])+ .join(" ")+ .replace(/\s+/gu, " ")+ .trim();+ return text || card.id;+}++function projectDeck(context: StudioAdapterContext): readonly StudioEntityDraft[] {+ const program = requiredSurfaceValue(context, "program") as DepthStackProgram;+ if (context.placement === undefined) return context.generic();+ const children = new Map(context.placement.children.flatMap((child) =>+ child.id === undefined ? [] : [[child.id, child] as const]));+ return program.cards.map((card, index): StudioEntityDraft => {+ const child = children.get(card.id);+ const temporal = temporalLineageFor(context, card.id, "activation");+ const markerId = temporal?.source.id;+ const endFrameExclusive = program.cards[index + 1]?.activationFrame ?? program.terminalFrame;+ const renders = context.spans.filter((span) => span.id === card.id || span.subjectId === card.id);+ const render = renders[0];+ const appearance = child?.referenceAttributes.appearance+ ?? context.placement?.referenceAttributes.appearance;+ return {+ id: `${context.track.outputRef}:entity:${card.id}`,+ authoredId: card.id,+ ...(markerId === undefined ? {} : { markerId }),+ display: { title: cardTitle(card), layers: [] },+ startFrame: card.activationFrame,+ endFrameExclusive,+ stackOrder: program.spec.stackingOrder ?? render?.stackOrder ?? 0,+ ...(child === undefined ? {} : { elementRange: child.range }),+ ...(render === undefined ? {} : { presentId: render.id, renderIds: renders.map((span) => span.id) }),+ ...(appearance === undefined ? {} : { parameterReferences: { appearance } }),+ presentation: { entity: "deck-card", chrome: "standard" },+ ...(temporal === undefined ? {} : { temporal }),+ };+ });+}++export const deckTrackStudioAdapters: readonly StudioAdapter[] = [+ {+ id: "track", role: "track",+ output: { type: "VisualTrack", surface: "track", modules: ["@hypit/deck-track"] },+ family: "deck", tone: "orange", icon: "layers", requiredValues: ["program"],+ timelineEdits: projectedPointTimelineEdits(),+ parameters: [+ { name: "source", label: "Source", writable: false },+ { name: "extent", label: "Extent", writable: false },+ {+ name: "appearance", label: "Appearance", writable: false,+ recipe: { parameters: deckAppearanceRecipe },+ },+ { name: "label", label: "Label", writable: true },+ ],+ project: projectDeck,+ lane: { heightPx: 52 },+ },+];diff --git a/packages/deck-track/src/lower.ts b/packages/deck-track/src/lower.tsindex 992516ed..9fa54e2d 100644--- a/packages/deck-track/src/lower.ts+++ b/packages/deck-track/src/lower.ts@@ -328,6 +328,7 @@ export function renderDepthStack(}const mediaItem: MediaItemProgram = {id: "deck-material",+ subjectId: card.id,span: { startFrame: stageStart, endFrameExclusive: stageEnd },frame: localFrame(program.frame),presentation: structuredClone(program.spec.presentation),@@ -346,6 +347,7 @@ export function renderDepthStack(const label = labelElement(card, frameId, material.reduce((maximum, element) => Math.max(maximum, element.order), 0) + 1);presents.push({id: `${card.id}:stage:${stageIndex + 1}`,+ subjectId: card.id,span: { startFrame: stageStart, endFrameExclusive: stageEnd },stacking: {order: program.spec.stackingOrder + (newDepth === undefineddiff --git a/packages/markup/src/types.ts b/packages/markup/src/types.tsindex 4013ed3c..c447064a 100644--- a/packages/markup/src/types.ts+++ b/packages/markup/src/types.ts@@ -126,10 +126,6 @@ export type SurfaceRecipePropertyVocabulary = {readonly name: string;readonly required: boolean;readonly summary: string;- /** Stable Inspector page owned by the component package. */- readonly group?: "where" | "how" | "when" | string;- /** Optional package-owned subsection inside the page. */- readonly section?: string;readonly values?: readonly string[];readonly fallback?: string;};diff --git a/packages/media-track-studio/README.md b/packages/media-track-studio/README.mdnew file mode 100644index 00000000..fe0c8047--- /dev/null+++ b/packages/media-track-studio/README.md@@ -0,0 +1,3 @@+# `@hypit/media-track-studio`++Hypit Studio Companion for `@hypit/media-track`.diff --git a/packages/media-track-studio/package.json b/packages/media-track-studio/package.jsonnew file mode 100644index 00000000..0596b56c--- /dev/null+++ b/packages/media-track-studio/package.json@@ -0,0 +1,13 @@+{+ "name": "@hypit/media-track-studio",+ "version": "0.0.0-dev",+ "license": "SEE LICENSE IN LICENSE",+ "private": true,+ "type": "module",+ "exports": { ".": "./src/index.ts" },+ "hypit": { "activation": "./src/activation.ts" },+ "dependencies": {+ "@hypit/media-track": "workspace:*",+ "@hypit/studio-adapter": "workspace:*"+ }+}diff --git a/packages/media-track-studio/src/activation.ts b/packages/media-track-studio/src/activation.tsnew file mode 100644index 00000000..77dc96fd--- /dev/null+++ b/packages/media-track-studio/src/activation.ts@@ -0,0 +1,7 @@+import { createStudioAdapterHostFacet } from "@hypit/studio-adapter";+import { mediaTrackStudioAdapters } from "./index.js";++export default {+ format: "hypit.node-package@1" as const,+ hostFacets: [createStudioAdapterHostFacet(mediaTrackStudioAdapters)],+};diff --git a/packages/media-track-studio/src/index.ts b/packages/media-track-studio/src/index.tsnew file mode 100644index 00000000..661c82e7--- /dev/null+++ b/packages/media-track-studio/src/index.ts@@ -0,0 +1,156 @@+import { mediaTrackMarkupSurfaces } from "@hypit/media-track";+import type { MediaLayerProgram, MediaTrackProgram } from "@hypit/media-track";+import type {+ StudioAdapter,+ StudioAdapterContext,+ StudioEntityDraft,+ StudioMaterialPreview,+ StudioParameterDeclaration,+ StudioRecipeParameterDeclaration,+} from "@hypit/studio-adapter";+import { artifactPreview, childEntities, previewLayer, projectedWindowTimelineEdits, requiredSurfaceValue, temporalLineageFor } from "@hypit/studio-adapter";++const frameParameters: readonly StudioParameterDeclaration[] = [+ { name: "within", label: "Within", writable: false },+ { name: "left", label: "Left", writable: true },+ { name: "top", label: "Top", writable: true },+ { name: "right", label: "Right", writable: true },+ { name: "bottom", label: "Bottom", writable: true },+ { name: "x", label: "X", writable: true },+ { name: "y", label: "Y", writable: true },+ { name: "width", label: "Width", writable: true },+ { name: "height", label: "Height", writable: true },+];++const extentParameters: readonly StudioParameterDeclaration[] = [+ { name: "width", label: "Width", control: "number", writable: true, unit: "px" },+ { name: "height", label: "Height", control: "number", writable: true, unit: "px" },+];++const mediaTrackSurface = mediaTrackMarkupSurfaces.find((surface) => surface.name === "track");+const mediaItemAttributes = mediaTrackSurface?.vocabulary.children?.find((child) => child.tag === "Item")?.attributes ?? [];++function mediaRecipe(name: "appearance" | "motion"): readonly StudioRecipeParameterDeclaration[] {+ const attribute = mediaItemAttributes.find((candidate) => candidate.name === name);+ const properties = attribute !== undefined && "recipe" in attribute ? attribute.recipe : [];+ return properties.map((property) => ({+ name: property.name,+ group: name === "motion" ? "when" : property.name === "stack-order" ? "where" : "how",+ section: name === "motion" ? "lifecycle" : property.name === "stack-order" ? "stacking" : "appearance",+ }));+}++const mediaAppearanceRecipe = mediaRecipe("appearance");+const mediaMotionRecipe = mediaRecipe("motion");++function materialPreview(+ layers: readonly MediaLayerProgram[],+ facet: "visual" | "audio",+ audioFromLayer?: string,+): StudioMaterialPreview | undefined {+ const layer = layers.find((candidate) => candidate.kind === "sample"+ && (facet === "visual" || audioFromLayer === undefined || candidate.id === audioFromLayer));+ if (layer?.kind !== "sample") return undefined;+ if (facet === "audio") {+ const artifact = layer.source.kind === "timed" ? layer.source.audio?.artifact : undefined;+ return artifact === undefined ? undefined : artifactPreview("audio", artifact.digest);+ }+ if (layer.source.kind === "surface") return undefined;+ return artifactPreview(layer.source.kind === "still" ? "image" : "video", layer.source.artifact.digest);+}++function projectMedia(context: StudioAdapterContext): readonly StudioEntityDraft[] {+ const program = requiredSurfaceValue(context, "program") as MediaTrackProgram;+ const facet = context.track.type === "AudioTrack" ? "audio" : "visual";+ const items = [+ ...program.items.map((item) => ({+ id: item.id,+ subjectId: item.subjectId,+ startFrame: item.span.startFrame,+ endFrameExclusive: item.span.endFrameExclusive,+ stackOrder: item.stacking.order,+ preview: materialPreview(item.layers, facet, item.sourceAudio?.fromLayer),+ temporalInput: "window",+ })),+ ...program.sequences.map((sequence) => ({+ id: sequence.id,+ subjectId: sequence.id,+ startFrame: sequence.span.startFrame,+ endFrameExclusive: sequence.span.endFrameExclusive,+ stackOrder: sequence.stacking.order,+ preview: sequence.members[0] === undefined+ ? undefined+ : materialPreview(sequence.members[0].layers, facet, sequence.members[0].sourceAudio?.fromLayer),+ temporalInput: "terminal",+ })),+ ];+ return childEntities(context, items, "media-item", "standard")+ .map((entity, index) => {+ const item = items[index];+ if (item === undefined) return entity;+ const temporal = temporalLineageFor(context, item.id, item.temporalInput);+ return {+ ...entity,+ ...(temporal?.source.kind === "program" || temporal?.source.id === undefined+ ? {}+ : { markerId: temporal.source.id }),+ ...(item.preview === undefined ? {} : {+ display: {+ ...entity.display,+ layers: [previewLayer(item.preview, facet === "audio" ? "waveform" : item.preview.kind === "video" ? "storyboard" : "repeat-x")],+ },+ }),+ ...(temporal === undefined ? {} : { temporal }),+ };+ });+}++const commonParameters: readonly StudioParameterDeclaration[] = [+ { name: "start", label: "Start", writable: true },+ { name: "end", label: "End", writable: true },+ { name: "for", label: "For", writable: true },+ { name: "source-audio", label: "Source audio", writable: true },+ { name: "audio-gain", label: "Audio gain", control: "number", writable: true },+ { name: "until", label: "Until", writable: false },+ {+ name: "until-boundary", label: "Until boundary", control: "select", writable: true,+ options: ["start", "end"],+ },+];++export const mediaTrackStudioAdapters: readonly StudioAdapter[] = [+ {+ id: "visual", role: "track",+ output: { type: "VisualTrack", surface: "track", modules: ["@hypit/media-track"] },+ family: "media", tone: "blue", icon: "video",+ timelineEdits: projectedWindowTimelineEdits({ start: "start", end: "end", duration: "for" }),+ parameters: [+ ...commonParameters,+ { name: "extent", label: "Extent", writable: false, referenced: extentParameters },+ { name: "clip", label: "Clip", writable: false },+ { name: "image", label: "Image", writable: false },+ { name: "media", label: "Media", writable: false },+ { name: "surface", label: "Surface", writable: false },+ { name: "frame", label: "Frame", writable: false, referenced: frameParameters },+ {+ name: "appearance", label: "Appearance", writable: false,+ recipe: { parameters: mediaAppearanceRecipe },+ },+ {+ name: "motion", label: "Motion", writable: false,+ recipe: { parameters: mediaMotionRecipe },+ },+ ],+ requiredValues: ["program"], project: projectMedia,+ lane: { heightPx: 76 },+ },+ {+ id: "audio", role: "track",+ output: { type: "AudioTrack", surface: "track", modules: ["@hypit/media-track"] },+ family: "media-audio", tone: "green", icon: "waveform",+ timelineEdits: projectedWindowTimelineEdits({ start: "start", end: "end", duration: "for" }),+ parameters: commonParameters,+ requiredValues: ["program"], project: projectMedia,+ lane: { heightPx: 48 },+ },+];diff --git a/packages/media-track/src/program.ts b/packages/media-track/src/program.tsindex c6abd8a7..69f96864 100644--- a/packages/media-track/src/program.ts+++ b/packages/media-track/src/program.ts@@ -156,6 +156,7 @@ function realizedItems(const motion = resolveMediaLifecycleMotion(spec.motion, frame, canvas);const addition = {id: window.id,+ subjectId: spec.id,span: { ...window.span },frame: { ...frame },presentation: structuredClone(spec.presentation),@@ -201,6 +202,7 @@ function assertSampleLayerForSpace(layer: MediaSampleLayerProgram, space: Prografunction assertItem(item: MediaItemProgram, space: ProgramSpace, label: string): void {assertMediaIdentity(item.id, `${label}.id`);+ assertMediaIdentity(item.subjectId, `${label}.subjectId`);assert(Number.isSafeInteger(item.span.startFrame) && Number.isSafeInteger(item.span.endFrameExclusive)&& item.span.startFrame >= 0 && item.span.endFrameExclusive > item.span.startFrame&& item.span.endFrameExclusive <= programSpaceFrameCount(space), `${label}.span is invalid.`);@@ -366,6 +368,7 @@ export function projectMediaVisualTrack(space: ProgramSpace, program: MediaTrackpresents: [...program.items.map((item) => ({id: item.id,+ subjectId: item.subjectId,span: { ...item.span },stacking: { ...item.stacking },elements: lowerMediaItemElements(item, space),@@ -386,7 +389,7 @@ function sourceSampleBoundary(frame: number, frameCount: number, sampleFrames: n}function sourceAudioClip(- value: Pick<MediaItemProgram, "id" | "span" | "layers" | "sourceAudio">,+ value: Pick<MediaItemProgram, "id" | "subjectId" | "span" | "layers" | "sourceAudio">,space: ProgramSpace,fades: { readonly inSamples: number; readonly outSamples: number } = { inSamples: 0, outSamples: 0 },): AudioClip | undefined {@@ -435,6 +438,7 @@ function sourceAudioClip(`Media projection ${value.id} source audio is too short for its authored crossfade.`);return {id: `${value.id}:source-audio`,+ subjectId: value.subjectId,artifact: structuredClone(audio.artifact),target: { startSample: targetStart, endSampleExclusive: targetEnd },source: {@@ -515,6 +519,7 @@ function sequenceAudioClips(sequence: MediaSequenceProgram, space: ProgramSpace): 0;const clip = sourceAudioClip({id: `${sequence.id}:${member.id}`,+ subjectId: sequence.id,span,layers: member.layers,sourceAudio: member.sourceAudio,diff --git a/packages/media-track/src/restricted-speech.ts b/packages/media-track/src/restricted-speech.tsindex 9383dc58..3d650fb9 100644--- a/packages/media-track/src/restricted-speech.ts+++ b/packages/media-track/src/restricted-speech.ts@@ -10,6 +10,7 @@ import type { MediaItemProgram } from "./types.js";export type RestrictedSpeechVisualClip = {readonly id: string;+ readonly subjectId?: string;readonly span: { readonly startFrame: number; readonly endFrameExclusive: number };readonly artifact: BlobRef;readonly extent: IntrinsicExtent;@@ -53,6 +54,7 @@ export function lowerRestrictedSpeechVisualPresents(}const item: MediaItemProgram = {id: `${trackId}:${clip.id}`,+ subjectId: clip.subjectId ?? clip.id,span: { ...clip.span },frame: structuredClone(clip.frame),presentation: {@@ -86,6 +88,7 @@ export function lowerRestrictedSpeechVisualPresents(};return {id: item.id,+ subjectId: clip.subjectId ?? clip.id,span: { ...item.span },stacking: { ...item.stacking },elements: lowerMediaItemElements(item, space),diff --git a/packages/media-track/src/sequence.ts b/packages/media-track/src/sequence.tsindex 8507f464..99340537 100644--- a/packages/media-track/src/sequence.ts+++ b/packages/media-track/src/sequence.ts@@ -364,6 +364,7 @@ export function lowerMediaSequencePresents(const outgoing = sequence.handoffs[index];const item: MediaItemProgram = {id: `${sequence.id}:${member.id}`,+ subjectId: sequence.id,span: { ...member.visualSpan },frame: { ...sequence.frame },presentation: structuredClone(sequence.presentation),@@ -382,6 +383,7 @@ export function lowerMediaSequencePresents(const endOffset = member.visualSpan.endFrameExclusive - sequence.span.startFrame;return {id: item.id,+ subjectId: sequence.id,span: { ...item.span },stacking: { ...item.stacking },elements: lowerMediaItemElements(item, space, {diff --git a/packages/media-track/src/types.ts b/packages/media-track/src/types.tsindex f96af575..b1f0d3ed 100644--- a/packages/media-track/src/types.ts+++ b/packages/media-track/src/types.ts@@ -221,6 +221,8 @@ export type MediaItemSpec = {export type MediaItemProgram = {readonly id: string;+ /** Author-owned Item realized by this externally projected window. */+ readonly subjectId: string;readonly span: FrameSpan;readonly frame: SpatialFrame;readonly presentation: MediaFramePresentation;diff --git a/packages/ranking-studio/README.md b/packages/ranking-studio/README.mdnew file mode 100644index 00000000..853db636--- /dev/null+++ b/packages/ranking-studio/README.md@@ -0,0 +1,3 @@+# `@hypit/ranking-studio`++Hypit Studio Companion for the Ranking module's Column, Tier and Top Three surfaces.diff --git a/packages/studio-video-adapters/package.json b/packages/ranking-studio/package.jsonsimilarity index 51%rename from packages/studio-video-adapters/package.jsonrename to packages/ranking-studio/package.jsonindex 6e9d365f..f45ede96 100644--- a/packages/studio-video-adapters/package.json+++ b/packages/ranking-studio/package.json@@ -1,16 +1,13 @@{- "name": "@hypit/studio-video-adapters",+ "name": "@hypit/ranking-studio","version": "0.0.0-dev","license": "SEE LICENSE IN LICENSE","private": true,"type": "module",- "exports": {- ".": "./src/index.ts"- },- "hypit": {- "activation": "./src/activation.ts"- },+ "exports": { ".": "./src/index.ts" },+ "hypit": { "activation": "./src/activation.ts" },"dependencies": {+ "@hypit/ranking": "workspace:*","@hypit/studio-adapter": "workspace:*"}}diff --git a/packages/ranking-studio/src/activation.ts b/packages/ranking-studio/src/activation.tsnew file mode 100644index 00000000..dc29d869--- /dev/null+++ b/packages/ranking-studio/src/activation.ts@@ -0,0 +1,7 @@+import { createStudioAdapterHostFacet } from "@hypit/studio-adapter";+import { rankingStudioAdapters } from "./index.js";++export default {+ format: "hypit.node-package@1" as const,+ hostFacets: [createStudioAdapterHostFacet(rankingStudioAdapters)],+};diff --git a/packages/ranking-studio/src/index.ts b/packages/ranking-studio/src/index.tsnew file mode 100644index 00000000..caca8358--- /dev/null+++ b/packages/ranking-studio/src/index.ts@@ -0,0 +1,157 @@+import { rankingMarkupSurfaces } from "@hypit/ranking";+import type { RankingProgram, RankingSchedule } from "@hypit/ranking";+import type { StudioAdapter, StudioAdapterContext, StudioEntityDraft, StudioParameterDeclaration, StudioRecipeParameterDeclaration } from "@hypit/studio-adapter";+import { artifactPreview, previewLayer, projectedPointTimelineEdits, requiredSurfaceValue, selectionWindowTimelineEdits, temporalLineageFor } from "@hypit/studio-adapter";++const frameParameters: readonly StudioParameterDeclaration[] = [+ { name: "within", label: "Within", writable: false },+ { name: "left", label: "Left", writable: true },+ { name: "top", label: "Top", writable: true },+ { name: "right", label: "Right", writable: true },+ { name: "bottom", label: "Bottom", writable: true },+ { name: "x", label: "X", writable: true },+ { name: "y", label: "Y", writable: true },+ { name: "width", label: "Width", writable: true },+ { name: "height", label: "Height", writable: true },+];++function rankingRecipe(surface: "column-style" | "tier-style" | "top-three-style"): readonly StudioRecipeParameterDeclaration[] {+ const properties = rankingMarkupSurfaces.find((candidate) => candidate.name === surface)+ ?.vocabulary.attributes.find((attribute) => attribute.name === "recipe")?.recipe ?? [];+ return properties.map((property) => {+ const when = property.name.includes("frames") || property.name.includes("easing") || property.name.includes("fade");+ const where = /(?:^|[-])(x|y|width|height|size|gap|padding|stack|rows|radius)(?:$|[-])/u.test(property.name);+ return {+ name: property.name,+ group: when ? "when" : where ? "where" : "how",+ section: when ? "motion" : where ? "layout" : "appearance",+ };+ });+}++function rankingStyle(surface: "column-style" | "tier-style" | "top-three-style"): StudioParameterDeclaration {+ return {+ name: "style", label: "Style", writable: false,+ recipe: { through: ["recipe"], parameters: rankingRecipe(surface) },+ };+}++function projectRanking(context: StudioAdapterContext): readonly StudioEntityDraft[] {+ const placement = context.placement;+ const schedule = requiredSurfaceValue(context, "schedule") as RankingSchedule;+ const program = requiredSurfaceValue(context, "program") as RankingProgram;+ if (placement === undefined) return context.generic();+ const boardId = placement.id ?? context.track.outputRef;+ const outerTemporal = temporalLineageFor(context, boardId, "outer");+ const group: StudioEntityDraft = {+ id: `${context.track.outputRef}:entity:${boardId}`,+ authoredId: boardId,+ ...(outerTemporal?.source.id === undefined ? {} : { markerId: outerTemporal.source.id }),+ display: { title: boardId, layers: [] },+ startFrame: schedule.outer.startFrame,+ endFrameExclusive: schedule.outer.endFrameExclusive,+ stackOrder: Math.max(...context.spans.map((span) => span.stackOrder), 0),+ elementRange: placement.range,+ renderIds: context.spans.map((span) => span.id),+ presentation: { entity: "ranking", chrome: "group" },+ ...(outerTemporal === undefined ? {} : { temporal: outerTemporal }),+ };+ const children = new Map(placement.children.flatMap((child) =>+ child.id === undefined ? [] : [[child.id, child] as const]));+ const programItems = new Map(program?.items.map((item) => [item.id, item] as const) ?? []);+ const reveals = schedule.entries.flatMap((entry): readonly StudioEntityDraft[] => {+ if ("mode" in entry && entry.mode !== "reveal") return [];+ const child = children.get(entry.itemId);+ const item = programItems.get(entry.itemId);+ const temporal = temporalLineageFor(context, entry.itemId, "mode" in entry ? "window" : "activation");+ const visible = "mode" in entry ? entry.window : entry.cumulative;+ const icon = item?.icon;+ const label = item !== undefined && "label" in item ? item.label : child?.attributes.label ?? entry.itemId;+ return [{+ id: `${context.track.outputRef}:entity:${entry.itemId}`,+ authoredId: entry.itemId,+ ...(temporal?.source.id === undefined ? {} : { markerId: temporal.source.id }),+ display: {+ title: label,+ layers: icon === undefined ? [] : [previewLayer(artifactPreview("image", icon.digest), "repeat-x")],+ },+ startFrame: visible.startFrame,+ endFrameExclusive: visible.endFrameExclusive,+ stackOrder: group.stackOrder + 1,+ ...(child === undefined ? {} : { elementRange: child.range }),+ lane: "mode" in entry ? "reveal" : "activation",+ presentation: { entity: "ranking-reveal", chrome: "standard" },+ ...(temporal === undefined ? {} : { temporal }),+ }];+ }).sort((left, right) => left.startFrame - right.startFrame || left.id.localeCompare(right.id));+ return [group, ...reveals];+}++const commonParameters: readonly StudioParameterDeclaration[] = [+ { name: "frame", label: "Frame", writable: false, referenced: frameParameters },+ { name: "appear-sound", label: "Appear sound", writable: false },+ { name: "move-sound", label: "Move sound", writable: false },+];++export const rankingStudioAdapters: readonly StudioAdapter[] = [+ {+ id: "column", role: "track",+ output: { type: "VisualTrack", surface: "column", modules: ["@hypit/ranking"] },+ family: "ranking", tone: "orange", label: "Ranking", icon: "ranking", requiredValues: ["schedule", "program"],+ timelineEdits: selectionWindowTimelineEdits(),+ parameters: [+ ...commonParameters,+ rankingStyle("column-style"),+ ],+ poster: { source: "surface-preview" },+ lane: {+ heightPx: 80, groupId: "ranking-reveals",+ },+ attachments: [{+ id: "reveal", family: "ranking-reveal", tone: "orange-muted", label: "Reveals", icon: "ranking", facet: "visual",+ lane: { heightPx: 40 },+ parameters: [+ { name: "label", label: "Label", writable: true },+ { name: "icon", label: "Icon", writable: false },+ { name: "rank", label: "Rank", control: "number", writable: true },+ { name: "preset", label: "Preset", control: "boolean", writable: true },+ { name: "stack", label: "Stack", control: "number", writable: true },+ ],+ timelineEdits: selectionWindowTimelineEdits(),+ }],+ project: projectRanking,+ },+ ...([[+ "tier", "tier", "Tier Board",+ ], [+ "top-three", "top-three", "Top Three",+ ]] as const).map(([id, surface, label]): StudioAdapter => ({+ id, role: "track",+ output: { type: "VisualTrack", surface, modules: ["@hypit/ranking"] },+ family: "ranking", tone: "orange", label, icon: "ranking", requiredValues: ["schedule", "program"],+ timelineEdits: selectionWindowTimelineEdits(),+ parameters: [+ ...commonParameters,+ rankingStyle(surface === "tier" ? "tier-style" : "top-three-style"),+ { name: "terminal", label: "Terminal", writable: false },+ ],+ poster: { source: "surface-preview" },+ lane: { heightPx: 80, groupId: `${id}-activations` },+ attachments: [{+ id: "activation", family: "ranking-reveal", tone: "orange-muted", label: "Activations", icon: "ranking", facet: "visual",+ lane: { heightPx: 40 },+ parameters: id === "tier" ? [+ { name: "tier", label: "Tier", writable: true },+ { name: "entry", label: "Entry", control: "select", writable: true, options: ["direct", "stage"] },+ { name: "icon", label: "Icon", writable: false },+ { name: "stack", label: "Stack", control: "number", writable: true },+ ] : [+ { name: "label", label: "Label", writable: true },+ { name: "icon", label: "Icon", writable: false },+ { name: "stack", label: "Stack", control: "number", writable: true },+ ],+ timelineEdits: projectedPointTimelineEdits(),+ }],+ project: projectRanking,+ })),+];diff --git a/packages/screen-overlay-studio/README.md b/packages/screen-overlay-studio/README.mdnew file mode 100644index 00000000..82c858c3--- /dev/null+++ b/packages/screen-overlay-studio/README.md@@ -0,0 +1,3 @@+# `@hypit/screen-overlay-studio`++Hypit Studio Companion for `@hypit/screen-overlay`.diff --git a/packages/screen-overlay-studio/package.json b/packages/screen-overlay-studio/package.jsonnew file mode 100644index 00000000..0c0cbb2e--- /dev/null+++ b/packages/screen-overlay-studio/package.json@@ -0,0 +1,13 @@+{+ "name": "@hypit/screen-overlay-studio",+ "version": "0.0.0-dev",+ "license": "SEE LICENSE IN LICENSE",+ "private": true,+ "type": "module",+ "exports": { ".": "./src/index.ts" },+ "hypit": { "activation": "./src/activation.ts" },+ "dependencies": {+ "@hypit/screen-overlay": "workspace:*",+ "@hypit/studio-adapter": "workspace:*"+ }+}diff --git a/packages/screen-overlay-studio/src/activation.ts b/packages/screen-overlay-studio/src/activation.tsnew file mode 100644index 00000000..2772eb7f--- /dev/null+++ b/packages/screen-overlay-studio/src/activation.ts@@ -0,0 +1,7 @@+import { createStudioAdapterHostFacet } from "@hypit/studio-adapter";+import { screenOverlayStudioAdapters } from "./index.js";++export default {+ format: "hypit.node-package@1" as const,+ hostFacets: [createStudioAdapterHostFacet(screenOverlayStudioAdapters)],+};diff --git a/packages/screen-overlay-studio/src/index.ts b/packages/screen-overlay-studio/src/index.tsnew file mode 100644index 00000000..a861d96c--- /dev/null+++ b/packages/screen-overlay-studio/src/index.ts@@ -0,0 +1,84 @@+import type { ScreenOverlayProgram } from "@hypit/screen-overlay";+import type { StudioAdapter, StudioAdapterContext, StudioEntityDraft } from "@hypit/studio-adapter";+import { childEntities, projectedWindowTimelineEdits, requiredSurfaceValue, temporalLineageFor } from "@hypit/studio-adapter";++function projectOverlays(context: StudioAdapterContext): readonly StudioEntityDraft[] {+ const program = requiredSurfaceValue(context, "program") as ScreenOverlayProgram;+ const items = program.items.map((item) => ({+ id: item.id,+ subjectId: item.subjectId,+ startFrame: item.span.startFrame,+ endFrameExclusive: item.span.endFrameExclusive,+ stackOrder: item.stacking.order,+ }));+ return childEntities(context, items, "screen-overlay", "standard").map((entity, index) => {+ const item = program.items[index];+ if (item === undefined) return entity;+ const temporal = temporalLineageFor(context, item.id, "window");+ return {+ ...entity,+ display: { title: item.content.kind.replaceAll("-", " "), layers: [] },+ ...(temporal?.source.kind === "program" || temporal?.source.id === undefined+ ? {}+ : { markerId: temporal.source.id }),+ ...(temporal === undefined ? {} : { temporal }),+ };+ });+}++export const screenOverlayStudioAdapters: readonly StudioAdapter[] = [+ {+ id: "track", role: "track",+ output: { type: "VisualTrack", surface: "track", modules: ["@hypit/screen-overlay"] },+ family: "screen-overlay", tone: "orange", icon: "component",+ timelineEdits: projectedWindowTimelineEdits({ start: "start", end: "end", duration: "for" }),+ parameters: [+ { name: "start", label: "Start", writable: true },+ { name: "end", label: "End", writable: true },+ { name: "for", label: "For", writable: true },+ { name: "color", label: "Color", writable: true },+ { name: "intensity", label: "Intensity", control: "number", writable: true },+ { name: "opacity", label: "Opacity", control: "number", writable: true },+ { name: "attack", label: "Attack", control: "number", writable: true, unit: "f" },+ { name: "hold", label: "Hold", control: "number", writable: true, unit: "f" },+ { name: "decay", label: "Decay", control: "number", writable: true, unit: "f" },+ { name: "center-x", label: "Center X", control: "number", writable: true },+ { name: "center-y", label: "Center Y", control: "number", writable: true },+ { name: "radius-x", label: "Radius X", control: "number", writable: true },+ { name: "radius-y", label: "Radius Y", control: "number", writable: true },+ { name: "softness", label: "Softness", control: "number", writable: true },+ { name: "spacing", label: "Spacing", control: "number", writable: true },+ { name: "thickness", label: "Thickness", control: "number", writable: true },+ { name: "angle", label: "Angle", control: "number", writable: true },+ { name: "travel", label: "Travel", control: "number", writable: true },+ { name: "coverage", label: "Coverage", control: "number", writable: true },+ { name: "feather", label: "Feather", control: "number", writable: true },+ { name: "from", label: "From", control: "number", writable: true },+ { name: "to", label: "To", control: "number", writable: true },+ {+ name: "direction", label: "Direction", control: "select", writable: true,+ options: ["left", "right", "up", "down"],+ },+ { name: "width", label: "Width", control: "number", writable: true },+ { name: "bars", label: "Bars", control: "number", writable: true },+ { name: "colors", label: "Colors", writable: true },+ { name: "seed", label: "Seed", control: "number", writable: true },+ { name: "amount", label: "Amount", control: "number", writable: true },+ { name: "size", label: "Size", control: "number", writable: true },+ {+ name: "chroma", label: "Chroma", control: "select", writable: true,+ options: ["monochrome", "color"],+ },+ { name: "motion-rate", label: "Motion rate", control: "number", writable: true },+ { name: "min-size", label: "Minimum size", control: "number", writable: true },+ { name: "max-size", label: "Maximum size", control: "number", writable: true },+ { name: "warmth", label: "Warmth", control: "number", writable: true },+ { name: "drift", label: "Drift", control: "number", writable: true },+ { name: "scan-lines", label: "Scan lines", control: "number", writable: true },+ { name: "z", label: "Stack", control: "number", writable: true },+ ],+ requiredValues: ["program"], project: projectOverlays,+ poster: { source: "surface-preview" },+ lane: { heightPx: 52 },+ },+];diff --git a/packages/screen-overlay/src/program.ts b/packages/screen-overlay/src/program.tsindex cb15680d..9a52599a 100644--- a/packages/screen-overlay/src/program.ts+++ b/packages/screen-overlay/src/program.ts@@ -112,6 +112,7 @@ function realized(assertScreenOverlaySet(set); assertScreenOverlayHeader(header); assertScreenOverlayItemSpec(spec);const addition = {id: window.id,+ subjectId: spec.id,span: { ...window.span },content: structuredClone(spec.content),stacking: { order: spec.stackingOrder, tieBreak: `${header.id}:${spec.id}` },@@ -143,7 +144,8 @@ export function assertScreenOverlayProgram(value: ScreenOverlayProgram): void {identity(value.id, "ScreenOverlayProgram.id"); assert(value.items.length > 0, "ScreenOverlayProgram requires Items.");const ids = new Set<string>();for (const item of value.items) {- identity(item.id, "ScreenOverlayItemProgram.id"); assert(!ids.has(item.id), `Duplicate Screen Overlay Item ${item.id}.`); ids.add(item.id);+ identity(item.id, "ScreenOverlayItemProgram.id"); identity(item.subjectId, "ScreenOverlayItemProgram.subjectId");+ assert(!ids.has(item.id), `Duplicate Screen Overlay Item ${item.id}.`); ids.add(item.id);assert(item.span.startFrame >= 0 && item.span.endFrameExclusive > item.span.startFrame,`Screen Overlay Item ${item.id} timing is invalid.`);assertScreenOverlayComponent(item.content); assert(Number.isSafeInteger(item.stacking.order) && item.stacking.tieBreak.length > 0,@@ -307,7 +309,7 @@ export function renderScreenOverlay(canvas: CanvasSpace, space: ProgramSpace, prconst track = sealVisualTrack({visualIr: "hypit.visual-ir@1", id: program.id,presents: program.items.map((item) => ({- id: item.id, span: { ...item.span }, stacking: { ...item.stacking },+ id: item.id, subjectId: item.subjectId, span: { ...item.span }, stacking: { ...item.stacking },elements: overlayElements(item.content, canvas, item.span.endFrameExclusive - item.span.startFrame),})),});diff --git a/packages/screen-overlay/src/types.ts b/packages/screen-overlay/src/types.tsindex e60793cd..0284b918 100644--- a/packages/screen-overlay/src/types.ts+++ b/packages/screen-overlay/src/types.ts@@ -55,7 +55,10 @@ export type ScreenOverlayItemSpec = {};export type ScreenOverlayHeader = { readonly id: string };export type ScreenOverlayItemProgram = {- readonly id: string; readonly span: FrameSpan;+ readonly id: string;+ /** Author-owned Item realized by this externally projected window. */+ readonly subjectId: string;+ readonly span: FrameSpan;readonly content: ScreenOverlayComponent;readonly stacking: { readonly order: number; readonly tieBreak: string };};diff --git a/packages/semantic-track/src/projection.ts b/packages/semantic-track/src/projection.tsindex a88f564a..32813082 100644--- a/packages/semantic-track/src/projection.ts+++ b/packages/semantic-track/src/projection.ts@@ -29,6 +29,7 @@ export function projectSemanticAudioTrack(track: SemanticTrack): AudioTrack {const targetEndSampleExclusive = programFrameSampleBoundary(space, endFrameExclusive, 48_000);return [{id: item.take.segment.segmentId,+ subjectId: item.take.segment.segmentId,artifact: audio.artifact,target: { startSample: targetStartSample, endSampleExclusive: targetEndSampleExclusive },source: {diff --git a/packages/speech-track-studio/README.md b/packages/speech-track-studio/README.mdnew file mode 100644index 00000000..ce43ac21--- /dev/null+++ b/packages/speech-track-studio/README.md@@ -0,0 +1,3 @@+# `@hypit/speech-track-studio`++Hypit Studio Companion for the visual and audio projections of `@hypit/speech-track`.diff --git a/packages/speech-track-studio/package.json b/packages/speech-track-studio/package.jsonnew file mode 100644index 00000000..6bfc95c5--- /dev/null+++ b/packages/speech-track-studio/package.json@@ -0,0 +1,13 @@+{+ "name": "@hypit/speech-track-studio",+ "version": "0.0.0-dev",+ "license": "SEE LICENSE IN LICENSE",+ "private": true,+ "type": "module",+ "exports": { ".": "./src/index.ts" },+ "hypit": { "activation": "./src/activation.ts" },+ "dependencies": {+ "@hypit/speech-track": "workspace:*",+ "@hypit/studio-adapter": "workspace:*"+ }+}diff --git a/packages/speech-track-studio/src/activation.ts b/packages/speech-track-studio/src/activation.tsnew file mode 100644index 00000000..1eb84d37--- /dev/null+++ b/packages/speech-track-studio/src/activation.ts@@ -0,0 +1,7 @@+import { createStudioAdapterHostFacet } from "@hypit/studio-adapter";+import { speechTrackStudioAdapters } from "./index.js";++export default {+ format: "hypit.node-package@1" as const,+ hostFacets: [createStudioAdapterHostFacet(speechTrackStudioAdapters)],+};diff --git a/packages/speech-track-studio/src/index.ts b/packages/speech-track-studio/src/index.tsnew file mode 100644index 00000000..9038b6d3--- /dev/null+++ b/packages/speech-track-studio/src/index.ts@@ -0,0 +1,104 @@+import { speechTrackMarkupSurfaces } from "@hypit/speech-track";+import type { StudioAdapter, StudioAdapterContext, StudioEntityDraft, StudioParameterDeclaration, StudioRecipeParameterDeclaration } from "@hypit/studio-adapter";+import { artifactPreview, previewLayer } from "@hypit/studio-adapter";++const frameParameters: readonly StudioParameterDeclaration[] = [+ { name: "within", label: "Within", writable: false },+ { name: "left", label: "Left", writable: true },+ { name: "top", label: "Top", writable: true },+ { name: "right", label: "Right", writable: true },+ { name: "bottom", label: "Bottom", writable: true },+ { name: "x", label: "X", writable: true },+ { name: "y", label: "Y", writable: true },+ { name: "width", label: "Width", writable: true },+ { name: "height", label: "Height", writable: true },+];++const speechVisualRecipe: readonly StudioRecipeParameterDeclaration[] = (speechTrackMarkupSurfaces[0]+ ?.vocabulary.attributes.find((attribute) => attribute.name === "visual-appearance")?.recipe ?? [])+ .map((property) => ({ name: property.name, group: "where", section: "fit" }));++type SpeechVisualTrack = {+ readonly presents?: readonly {+ readonly id: string;+ readonly subjectId?: string;+ readonly elements?: readonly {+ readonly kind?: string;+ readonly artifact?: { readonly digest?: string };+ }[];+ }[];+};++type SpeechAudioTrack = {+ readonly clips?: readonly {+ readonly id: string;+ readonly subjectId?: string;+ readonly artifact?: { readonly digest?: string };+ }[];+};++function projectSpeechVisual(context: StudioAdapterContext): readonly StudioEntityDraft[] {+ const presents = new Map(((context.track.value as SpeechVisualTrack).presents ?? [])+ .map((present) => [present.id, present] as const));+ return context.generic().map((entity) => {+ const id = entity.presentId ?? entity.authoredId;+ const present = presents.get(id);+ const subjectId = present?.subjectId;+ const artifact = present?.elements?.find((element) =>+ (element.kind === "image" || element.kind === "video") && element.artifact?.digest !== undefined)?.artifact;+ return {+ ...entity,+ authoredId: subjectId ?? id,+ ...(context.placement === undefined ? {} : { elementRange: context.placement.range }),+ display: {+ title: subjectId ?? "Speech",+ layers: artifact?.digest === undefined ? [] : [previewLayer(artifactPreview("video", artifact.digest), "storyboard")],+ },+ presentation: { entity: "media-item", chrome: "standard" },+ };+ });+}++function projectSpeechAudio(context: StudioAdapterContext): readonly StudioEntityDraft[] {+ const clips = new Map(((context.track.value as SpeechAudioTrack).clips ?? [])+ .map((clip) => [clip.id, clip] as const));+ return context.generic().map((entity) => {+ const id = entity.presentId ?? entity.authoredId;+ const clip = clips.get(id);+ const subjectId = clip?.subjectId;+ return {+ ...entity,+ authoredId: subjectId ?? id,+ display: {+ title: subjectId ?? entity.authoredId,+ layers: clip?.artifact?.digest === undefined ? [] : [previewLayer(artifactPreview("audio", clip.artifact.digest), "waveform")],+ },+ presentation: { entity: "audio-clip", chrome: "standard" },+ };+ });+}++export const speechTrackStudioAdapters: readonly StudioAdapter[] = [+ {+ id: "visual", role: "track",+ output: { type: "VisualTrack", surface: "track", modules: ["@hypit/speech-track"] },+ family: "speech-visual", tone: "blue", label: "Speech Visual", icon: "video",+ parameters: [+ { name: "visual-frame", label: "Frame", writable: false, referenced: frameParameters },+ {+ name: "visual-appearance", label: "Appearance", writable: false,+ recipe: { parameters: speechVisualRecipe },+ },+ { name: "visual-z", label: "Z", control: "number", writable: true },+ ],+ project: projectSpeechVisual,+ lane: { heightPx: 76 },+ },+ {+ id: "audio", role: "track",+ output: { type: "AudioTrack", surface: "track", modules: ["@hypit/speech-track"] },+ family: "speech-audio", tone: "green", label: "Speech Audio", icon: "waveform",+ parameters: [], project: projectSpeechAudio,+ lane: { heightPx: 48 },+ },+];diff --git a/packages/speech-track/src/projection.ts b/packages/speech-track/src/projection.tsindex bafeeb2d..31edfba3 100644--- a/packages/speech-track/src/projection.ts+++ b/packages/speech-track/src/projection.ts@@ -25,6 +25,7 @@ export function projectSpeechTrackVisual(track: SemanticTrack, set: SpeechTrackSif (visual === undefined || placement === undefined) return [];return [{id: item.take.segment.segmentId,+ subjectId: item.take.segment.segmentId,span: { startFrame, endFrameExclusive },artifact: visual.artifact,extent: { widthPx: visual.width, heightPx: visual.height },diff --git a/packages/studio-adapter/src/index.ts b/packages/studio-adapter/src/index.tsindex 8e16d479..2d8c66ed 100644--- a/packages/studio-adapter/src/index.ts+++ b/packages/studio-adapter/src/index.ts@@ -6,11 +6,30 @@ export const studioAdapterHostAbi = "hypit.studio-adapter@1";export type Range = { readonly start: number; readonly end: number };export type StudioTrackFamily = string;+export type StudioIcon =+ | "captions"+ | "component"+ | "layers"+ | "ranking"+ | "text"+ | "timeline"+ | "video"+ | "waveform";+/** Studio-owned visual palette. Domain families never become CSS selectors. */+export type StudioTimelineTone =+ | "blue"+ | "green"+ | "teal"+ | "violet"+ | "magenta"+ | "orange"+ | "orange-muted"+ | "neutral";export type StudioTimelinePresentation = {readonly entity: string;- readonly shape: string;- readonly depth: number;+ /** Studio-owned shell. It never decides whether title, time or body exists. */+ readonly chrome: "standard" | "group" | "point";};export type StudioTemporalSource = {@@ -73,16 +92,6 @@ export type StudioTemporalBinding = {readonly consumers: readonly StudioTemporalConsumer[];};-export type StudioInteraction = {- readonly select: boolean;- readonly seek: "start" | "pointer" | "none";- readonly move: boolean;- readonly trimStart: boolean;- readonly trimEnd: boolean;- readonly canvasTransform: boolean;- readonly writeback: "source" | "none";-};-export type StudioParameterControl = "text" | "number" | "boolean" | "select";export type StudioParameterLanguage = "svml" | "svs" | "svrun";@@ -121,6 +130,32 @@ export type StudioParameterDeclaration = {readonly unit?: string;/** Optional declaration for the authored element named by a reference. */readonly referenced?: readonly StudioParameterDeclaration[];+ /**+ * Companion-owned presentation and allowlist for the SVS Recipe reached+ * through this reference. Domain manifests still own property semantics;+ * they do not own an editor's pages or grouping.+ */+ readonly recipe?: StudioRecipeReferenceDeclaration;+};++/** An explicit reference path from an Inspector input to one SVS Recipe. */+export type StudioRecipeReferenceDeclaration = {+ /** Reference-valued attributes followed on local authored elements, in order. */+ readonly through?: readonly string[];+ /** Package-owned allowlist and presentation for properties of the reached Recipe. */+ readonly parameters: readonly StudioRecipeParameterDeclaration[];+};++export type StudioRecipeParameterDeclaration = {+ readonly name: string;+ readonly label?: string;+ readonly group: string;+ readonly section?: string;+ readonly summary?: string;+ readonly control?: StudioParameterControl;+ readonly writable?: boolean;+ readonly options?: readonly string[];+ readonly unit?: string;};export type StudioTimelineGesture =@@ -165,6 +200,8 @@ export type StudioEditHandle = {readonly enabled: boolean;/** Coordinate space in which the central gesture resolver measures intent. */readonly coordinate?: StudioEditCoordinate;+ /** How moving a semantic Point changes the visible entity before recompilation. */+ readonly moveEffect?: "translate-window" | "move-start";/** Snap policy is data, not a timeline-wide guess. */readonly snapTo?: readonly StudioSnapTarget[];readonly sources?: readonly StudioEditSource[];@@ -173,35 +210,84 @@ export type StudioEditHandle = {readonly disabledReason?: string;};-export type StudioMaterialPreview =- | { readonly kind: "image"; readonly url: string }- | { readonly kind: "video"; readonly url: string }- | { readonly kind: "audio"; readonly url: string };+export type StudioTimelineEditParameter = {+ readonly role: Extract<StudioEditSourceRole, "start" | "end" | "duration">;+ /** Exact Companion-declared parameter vocabulary name. */+ readonly parameter: string;+};++export type StudioTimelineEditTargetDeclaration =+ | {+ readonly kind: "semantic-source";+ readonly source: "selection" | "moment";+ readonly moveEffect?: "translate-window" | "move-start";+ }+ | {+ readonly kind: "source-parameters";+ readonly when: {+ readonly source: StudioTemporalSource["kind"];+ readonly projection?: StudioTemporalProjection["kind"];+ };+ readonly parameters: readonly StudioTimelineEditParameter[];+ }+ | {+ readonly kind: "disabled";+ readonly when: {+ readonly source: StudioTemporalSource["kind"];+ readonly projection?: StudioTemporalProjection["kind"];+ };+ readonly reason: string;+ };++/** Companion-owned inverse choices for one Studio timeline gesture. */+export type StudioTimelineEditDeclaration = {+ readonly gesture: StudioTimelineGesture;+ readonly targets: readonly StudioTimelineEditTargetDeclaration[];+};++/** A source descriptor; Companion packages never depend on Studio's HTTP routes. */+export type StudioPreviewSource =+ | { readonly kind: "artifact"; readonly digest: string }+ | {+ readonly kind: "surface-preview";+ readonly module: string;+ readonly version: string;+ readonly surface: string;+ };++export type StudioMaterialPreview = {+ readonly kind: "image" | "video" | "audio";+ readonly source: StudioPreviewSource;+};++/** Finite, composable timeline body vocabulary owned by Studio. */+export type StudioDisplayLayer =+ | {+ readonly kind: "text";+ readonly role: "content";+ readonly text: string;+ }+ | {+ readonly kind: "preview";+ readonly role: "decoration" | "content";+ readonly preview: StudioMaterialPreview;+ readonly layout: "repeat-x" | "cover" | "contain" | "storyboard" | "waveform";+ };++export type StudioEntityDisplay = {+ /** First row. Studio always places computed time immediately after it. */+ readonly title: string;+ /** Ordered back-to-front body layers. */+ readonly layers: readonly StudioDisplayLayer[];+};export type StudioLaneDescription = {- readonly layout: "flat";- readonly height: {- readonly minPx: number;- readonly preferredPx: number;- readonly maxPx: number;- };+ readonly heightPx: number;readonly groupId?: string;readonly attachedTo?: string;readonly order?: number;};-export type StudioInspectorSection =- | "authoring"- | "resolved"- | "material"- | "composition"- | "identity"- | "run";--export type StudioInspectorDescription = {- readonly sections: readonly StudioInspectorSection[];-};-export type StudioCandidateProvenance = {readonly output: string;readonly outputRef?: string;@@ -238,8 +324,9 @@ export type StudioSemanticToken = {export type StudioSemanticTimeline = {readonly presentation: {readonly family: StudioTrackFamily;+ readonly tone: StudioTimelineTone;readonly label?: string;- readonly icon: string;+ readonly icon: StudioIcon;readonly lane: StudioLaneDescription;};readonly anchors: readonly StudioSemanticAnchor[];@@ -324,13 +411,12 @@ export type StudioProjectionRole =| "semantic-take"| "semantic-track"| "realization"- | "media"- | "text"- | "caption"| "track";export type StudioSpan = {readonly id: string;+ /** Exact public terminal provenance; never inferred from id syntax. */+ readonly subjectId?: string;readonly startFrame: number;readonly endFrameExclusive: number;readonly stackOrder: number;@@ -339,7 +425,7 @@ export type StudioSpan = {export type StudioEntityDraft = {readonly id: string;readonly authoredId: string;- readonly label: string;+ readonly display: StudioEntityDisplay;readonly startFrame: number;readonly endFrameExclusive: number;readonly stackOrder: number;@@ -350,13 +436,12 @@ export type StudioEntityDraft = {/** Resolved author references that differ per derived entity, such as one Cue's actual Style. */readonly parameterReferences?: Readonly<Record<string, string>>;readonly presentation?: StudioTimelinePresentation;- readonly interaction?: StudioInteraction;readonly temporal?: StudioTemporalLineage;- readonly preview?: StudioMaterialPreview;/** Studio-local lane partition; omitted means the root lane. */readonly lane?: string;readonly parameters?: readonly StudioParameter[];- readonly editHandles?: readonly StudioEditHandle[];+ /** Optional per-entity override of the owning lane's declared inverses. */+ readonly timelineEdits?: readonly StudioTimelineEditDeclaration[];};export type StudioAdapterContext = {@@ -382,22 +467,19 @@ export type StudioAdapter = {readonly siblingType?: string;};readonly family?: StudioTrackFamily;+ /** Visual token selected from Studio's finite palette. */+ readonly tone?: StudioTimelineTone;readonly label?: string;- readonly icon?: string;+ readonly icon?: StudioIcon;/** Opts root timeline entities into the component's package-owned Surface preview. */readonly poster?: { readonly source: "surface-preview" };readonly attachments?: readonly StudioLaneAttachment[];- readonly realizationPorts?: readonly string[];- readonly dependencies?: readonly {- readonly type: string;- readonly role: StudioProjectionRole;- }[];- readonly interaction?: StudioInteraction;+ /** Same-Surface output values required to project this Track for Studio. */+ readonly requiredValues?: readonly string[];readonly lane?: StudioLaneDescription;- readonly inspector?: StudioInspectorDescription;readonly parameters?: readonly StudioParameterDeclaration[];- /** Operations this adapter explicitly understands for its entities. */- readonly timelineGestures?: readonly StudioTimelineGesture[];+ /** Exact inverse choices this adapter understands for its entities. */+ readonly timelineEdits?: readonly StudioTimelineEditDeclaration[];readonly project?: (context: StudioAdapterContext) => readonly StudioEntityDraft[];};@@ -446,31 +528,121 @@ export function studioAdaptersFromPackage(export type StudioLaneAttachment = {readonly id: string;readonly family: StudioTrackFamily;+ readonly tone?: StudioTimelineTone;readonly label?: string;- readonly icon: string;+ readonly icon: StudioIcon;readonly facet: "visual" | "audio";readonly lane: StudioLaneDescription;- readonly interaction?: StudioInteraction;- readonly inspector?: StudioInspectorDescription;readonly parameters?: readonly StudioParameterDeclaration[];- readonly timelineGestures?: readonly StudioTimelineGesture[];+ readonly timelineEdits?: readonly StudioTimelineEditDeclaration[];};-export const readonlyInteraction: StudioInteraction = {- select: true,- seek: "pointer",- move: false,- trimStart: false,- trimEnd: false,- canvasTransform: false,- writeback: "none",-};+/**+ * Reusable declaration for a component that consumes an externalized Window.+ * The Companion still binds the component's exact author parameter names.+ */+export function projectedWindowTimelineEdits(input: {+ readonly start: string;+ readonly end: string;+ readonly duration?: string;+}): readonly StudioTimelineEditDeclaration[] {+ const programWindow = { source: "program" as const };+ const momentWindow = { source: "moment" as const };+ return [+ {+ gesture: "move",+ targets: [+ { kind: "semantic-source", source: "selection", moveEffect: "translate-window" },+ { kind: "semantic-source", source: "moment", moveEffect: "translate-window" },+ {+ kind: "source-parameters", when: programWindow,+ parameters: [{ role: "start", parameter: input.start }, { role: "end", parameter: input.end }],+ },+ ],+ },+ {+ gesture: "trim-start",+ targets: [+ { kind: "semantic-source", source: "selection" },+ { kind: "disabled", when: momentWindow, reason: "起点由 Moment 决定;移动实体可以改 Moment,但不能单独裁起点。" },+ {+ kind: "source-parameters", when: programWindow,+ parameters: [{ role: "start", parameter: input.start }],+ },+ ],+ },+ {+ gesture: "trim-end",+ targets: [+ { kind: "semantic-source", source: "selection" },+ ...(input.duration === undefined ? [{+ kind: "disabled" as const, when: momentWindow,+ reason: "该 Moment 消费没有声明独立的 duration 参数。",+ }] : [{+ kind: "source-parameters" as const, when: momentWindow,+ parameters: [{ role: "duration" as const, parameter: input.duration }],+ }]),+ {+ kind: "source-parameters", when: programWindow,+ parameters: [{ role: "end", parameter: input.end }],+ },+ ...(input.duration === undefined ? [] : [{+ kind: "source-parameters" as const, when: programWindow,+ parameters: [{ role: "duration" as const, parameter: input.duration }],+ }]),+ ],+ },+ ];+}++/** Reusable declaration for a component entity activated by an externalized Point. */+export function projectedPointTimelineEdits(): readonly StudioTimelineEditDeclaration[] {+ return [{+ gesture: "move",+ targets: [{ kind: "semantic-source", source: "moment", moveEffect: "move-start" }],+ }];+}++/** A Window whose only reversible author source is an external Selection. */+export function selectionWindowTimelineEdits(): readonly StudioTimelineEditDeclaration[] {+ return (["move", "trim-start", "trim-end"] as const).map((gesture) => ({+ gesture,+ targets: [{ kind: "semantic-source", source: "selection" }],+ }));+}export function sameSurfaceValue(context: StudioAdapterContext, port: string): unknown {const ref = context.track.trace.outputPorts.find((candidate) => candidate.name === port)?.ref;return ref === undefined ? undefined : context.values.get(ref);}+export function requiredSurfaceValue(context: StudioAdapterContext, port: string): unknown {+ const value = sameSurfaceValue(context, port);+ if (value === undefined) {+ throw new Error(`Studio Companion ${context.track.type} requires same-Surface value port ${port}`);+ }+ return value;+}++export function artifactPreview(+ kind: StudioMaterialPreview["kind"],+ digest: string,+): StudioMaterialPreview {+ return { kind, source: { kind: "artifact", digest } };+}++export function previewLayer(+ preview: StudioMaterialPreview,+ layout: Extract<StudioDisplayLayer, { readonly kind: "preview" }>["layout"],+ role: Extract<StudioDisplayLayer, { readonly kind: "preview" }>["role"] = "content",+): StudioDisplayLayer {+ return { kind: "preview", role, preview, layout };+}++export function textLayer(text: string): StudioDisplayLayer {+ return { kind: "text", role: "content", text };+}+function carriesIdentity(value: unknown, id: string): boolean {return value !== null && typeof value === "object"&& !Array.isArray(value) && (value as { readonly id?: unknown }).id === id;@@ -502,31 +674,38 @@ export function temporalLineageFor(export function childEntities(context: StudioAdapterContext,- items: readonly { readonly id: string; readonly startFrame: number; readonly endFrameExclusive: number; readonly stackOrder: number }[],+ items: readonly {+ /** Exact identity of the projected domain item consumed by Temporal/renderer bindings. */+ readonly id: string;+ /** Exact author-owned entity realized by this projected item, when the identities differ. */+ readonly subjectId?: string;+ readonly startFrame: number;+ readonly endFrameExclusive: number;+ readonly stackOrder: number;+ }[],entity: StudioTimelinePresentation["entity"],- shape: StudioTimelinePresentation["shape"],+ chrome: StudioTimelinePresentation["chrome"],): readonly StudioEntityDraft[] {const children = new Map(context.placement?.children.flatMap((child) =>child.id === undefined ? [] : [[child.id, child] as const]) ?? []);return items.map((item) => {- const child = children.get(item.id) ?? [...children.entries()]- .sort(([left], [right]) => right.length - left.length)- .find(([id]) => item.id.startsWith(`${id}::`))?.[1];- // A dedicated adapter does not reverse-engineer renderer ids. Only an exact- // public identity is safe; richer renderer correspondence needs its own- // declared realization rather than another naming convention.- const render = context.spans.find((span) => span.id === item.id);+ const authoredId = item.subjectId ?? item.id;+ const child = children.get(authoredId);+ // Both correspondences are exact public facts: the Program item identity+ // and the renderer's declared subject. No renderer naming convention is+ // interpreted here.+ const renders = context.spans.filter((span) => span.id === item.id || span.subjectId === authoredId);+ const render = renders[0];return {id: `${context.track.outputRef}:entity:${item.id}`,- authoredId: child?.id ?? item.id,- label: child?.id ?? item.id,+ authoredId,+ display: { title: authoredId, layers: [] },startFrame: item.startFrame,endFrameExclusive: item.endFrameExclusive,stackOrder: item.stackOrder,...(child === undefined ? {} : { elementRange: child.range }),- ...(render === undefined ? {} : { presentId: render.id, renderIds: [render.id] }),- presentation: { entity, shape, depth: 0 },- interaction: readonlyInteraction,+ ...(render === undefined ? {} : { presentId: render.id, renderIds: renders.map((span) => span.id) }),+ presentation: { entity, chrome },};});}diff --git a/packages/studio-video-adapters/README.md b/packages/studio-video-adapters/README.mddeleted file mode 100644index 0e0976bb..00000000--- a/packages/studio-video-adapters/README.md+++ /dev/null@@ -1,13 +0,0 @@-# `@hypit/studio-video-adapters`--The official video-domain interpretation shipped with Hypit Studio: Speech,-Media, Audio, Text, Caption, Ranking and generic terminal Track fallbacks.--This package owns video-specific lane ranges, entity projection and timeline-semantics. `@hypit/studio` owns session assembly and uniform UI chrome. Author-and domain packages know neither package exists.--Temporal presentation consumes Studio's executed-graph bindings. Window-backed Items show their-actual endpoints, while Deck activations, Media Sequence terminals and triggered Ranking Items show-their actual Point expression. The adapters do not recreate projection lineage from markup or-renderer naming conventions.diff --git a/packages/studio-video-adapters/src/activation.ts b/packages/studio-video-adapters/src/activation.tsdeleted file mode 100644index e392034f..00000000--- a/packages/studio-video-adapters/src/activation.ts+++ /dev/null@@ -1,10 +0,0 @@-import { createStudioAdapterHostFacet } from "@hypit/studio-adapter";--import { videoStudioAdapters } from "./index.js";--export const hypitPackage = {- format: "hypit.node-package@1" as const,- hostFacets: [createStudioAdapterHostFacet(videoStudioAdapters)],-};--export default hypitPackage;diff --git a/packages/studio-video-adapters/src/audio.ts b/packages/studio-video-adapters/src/audio.tsdeleted file mode 100644index bf738722..00000000--- a/packages/studio-video-adapters/src/audio.ts+++ /dev/null@@ -1,63 +0,0 @@-import type { StudioAdapter, StudioAdapterContext, StudioEntityDraft } from "@hypit/studio-adapter";-import { childEntities, readonlyInteraction, sameSurfaceValue } from "@hypit/studio-adapter";-import { videoLaneHeights } from "./presentation.js";-import { itemTemporalLineage } from "./temporal.js";--type AudioTrackProgramValue = {- readonly items?: readonly {- readonly id: string;- readonly window: { readonly startFrame: number; readonly endFrameExclusive: number };- readonly source: { readonly artifact: { readonly digest: string } };- }[];-};--function projectAudio(context: StudioAdapterContext): readonly StudioEntityDraft[] {- const program = sameSurfaceValue(context, "program") as AudioTrackProgramValue | undefined;- if (program?.items === undefined) return context.generic();- const items = program.items.map((item) => ({- id: item.id, startFrame: item.window.startFrame, endFrameExclusive: item.window.endFrameExclusive,- stackOrder: Number.MIN_SAFE_INTEGER,- preview: { kind: "audio" as const, url: `/__studio/material/${item.source.artifact.digest}` },- }));- return childEntities(context, items, "audio-clip", "waveform").map((entity, index) => {- const temporal = itemTemporalLineage(context, items[index]!.id);- return {- ...entity,- preview: items[index]!.preview,- ...(temporal?.source.kind === "program" || temporal?.source.id === undefined- ? {}- : { markerId: temporal.source.id }),- ...(temporal === undefined ? {} : { temporal }),- };- });-}--export const audioAdapters: readonly StudioAdapter[] = [- { id: "audio-program", role: "realization", output: { type: "AudioTrackProgram", modules: ["@hypit/audio-track"] } },- {- id: "audio", role: "track", output: { type: "AudioTrack", surface: "track", modules: ["@hypit/audio-track"] },- family: "audio", icon: "waveform", interaction: readonlyInteraction,- timelineGestures: ["move", "trim-start", "trim-end"],- parameters: [- { name: "semantic", label: "Semantic", writable: false },- { name: "source", label: "Source", writable: false },- { name: "during", label: "During", writable: false },- { name: "selection", label: "Selection", writable: false },- { name: "moment", label: "Moment", writable: false },- { name: "start", label: "Start", writable: true },- { name: "end", label: "End", writable: true },- { name: "at", label: "At", writable: false },- { name: "for", label: "For", writable: true },- { name: "trim-start", label: "Trim source start", writable: false },- { name: "trim-end", label: "Trim source end", writable: false },- { name: "playback", label: "Playback", writable: false },- { name: "min-rate", label: "Minimum rate", control: "number", writable: false },- { name: "max-rate", label: "Maximum rate", control: "number", writable: false },- { name: "gain", label: "Gain", control: "number", writable: true },- { name: "fade-in", label: "Fade in", writable: true },- { name: "fade-out", label: "Fade out", writable: true },- ],- realizationPorts: ["program"], project: projectAudio,- lane: { layout: "flat", height: videoLaneHeights.audio },- },-];diff --git a/packages/studio-video-adapters/src/deck.ts b/packages/studio-video-adapters/src/deck.tsdeleted file mode 100644index e81ebb59..00000000--- a/packages/studio-video-adapters/src/deck.ts+++ /dev/null@@ -1,56 +0,0 @@-import type { StudioAdapter, StudioAdapterContext, StudioEntityDraft } from "@hypit/studio-adapter";-import { readonlyInteraction, sameSurfaceValue, temporalLineageFor } from "@hypit/studio-adapter";-import { videoLaneHeights } from "./presentation.js";--type DepthStackProgram = {- readonly terminalFrame: number;- readonly cards?: readonly { readonly id: string; readonly activationFrame: number }[];- readonly spec?: { readonly stackingOrder?: number };-};--function projectDeck(context: StudioAdapterContext): readonly StudioEntityDraft[] {- const program = sameSurfaceValue(context, "program") as DepthStackProgram | undefined;- if (program?.cards === undefined || context.placement === undefined) return context.generic();- const cards = program.cards;- const children = new Map(context.placement.children.flatMap((child) =>- child.id === undefined ? [] : [[child.id, child] as const]));- return cards.map((card, index): StudioEntityDraft => {- const child = children.get(card.id);- const temporal = temporalLineageFor(context, card.id, "activation");- const markerId = temporal?.source.id;- const endFrameExclusive = cards[index + 1]?.activationFrame ?? program.terminalFrame;- const render = context.spans.find((span) => span.id === card.id- || span.id.startsWith(`${card.id}:`) || span.id.startsWith(`${card.id}#`));- return {- id: `${context.track.outputRef}:entity:${card.id}`,- authoredId: card.id,- ...(markerId === undefined ? {} : { markerId }),- label: card.id.replace(/^card-/u, ""),- startFrame: card.activationFrame,- endFrameExclusive,- stackOrder: program.spec?.stackingOrder ?? render?.stackOrder ?? 0,- ...(child === undefined ? {} : { elementRange: child.range }),- ...(render === undefined ? {} : { presentId: render.id, renderIds: [render.id] }),- presentation: { entity: "deck-card", shape: "picture", depth: 0 },- ...(temporal === undefined ? {} : { temporal }),- interaction: readonlyInteraction,- };- });-}--export const deckAdapters: readonly StudioAdapter[] = [- { id: "deck-program", role: "realization", output: { type: "DepthStackProgram", modules: ["@hypit/deck-track"] } },- {- id: "deck", role: "track",- output: { type: "VisualTrack", surface: "track", modules: ["@hypit/deck-track"] },- family: "component", icon: "layers", realizationPorts: ["program"],- timelineGestures: ["move", "trim-start", "trim-end"],- parameters: [- { name: "frame", label: "Frame", writable: false },- { name: "appearance", label: "Appearance", writable: false },- { name: "until", label: "Until", writable: false },- ],- interaction: readonlyInteraction, project: projectDeck,- lane: { layout: "flat", height: videoLaneHeights.component },- },-];diff --git a/packages/studio-video-adapters/src/generic.ts b/packages/studio-video-adapters/src/generic.tsdeleted file mode 100644index 62272d77..00000000--- a/packages/studio-video-adapters/src/generic.ts+++ /dev/null@@ -1,302 +0,0 @@-import type { StudioAdapter, StudioAdapterContext, StudioEntityDraft } from "@hypit/studio-adapter";-import { childEntities, readonlyInteraction, sameSurfaceValue } from "@hypit/studio-adapter";-import { videoLaneHeights } from "./presentation.js";-import { itemTemporalLineage } from "./temporal.js";-import { frameParameters } from "./geometry.js";--type TypographyTrackProgram = {- readonly items?: readonly {- readonly id: string;- readonly span: { readonly startFrame: number; readonly endFrameExclusive: number };- readonly style: { readonly stackingOrder: number };- readonly document?: {- readonly paragraphs?: readonly {- readonly inlines?: readonly ({ readonly kind: "text"; readonly text: string } | { readonly kind: "break" })[];- }[];- };- }[];-};--function textOf(document: NonNullable<NonNullable<TypographyTrackProgram["items"]>[number]["document"]>): string {- return (document.paragraphs ?? []).map((paragraph) => (paragraph.inlines ?? [])- .map((inline) => inline.kind === "text" ? inline.text : " ")- .join(""))- .join(" ")- .replace(/\s+/gu, " ")- .trim();-}--type TerminalVisualTrack = {- readonly presents?: readonly {- readonly id: string;- readonly elements?: readonly {- readonly kind?: string;- readonly artifact?: { readonly digest?: string };- }[];- }[];-};--type TerminalAudioTrack = {- readonly clips?: readonly {- readonly id: string;- readonly artifact?: { readonly digest?: string };- }[];-};--type CaptionVisualTrack = {- readonly presents?: readonly {- readonly id: string;- readonly elements?: readonly {- readonly kind?: string;- readonly text?: string;- readonly attributes?: readonly { readonly name: string; readonly value: string }[];- }[];- }[];-};--function captionCueText(present: NonNullable<CaptionVisualTrack["presents"]>[number]): string {- return (present.elements ?? []).flatMap((element) =>- element.kind === "text"- && element.text !== undefined- && element.attributes?.some((attribute) => attribute.name === "data-caption-word") === true- ? [element.text]- : [])- .join(" ")- .replace(/([\p{Script=Han}\p{Script=Hiragana}\p{Script=Katakana}])\s+(?=[\p{Script=Han}\p{Script=Hiragana}\p{Script=Katakana}])/gu, "$1")- .trim();-}--function withTemporalLineage(- context: StudioAdapterContext,- entity: StudioEntityDraft,-): StudioEntityDraft {- const identities = [- entity.authoredId,- entity.markerId,- entity.presentId,- ...(entity.renderIds ?? []),- ].filter((value): value is string => value !== undefined);- const temporal = identities.map((identity) => itemTemporalLineage(context, identity))- .find((candidate) => candidate !== undefined);- if (temporal === undefined) return entity;- return {- ...entity,- ...(temporal.source.kind === "program" || temporal.source.id === undefined- ? {}- : { markerId: temporal.source.id }),- temporal,- };-}--/** Terminal media has one Studio treatment regardless of which package authored it. */-export function projectTerminalVisual(context: StudioAdapterContext): readonly StudioEntityDraft[] {- const presents = new Map(((context.track.value as TerminalVisualTrack).presents ?? [])- .map((present) => [present.id, present] as const));- return context.generic().map((entity) => {- const present = entity.presentId === undefined ? undefined : presents.get(entity.presentId);- const material = present?.elements?.find((element) =>- (element.kind === "image" || element.kind === "video") && element.artifact?.digest !== undefined);- const digest = material?.artifact?.digest;- return withTemporalLineage(context, {- ...entity,- presentation: { entity: "media-item", shape: "picture", depth: 0 },- ...(digest === undefined ? {} : {- preview: {- kind: material?.kind === "image" ? "image" as const : "video" as const,- url: `/__studio/material/${digest}`,- },- }),- });- });-}--export function projectTerminalAudio(context: StudioAdapterContext): readonly StudioEntityDraft[] {- const clips = new Map(((context.track.value as TerminalAudioTrack).clips ?? [])- .map((clip) => [clip.id, clip] as const));- return context.generic().map((entity, index) => {- const digest = clips.get(context.spans[index]?.id ?? "")?.artifact?.digest;- return withTemporalLineage(context, {- ...entity,- presentation: { entity: "audio-clip", shape: "waveform", depth: 0 },- ...(digest === undefined ? {} : {- preview: { kind: "audio" as const, url: `/__studio/material/${digest}` },- }),- });- });-}--function projectText(context: StudioAdapterContext): readonly StudioEntityDraft[] {- const program = sameSurfaceValue(context, "program") as TypographyTrackProgram | undefined;- if (program?.items === undefined) return context.generic();- const items = program.items.map((item) => ({- id: item.id,- startFrame: item.span.startFrame,- endFrameExclusive: item.span.endFrameExclusive,- stackOrder: item.style.stackingOrder,- }));- return childEntities(context, items, "typography-item", "text").map((entity, index) => {- const item = items[index];- if (item === undefined) return entity;- const document = program.items?.[index]?.document;- const label = document === undefined ? "" : textOf(document);- const temporal = itemTemporalLineage(context, item.id);- const named = {- ...entity,- ...(label.length === 0 ? {} : { label }),- ...(temporal?.source.kind === "program" || temporal?.source.id === undefined ? {} : { markerId: temporal.source.id }),- };- return temporal === undefined ? named : { ...named, temporal };- });-}--function projectCaption(context: StudioAdapterContext): readonly StudioEntityDraft[] {- const cues = new Map(((context.track.value as CaptionVisualTrack).presents ?? []).map((present) => [- present.id,- {- label: captionCueText(present),- style: present.elements?.flatMap((element) => element.attributes ?? [])- .find((attribute) => attribute.name === "data-caption-style")?.value,- },- ] as const));- return context.generic().map((entity) => {- const cue = entity.presentId === undefined ? undefined : cues.get(entity.presentId);- return withTemporalLineage(context, {- ...entity,- ...(cue?.label === undefined || cue.label.length === 0 ? {} : { label: cue.label }),- presentation: { entity: "caption-cue", shape: "text", depth: 0 },- interaction: readonlyInteraction,- ...(cue?.style === undefined ? {} : { parameterReferences: { program: cue.style } }),- });- });-}--function projectGenericComponent(context: StudioAdapterContext): readonly StudioEntityDraft[] {- return context.generic().map((entity) => withTemporalLineage(context, entity));-}--export const genericAdapters: readonly StudioAdapter[] = [- { id: "typography-program", role: "realization", output: { type: "TypographyTrackProgram", modules: ["@hypit/typography-track"] } },- {- id: "text", role: "text", output: { type: "VisualTrack", surface: "track", modules: ["@hypit/typography-track"] },- family: "text", icon: "text", interaction: readonlyInteraction,- timelineGestures: ["move", "trim-start", "trim-end"],- parameters: [- { name: "semantic", label: "Semantic", writable: false },- { name: "placement", label: "Placement", writable: false },- { name: "content", label: "Content", writable: false },- { name: "during", label: "During", writable: false },- { name: "selection", label: "Selection", writable: false },- { name: "moment", label: "Moment", writable: false },- { name: "start", label: "Start", writable: true },- { name: "end", label: "End", writable: true },- { name: "at", label: "At", writable: false },- { name: "for", label: "For", writable: true },- { name: "style", label: "Style", writable: false },- { name: "motion", label: "Motion", writable: false },- ],- realizationPorts: ["program"], project: projectText,- lane: { layout: "flat", height: videoLaneHeights.text },- },- {- id: "caption", role: "caption", output: { type: "VisualTrack", surface: "track", modules: ["@hypit/caption-fine"] },- family: "caption", icon: "captions", interaction: readonlyInteraction,- timelineGestures: ["move", "trim-start", "trim-end"],- parameters: [- { name: "document", label: "Document", writable: false },- { name: "semantic", label: "Semantic", writable: false },- { name: "program", label: "Program", writable: false },- { name: "during", label: "During", writable: false },- { name: "start", label: "Start", writable: true },- { name: "end", label: "End", writable: true },- { name: "at", label: "At", writable: false },- { name: "for", label: "For", writable: true },- { name: "style", label: "Style", writable: false },- ],- project: projectCaption,- lane: { layout: "flat", height: videoLaneHeights.text },- },- {- id: "component", role: "track",- output: { type: "VisualTrack", modules: ["@hypit/ranking", "@hypit/comment-sticker", "@hypit/screen-overlay"] },- family: "component", icon: "component", interaction: readonlyInteraction,- timelineGestures: ["move", "trim-start", "trim-end"],- parameters: [- { name: "canvas", label: "Canvas", writable: false },- { name: "semantic", label: "Semantic", writable: false },- { name: "frame", label: "Frame", writable: false, referenced: frameParameters },- { name: "during", label: "During", writable: false },- { name: "start", label: "Start", writable: true },- { name: "end", label: "End", writable: true },- { name: "at", label: "At", writable: false },- { name: "for", label: "For", writable: true },- { name: "until", label: "Until", writable: false },- { name: "z", label: "Z", control: "number", writable: true },- { name: "placement", label: "Placement", writable: false, referenced: frameParameters },- { name: "appearance", label: "Appearance", writable: false },- { name: "motion", label: "Motion", writable: false },- { name: "style", label: "Style", writable: false },- { name: "program", label: "Program", writable: false },- { name: "source", label: "Source", writable: false },- { name: "icon", label: "Icon", writable: false },- { name: "label", label: "Label", writable: true },- { name: "rank", label: "Rank", control: "number", writable: true },- { name: "color", label: "Color", writable: true },- { name: "intensity", label: "Intensity", control: "number", writable: true },- { name: "opacity", label: "Opacity", control: "number", writable: true },- { name: "attack", label: "Attack", control: "number", writable: true, unit: "f" },- { name: "hold", label: "Hold", control: "number", writable: true, unit: "f" },- { name: "decay", label: "Decay", control: "number", writable: true, unit: "f" },- { name: "gain", label: "Gain", control: "number", writable: true },- { name: "fade-in", label: "Fade in", control: "number", writable: true, unit: "f" },- { name: "fade-out", label: "Fade out", control: "number", writable: true, unit: "f" },- { name: "center-x", label: "Center X", control: "number", writable: true },- { name: "center-y", label: "Center Y", control: "number", writable: true },- { name: "radius-x", label: "Radius X", control: "number", writable: true },- { name: "radius-y", label: "Radius Y", control: "number", writable: true },- { name: "softness", label: "Softness", control: "number", writable: true },- { name: "spacing", label: "Spacing", control: "number", writable: true },- { name: "thickness", label: "Thickness", control: "number", writable: true },- { name: "angle", label: "Angle", control: "number", writable: true },- { name: "direction", label: "Direction", writable: true },- { name: "seed", label: "Seed", control: "number", writable: true },- { name: "amount", label: "Amount", control: "number", writable: true },- { name: "noise-size", label: "Noise size", control: "number", writable: true },- { name: "scan-line-opacity", label: "Scan-line opacity", control: "number", writable: true },- { name: "motion-rate", label: "Motion rate", control: "number", writable: true },- ],- project: projectGenericComponent,- lane: { layout: "flat", height: videoLaneHeights.component },- },- { id: "audio-track", role: "track", output: { type: "AudioTrack" }, family: "audio", icon: "waveform", interaction: readonlyInteraction,- timelineGestures: ["move", "trim-start", "trim-end"],- parameters: [- { name: "semantic", label: "Semantic", writable: false },- { name: "during", label: "During", writable: false },- { name: "start", label: "Start", writable: true },- { name: "end", label: "End", writable: true },- { name: "at", label: "At", writable: false },- { name: "for", label: "For", writable: true },- { name: "selection", label: "Selection", writable: false },- { name: "moment", label: "Moment", writable: false },- { name: "source", label: "Source", writable: false },- { name: "trim-start", label: "Trim source start", writable: false },- { name: "trim-end", label: "Trim source end", writable: false },- { name: "playback", label: "Playback", writable: false },- { name: "min-rate", label: "Minimum rate", control: "number", writable: false },- { name: "max-rate", label: "Maximum rate", control: "number", writable: false },- { name: "gain", label: "Gain", control: "number", writable: true },- { name: "fade-in", label: "Fade in", writable: true },- { name: "fade-out", label: "Fade out", writable: true },- ],- project: projectTerminalAudio, lane: { layout: "flat", height: videoLaneHeights.audio } },- { id: "visual-track", role: "track", output: { type: "VisualTrack" }, family: "media", icon: "video", interaction: readonlyInteraction,- timelineGestures: ["move", "trim-start", "trim-end"],- parameters: [- { name: "during", label: "During", writable: false },- { name: "start", label: "Start", writable: true },- { name: "end", label: "End", writable: true },- { name: "at", label: "At", writable: false },- { name: "for", label: "For", writable: true },- ],- project: projectTerminalVisual, lane: { layout: "flat", height: videoLaneHeights.picture } },-];diff --git a/packages/studio-video-adapters/src/geometry.ts b/packages/studio-video-adapters/src/geometry.tsdeleted file mode 100644index 4cf3ca6a..00000000--- a/packages/studio-video-adapters/src/geometry.ts+++ /dev/null@@ -1,23 +0,0 @@-import type { StudioParameterDeclaration } from "@hypit/studio-adapter";--/**- * A reference such as `frame={card-frame}` is not itself writable. Its- * authored Frame is, so the Inspector expands these fields without inventing- * a second geometry object in Studio.- */-export const frameParameters: readonly StudioParameterDeclaration[] = [- { name: "within", label: "Within", writable: false },- { name: "left", label: "Left", writable: true },- { name: "top", label: "Top", writable: true },- { name: "right", label: "Right", writable: true },- { name: "bottom", label: "Bottom", writable: true },- { name: "x", label: "X", writable: true },- { name: "y", label: "Y", writable: true },- { name: "width", label: "Width", writable: true },- { name: "height", label: "Height", writable: true },-];--export const extentParameters: readonly StudioParameterDeclaration[] = [- { name: "width", label: "Width", control: "number", writable: true, unit: "px" },- { name: "height", label: "Height", control: "number", writable: true, unit: "px" },-];diff --git a/packages/studio-video-adapters/src/index.ts b/packages/studio-video-adapters/src/index.tsdeleted file mode 100644index 5198cbff..00000000--- a/packages/studio-video-adapters/src/index.ts+++ /dev/null@@ -1,26 +0,0 @@-import type { StudioAdapter } from "@hypit/studio-adapter";--import { audioAdapters } from "./audio.js";-import { deckAdapters } from "./deck.js";-import { genericAdapters } from "./generic.js";-import { mediaAdapters } from "./media.js";-import { rankingAdapters } from "./ranking.js";-import { speechAdapters } from "./speech.js";--/** Official video-domain interpretation, selected by the Studio distribution. */-export const videoStudioAdapters: readonly StudioAdapter[] = [- ...rankingAdapters,- ...deckAdapters,- ...speechAdapters,- ...mediaAdapters,- ...audioAdapters,- ...genericAdapters,-];--export { audioAdapters } from "./audio.js";-export { deckAdapters } from "./deck.js";-export { genericAdapters } from "./generic.js";-export { mediaAdapters } from "./media.js";-export { rankingAdapters } from "./ranking.js";-export { speechAdapters } from "./speech.js";-export { videoLaneHeights } from "./presentation.js";diff --git a/packages/studio-video-adapters/src/media.ts b/packages/studio-video-adapters/src/media.tsdeleted file mode 100644index 2a29ab3b..00000000--- a/packages/studio-video-adapters/src/media.ts+++ /dev/null@@ -1,165 +0,0 @@-import type { StudioAdapter, StudioAdapterContext, StudioEntityDraft } from "@hypit/studio-adapter";-import { childEntities, readonlyInteraction, sameSurfaceValue } from "@hypit/studio-adapter";-import { videoLaneHeights } from "./presentation.js";-import { itemTemporalLineage } from "./temporal.js";-import { extentParameters, frameParameters } from "./geometry.js";--type MediaTrackProgramValue = {- readonly items?: readonly {- readonly id: string;- readonly span: { readonly startFrame: number; readonly endFrameExclusive: number };- readonly stacking: { readonly order: number };- readonly layers?: readonly MediaLayerValue[];- readonly sourceAudio?: { readonly fromLayer: string };- }[];- readonly sequences?: readonly {- readonly id: string;- readonly span: { readonly startFrame: number; readonly endFrameExclusive: number };- readonly stacking: { readonly order: number };- readonly members?: readonly {- readonly layers?: readonly MediaLayerValue[];- readonly sourceAudio?: { readonly fromLayer: string };- }[];- }[];-};--type MediaLayerValue = {- readonly id?: string;- readonly kind?: string;- readonly source?: {- readonly kind?: string;- readonly artifact?: { readonly digest?: string; readonly mediaType?: string };- readonly audio?: { readonly artifact?: { readonly digest?: string; readonly mediaType?: string } };- };-};--function materialPreview(- layers: readonly MediaLayerValue[] | undefined,- facet: "visual" | "audio",- audioFromLayer?: string,-): StudioEntityDraft["preview"] {- const layer = layers?.find((candidate) => candidate.kind === "sample"- && (facet === "visual" || audioFromLayer === undefined || candidate.id === audioFromLayer));- const source = layer?.source;- if (facet === "audio") {- const artifact = source?.audio?.artifact;- return artifact?.digest === undefined- ? undefined- : { kind: "audio", url: `/__studio/material/${artifact.digest}` };- }- const artifact = source?.artifact;- if (artifact?.digest === undefined) return undefined;- if (source?.kind === "still") return { kind: "image", url: `/__studio/material/${artifact.digest}` };- if (source?.kind === "timed") return { kind: "video", url: `/__studio/material/${artifact.digest}` };- return undefined;-}--function projectMedia(context: StudioAdapterContext): readonly StudioEntityDraft[] {- const program = sameSurfaceValue(context, "program") as MediaTrackProgramValue | undefined;- if (program === undefined) return context.generic();- const facet = context.track.type === "AudioTrack" ? "audio" : "visual";- const items = [- ...(program.items ?? []).map((item) => ({- id: item.id, startFrame: item.span.startFrame, endFrameExclusive: item.span.endFrameExclusive,- stackOrder: item.stacking.order, preview: materialPreview(item.layers, facet, item.sourceAudio?.fromLayer),- temporalInput: "window",- })),- ...(program.sequences ?? []).map((item) => ({- id: item.id, startFrame: item.span.startFrame, endFrameExclusive: item.span.endFrameExclusive,- stackOrder: item.stacking.order,- preview: materialPreview(item.members?.[0]?.layers, facet, item.members?.[0]?.sourceAudio?.fromLayer),- temporalInput: "terminal",- })),- ];- return childEntities(context, items, "media-item",- context.track.type === "AudioTrack" ? "waveform" : "picture").map((entity, index) => {- const item = items[index];- if (item === undefined) return entity;- const temporal = itemTemporalLineage(context, item.id, item.temporalInput);- return {- ...entity,- ...(temporal?.source.kind === "program" || temporal?.source.id === undefined ? {} : { markerId: temporal.source.id }),- ...(item.preview === undefined ? {} : { preview: item.preview }),- ...(temporal === undefined ? {} : { temporal }),- };- });-}--export const mediaAdapters: readonly StudioAdapter[] = [- { id: "media-program", role: "realization", output: { type: "MediaTrackProgram", modules: ["@hypit/media-track"] } },- {- id: "media-visual", role: "media",- output: { type: "VisualTrack", surface: "track", modules: ["@hypit/media-track"] },- family: "media", icon: "video", interaction: readonlyInteraction,- timelineGestures: ["move", "trim-start", "trim-end"],- parameters: [- { name: "semantic", label: "Semantic", writable: false },- { name: "canvas", label: "Canvas", writable: false },- { name: "during", label: "During", writable: false },- { name: "segment", label: "Segment", writable: false },- { name: "selection", label: "Selection", writable: false },- { name: "moment", label: "Moment", writable: false },- { name: "start", label: "Start", writable: true },- { name: "end", label: "End", writable: true },- { name: "at", label: "At", writable: false },- { name: "for", label: "For", writable: true },- { name: "source", label: "Source", writable: false },- { name: "source-audio", label: "Source audio", writable: true },- { name: "extent", label: "Extent", writable: false, referenced: extentParameters },- { name: "fit", label: "Fit", writable: false },- { name: "clip", label: "Clip", writable: false },- { name: "image", label: "Image", writable: false },- { name: "video", label: "Video", writable: false },- { name: "media", label: "Media", writable: false },- { name: "surface", label: "Surface", writable: false },- { name: "sample-spec", label: "Sample spec", writable: false },- { name: "item-spec", label: "Item spec", writable: false },- { name: "window-spec", label: "Window spec", writable: false },- { name: "audio", label: "Audio", writable: true },- { name: "audio-gain", label: "Audio gain", control: "number", writable: true },- { name: "trim-start", label: "Trim source start", writable: false },- { name: "trim-end", label: "Trim source end", writable: false },- { name: "playback", label: "Playback", writable: false },- { name: "min-rate", label: "Minimum rate", control: "number", writable: false },- { name: "max-rate", label: "Maximum rate", control: "number", writable: false },- { name: "frame", label: "Frame", writable: false, referenced: frameParameters },- { name: "appearance", label: "Appearance", writable: false },- { name: "motion", label: "Motion", writable: false },- ],- realizationPorts: ["program"], project: projectMedia,- lane: { layout: "flat", height: videoLaneHeights.picture },- },- {- id: "media-audio", role: "media",- output: { type: "AudioTrack", surface: "track", modules: ["@hypit/media-track"] },- family: "media", icon: "waveform", interaction: readonlyInteraction,- timelineGestures: ["move", "trim-start", "trim-end"],- parameters: [- { name: "semantic", label: "Semantic", writable: false },- { name: "canvas", label: "Canvas", writable: false },- { name: "during", label: "During", writable: false },- { name: "selection", label: "Selection", writable: false },- { name: "moment", label: "Moment", writable: false },- { name: "start", label: "Start", writable: true },- { name: "end", label: "End", writable: true },- { name: "at", label: "At", writable: false },- { name: "for", label: "For", writable: true },- { name: "source", label: "Source", writable: false },- { name: "sample-spec", label: "Sample spec", writable: false },- { name: "item-spec", label: "Item spec", writable: false },- { name: "window-spec", label: "Window spec", writable: false },- { name: "source-audio", label: "Source audio", writable: true },- { name: "audio-gain", label: "Audio gain", control: "number", writable: true },- { name: "trim-start", label: "Trim source start", writable: false },- { name: "trim-end", label: "Trim source end", writable: false },- { name: "playback", label: "Playback", writable: false },- { name: "min-rate", label: "Minimum rate", control: "number", writable: false },- { name: "max-rate", label: "Maximum rate", control: "number", writable: false },- { name: "gain", label: "Gain", control: "number", writable: true },- { name: "fade-in", label: "Fade in", writable: true },- { name: "fade-out", label: "Fade out", writable: true },- ],- realizationPorts: ["program"], project: projectMedia,- lane: { layout: "flat", height: videoLaneHeights.audio },- },-];diff --git a/packages/studio-video-adapters/src/presentation.ts b/packages/studio-video-adapters/src/presentation.tsdeleted file mode 100644index 219233a5..00000000--- a/packages/studio-video-adapters/src/presentation.ts+++ /dev/null@@ -1,10 +0,0 @@-/** Official video-domain lane ranges. These are not part of the stable Adapter ABI. */-export const videoLaneHeights = {- // The semantic ruler is a three-band group. Each band matches the ordinary- // item's first row; the group therefore occupies three such rows.- semantic: { minPx: 45, preferredPx: 45, maxPx: 45 },- picture: { minPx: 60, preferredPx: 76, maxPx: 128 },- audio: { minPx: 40, preferredPx: 48, maxPx: 88 },- text: { minPx: 42, preferredPx: 48, maxPx: 72 },- component: { minPx: 44, preferredPx: 52, maxPx: 96 },-} as const;diff --git a/packages/studio-video-adapters/src/ranking.ts b/packages/studio-video-adapters/src/ranking.tsdeleted file mode 100644index 7c3c4316..00000000--- a/packages/studio-video-adapters/src/ranking.ts+++ /dev/null@@ -1,180 +0,0 @@-import type { StudioAdapter, StudioAdapterContext, StudioEntityDraft } from "@hypit/studio-adapter";-import { readonlyInteraction, temporalLineageFor } from "@hypit/studio-adapter";-import { frameParameters } from "./geometry.js";--type RankingSchedule = {- readonly variant?: string;- readonly outer?: { readonly startFrame: number; readonly endFrameExclusive: number };- readonly terminalFrame?: number;- readonly entries?: readonly ({ readonly itemId: string; readonly mode: "preset"; readonly settled: Span } | {- readonly itemId: string;- readonly mode: "reveal";- readonly window: Span;- readonly settled: Span;- } | {- readonly itemId: string;- readonly triggerFrame: number;- readonly stage: Span;- readonly cumulative: Span;- readonly settled: Span;- })[];-};--type Span = { readonly startFrame: number; readonly endFrameExclusive: number };--type RankingVisualElement = {- readonly kind?: string;- readonly artifact?: { readonly digest?: string; readonly mediaType?: string };-};--type RankingVisualTrack = {- readonly presents?: readonly {- readonly id: string;- readonly elements?: readonly RankingVisualElement[];- }[];-};--function itemPreview(- context: StudioAdapterContext,- itemId: string,-): StudioEntityDraft["preview"] | undefined {- const track = context.track.value as RankingVisualTrack;- const present = track.presents?.find((candidate) => candidate.id.includes(`:item:${itemId}:`));- const artifact = present?.elements?.find((element) => element.kind === "image")?.artifact;- if (artifact?.digest === undefined) return undefined;- return artifact.mediaType?.startsWith("video/") === true- ? { kind: "video", url: `/__studio/material/${artifact.digest}` }- : { kind: "image", url: `/__studio/material/${artifact.digest}` };-}--/** Column entities come from the public resolved Schedule, never renderer id conventions. */-function projectRanking(context: StudioAdapterContext): readonly StudioEntityDraft[] {- const placement = context.placement;- const scheduleRef = context.track.trace.outputPorts.find((port) => port.name === "schedule")?.ref;- const schedule = scheduleRef === undefined ? undefined : context.values.get(scheduleRef) as RankingSchedule | undefined;- if (placement === undefined || schedule?.outer === undefined) return context.generic();- const boardId = placement.id ?? context.track.outputRef;- const parent = `${context.track.outputRef}:entity:${boardId}`;- const outerTemporal = temporalLineageFor(context, boardId, "outer");- const outerMarkerId = outerTemporal?.source.id;- const group: StudioEntityDraft = {- id: parent,- authoredId: boardId,- ...(outerMarkerId === undefined ? {} : { markerId: outerMarkerId }),- label: boardId,- startFrame: schedule.outer.startFrame,- endFrameExclusive: schedule.outer.endFrameExclusive,- stackOrder: Math.max(...context.spans.map((span) => span.stackOrder), 0),- elementRange: placement.range,- renderIds: context.spans.map((span) => span.id),- presentation: { entity: "ranking", shape: "group", depth: 0 },- ...(outerTemporal === undefined ? {} : { temporal: outerTemporal }),- interaction: readonlyInteraction,- };- const children = new Map(placement.children.flatMap((child) =>- child.id === undefined ? [] : [[child.id, child] as const]));- const reveals = (schedule.entries ?? []).flatMap((entry): readonly StudioEntityDraft[] => {- if ("mode" in entry && entry.mode !== "reveal") return [];- const child = children.get(entry.itemId);- const temporal = temporalLineageFor(context, entry.itemId, "mode" in entry ? "window" : "activation");- const markerId = temporal?.source.id;- const preview = itemPreview(context, entry.itemId);- const visible = "mode" in entry ? entry.window : entry.cumulative;- return [{- id: `${context.track.outputRef}:entity:${entry.itemId}`,- authoredId: entry.itemId,- ...(markerId === undefined ? {} : { markerId }),- label: child?.attributes.label ?? entry.itemId,- startFrame: visible.startFrame,- endFrameExclusive: visible.endFrameExclusive,- stackOrder: group.stackOrder + 1,- ...(child === undefined ? {} : { elementRange: child.range }),- ...(preview === undefined ? {} : { preview }),- lane: "mode" in entry ? "reveal" : "activation",- presentation: { entity: "ranking-reveal", shape: "picture", depth: 0 },- ...(temporal === undefined ? {} : { temporal }),- interaction: readonlyInteraction,- }];- }).sort((left, right) => left.startFrame - right.startFrame || left.id.localeCompare(right.id));- return [group, ...reveals];-}--export const rankingAdapters: readonly StudioAdapter[] = [- { id: "ranking-schedule", role: "realization", output: { type: "RankingSchedule", modules: ["@hypit/ranking"] } },- {- id: "ranking-column", role: "track",- output: { type: "VisualTrack", surface: "column", modules: ["@hypit/ranking"] },- family: "component", label: "Ranking", icon: "ranking", realizationPorts: ["schedule"],- timelineGestures: ["move", "trim-start", "trim-end"],- parameters: [- { name: "semantic", label: "Semantic", writable: false },- { name: "canvas", label: "Canvas", writable: false },- { name: "style", label: "Style", writable: false },- { name: "during", label: "During", writable: false },- { name: "start", label: "Start", writable: true },- { name: "end", label: "End", writable: true },- { name: "at", label: "At", writable: false },- { name: "for", label: "For", writable: true },- { name: "frame", label: "Frame", writable: false, referenced: frameParameters },- { name: "appear-sound", label: "Appear sound", writable: false },- { name: "move-sound", label: "Move sound", writable: false },- { name: "label", label: "Label", writable: true },- { name: "rank", label: "Rank", control: "number", writable: true },- { name: "preset", label: "Preset", control: "boolean", writable: true },- { name: "icon", label: "Icon", writable: false },- { name: "stack", label: "Stack", control: "number", writable: true },- ],- poster: { source: "surface-preview" },- lane: {- layout: "flat",- height: { minPx: 64, preferredPx: 80, maxPx: 112 },- groupId: "ranking-reveals",- },- attachments: [{- id: "reveal",- family: "ranking-reveal",- label: "Reveals",- icon: "ranking",- facet: "visual",- lane: {- layout: "flat",- height: { minPx: 34, preferredPx: 40, maxPx: 56 },- },- parameters: [- { name: "during", label: "During", writable: false },- ],- timelineGestures: ["move", "trim-start", "trim-end"],- }],- interaction: readonlyInteraction, project: projectRanking,- },- ...([[- "ranking-tier", "tier", "Tier Board",- ], [- "ranking-top-three", "top-three", "Top Three",- ]] as const).map(([id, surface, label]): StudioAdapter => ({- id, role: "track",- output: { type: "VisualTrack", surface, modules: ["@hypit/ranking"] },- family: "component", label, icon: "ranking", realizationPorts: ["schedule"],- timelineGestures: ["move", "trim-start", "trim-end"],- parameters: [- { name: "semantic", label: "Semantic", writable: false },- { name: "style", label: "Style", writable: false },- { name: "during", label: "During", writable: false },- { name: "terminal", label: "Terminal", writable: false },- { name: "at", label: "At", writable: false },- { name: "frame", label: "Frame", writable: false, referenced: frameParameters },- { name: "label", label: "Label", writable: true },- { name: "icon", label: "Icon", writable: false },- ],- poster: { source: "surface-preview" },- lane: { layout: "flat", height: { minPx: 64, preferredPx: 80, maxPx: 112 }, groupId: `${id}-activations` },- attachments: [{- id: "activation", family: "ranking-reveal", label: "Activations", icon: "ranking", facet: "visual",- lane: { layout: "flat", height: { minPx: 34, preferredPx: 40, maxPx: 56 } },- parameters: [{ name: "at", label: "At", writable: false }],- timelineGestures: ["move", "trim-start", "trim-end"],- }],- interaction: readonlyInteraction,- project: projectRanking,- })),-];diff --git a/packages/studio-video-adapters/src/speech.ts b/packages/studio-video-adapters/src/speech.tsdeleted file mode 100644index e0243299..00000000--- a/packages/studio-video-adapters/src/speech.ts+++ /dev/null@@ -1,58 +0,0 @@-import type { StudioAdapter, StudioAdapterContext, StudioEntityDraft } from "@hypit/studio-adapter";-import { readonlyInteraction } from "@hypit/studio-adapter";-import { projectTerminalAudio, projectTerminalVisual } from "./generic.js";-import { videoLaneHeights } from "./presentation.js";-import { frameParameters } from "./geometry.js";--function renameSpeechSegments(- context: StudioAdapterContext,- entities: readonly StudioEntityDraft[],-): readonly StudioEntityDraft[] {- return entities.map((entity) => {- const segment = context.semantic.segments.find((candidate) =>- candidate.startFrame === entity.startFrame- && candidate.endFrameExclusive === entity.endFrameExclusive,- );- if (segment === undefined) return entity;- return { ...entity, authoredId: segment.id, label: segment.id };- });-}--function projectSpeechVisual(context: StudioAdapterContext): readonly StudioEntityDraft[] {- return renameSpeechSegments(context, projectTerminalVisual(context));-}--function projectSpeechAudio(context: StudioAdapterContext): readonly StudioEntityDraft[] {- return renameSpeechSegments(context, projectTerminalAudio(context));-}--export const speechAdapters: readonly StudioAdapter[] = [- { id: "semantic-take", role: "semantic-take", output: { type: "SemanticTake" } },- {- id: "semantic-track", role: "semantic-track", output: { type: "SemanticTrack" },- family: "speech", label: "Semantic", icon: "timeline",- lane: { layout: "flat", height: videoLaneHeights.semantic },- },- {- id: "speech-visual", role: "media",- output: { type: "VisualTrack", surface: "track", modules: ["@hypit/speech-track"] },- family: "media", label: "Speech Visual", icon: "video",- interaction: readonlyInteraction,- parameters: [- { name: "visual-frame", label: "Frame", writable: false, referenced: frameParameters },- { name: "visual-appearance", label: "Appearance", writable: false },- { name: "visual-z", label: "Z", control: "number", writable: true },- ],- project: projectSpeechVisual,- lane: { layout: "flat", height: videoLaneHeights.picture },- },- {- id: "speech-audio", role: "media",- output: { type: "AudioTrack", surface: "track", modules: ["@hypit/speech-track"] },- family: "audio", label: "Speech Audio", icon: "waveform",- interaction: readonlyInteraction,- parameters: [],- project: projectSpeechAudio,- lane: { layout: "flat", height: videoLaneHeights.audio },- },-];diff --git a/packages/studio-video-adapters/src/temporal.ts b/packages/studio-video-adapters/src/temporal.tsdeleted file mode 100644index 2ef1e9aa..00000000--- a/packages/studio-video-adapters/src/temporal.ts+++ /dev/null@@ -1,11 +0,0 @@-import type { StudioAdapterContext, StudioTemporalLineage } from "@hypit/studio-adapter";-import { temporalLineageFor } from "@hypit/studio-adapter";--/** Resolve a domain item's Window from the executed edge that consumed it. */-export function itemTemporalLineage(- context: StudioAdapterContext,- runtimeId: string,- input = "window",-): StudioTemporalLineage | undefined {- return temporalLineageFor(context, runtimeId, input);-}diff --git a/packages/studio/README.md b/packages/studio/README.mdindex 2af12d7f..f362ba81 100644--- a/packages/studio/README.md+++ b/packages/studio/README.md@@ -23,8 +23,8 @@ folder structure is involved. With no selected Runtime, Source and Preview stillwork while Tasks and Artifacts stay explicitly unavailable.Studio is an application boundary. Core and domain packages do not import it or-register UI metadata. The installed Distribution supplies the official Studio Adapter-distribution. An external project may explicitly add companion Adapter packages+register UI metadata. The installed Distribution explicitly selects one independent+Studio Companion per supported official domain. An external project may add companion Adapter packagesthrough `hypit.studio.json`; the application assembles one immutable registry forthat project session.@@ -44,8 +44,12 @@ Companion manifests may declare `@hypit/studio-adapter` as a peer dependency foreditor/package-manager clarity; the active tool Distribution supplies that ABI atruntime, so the project does not install or lock another copy.-The companion owns what its Track means: matching, entities, lane range,-material projection, inspector sections and declared interaction/writeback.+The companion owns what its Track means: matching, required same-Surface values,+entities, lane range, finite chrome, title and ordered text/material layers,+Inspector parameter grouping and exact timeline inverses. Material layers carry an+Artifact digest or Surface identity, never a Studio HTTP URL. Studio always owns+time formatting and transport resolution, so chrome and material cannot hide a+title or its time.Studio owns session-wide behavior and chrome: adapter selection, collision andreplacement rules, fallback defaults, selection treatment, playback, zoom,scrolling and source mutation transport. A companion cannot ship arbitrary DOMdiff --git a/packages/studio/package.json b/packages/studio/package.jsonindex c96bd234..a470edeb 100644--- a/packages/studio/package.json+++ b/packages/studio/package.json@@ -8,26 +8,34 @@"./preview-check": "./preview-check.ts"},"dependencies": {+ "@hypit/audio-track-studio": "workspace:*",+ "@hypit/caption-fine-studio": "workspace:*","@hypit/cli": "workspace:*","@hypit/compiler-node": "workspace:*","@hypit/component-kit": "workspace:*","@hypit/composition": "workspace:*",+ "@hypit/comment-sticker-studio": "workspace:*","@hypit/core": "workspace:*","@hypit/driver-node": "workspace:*",+ "@hypit/deck-track-studio": "workspace:*","@hypit/elaborator": "workspace:*","@hypit/hyperframes": "workspace:*","@hypit/markup": "workspace:*",+ "@hypit/media-track-studio": "workspace:*","@hypit/package-loader-node": "workspace:*","@hypit/program-space": "workspace:*","@hypit/protocol": "workspace:*",+ "@hypit/ranking-studio": "workspace:*","@hypit/run": "workspace:*","@hypit/runtime": "workspace:*","@hypit/runtime-host-node": "workspace:*","@hypit/script": "workspace:*",+ "@hypit/screen-overlay-studio": "workspace:*","@hypit/semantic-track": "workspace:*","@hypit/svs": "workspace:*","@hypit/studio-adapter": "workspace:*",- "@hypit/studio-video-adapters": "workspace:*",+ "@hypit/speech-track-studio": "workspace:*",+ "@hypit/typography-track-studio": "workspace:*","@hypit/validation": "workspace:*","@hypit/video-cli": "workspace:*","@hypit/workspace": "workspace:*",diff --git a/packages/studio/src/adapter-profile.ts b/packages/studio/src/adapter-profile.tsindex c0b9d5ed..91a5db9e 100644--- a/packages/studio/src/adapter-profile.ts+++ b/packages/studio/src/adapter-profile.ts@@ -5,8 +5,21 @@ import { installDistributionPackageResolution, loadNodePackageSelection } from "import { studioAdaptersFromPackage } from "@hypit/studio-adapter";import type { StudioAdapter } from "@hypit/studio-adapter";+import { fallbackStudioAdapters } from "./fallback-adapters.js";import { StudioAdapterRegistry } from "./studio-registry.js";+export const officialStudioAdapterPackages = [+ "@hypit/audio-track-studio",+ "@hypit/caption-fine-studio",+ "@hypit/comment-sticker-studio",+ "@hypit/deck-track-studio",+ "@hypit/media-track-studio",+ "@hypit/ranking-studio",+ "@hypit/screen-overlay-studio",+ "@hypit/speech-track-studio",+ "@hypit/typography-track-studio",+] as const;+export const studioProfileFilename = "hypit.studio.json";export type StudioProfile = {@@ -93,14 +106,14 @@ export async function loadStudioAdapterRegistry(input: {}): Promise<StudioAdapterRegistry> {installDistributionPackageResolution([input.distributionPackageRoot]);const officialPackages = await loadNodePackageSelection(- ["@hypit/studio-video-adapters"],+ officialStudioAdapterPackages,input.distributionPackageRoot,);const officialAdapters = officialPackages.flatMap((item) =>studioAdaptersFromPackage(item.specifier, item.contribution.hostFacets ?? []));const project = await loadProjectStudioAdapters(input);return new StudioAdapterRegistry(- [...officialAdapters, ...project.adapters],+ [...fallbackStudioAdapters, ...officialAdapters, ...project.adapters],{ replace: project.replace },);}diff --git a/packages/studio/src/fallback-adapters.ts b/packages/studio/src/fallback-adapters.tsnew file mode 100644index 00000000..ebbd152a--- /dev/null+++ b/packages/studio/src/fallback-adapters.ts@@ -0,0 +1,103 @@+import type { StudioAdapter, StudioAdapterContext, StudioEntityDraft } from "@hypit/studio-adapter";+import { artifactPreview, previewLayer, temporalLineageFor } from "@hypit/studio-adapter";++type TerminalVisualTrack = {+ readonly presents?: readonly {+ readonly id: string;+ readonly subjectId?: string;+ readonly elements?: readonly {+ readonly kind?: string;+ readonly artifact?: { readonly digest?: string };+ }[];+ }[];+};++type TerminalAudioTrack = {+ readonly clips?: readonly {+ readonly id: string;+ readonly subjectId?: string;+ readonly artifact?: { readonly digest?: string };+ }[];+};++function withTemporalLineage(+ context: StudioAdapterContext,+ entity: StudioEntityDraft,+): StudioEntityDraft {+ const identities = [+ entity.authoredId,+ entity.markerId,+ entity.presentId,+ ...(entity.renderIds ?? []),+ ].filter((value): value is string => value !== undefined);+ const temporal = identities.map((identity) => temporalLineageFor(context, identity))+ .find((candidate) => candidate !== undefined);+ if (temporal === undefined) return entity;+ return {+ ...entity,+ ...(temporal.source.kind === "program" || temporal.source.id === undefined+ ? {}+ : { markerId: temporal.source.id }),+ temporal,+ };+}++function projectTerminalVisual(context: StudioAdapterContext): readonly StudioEntityDraft[] {+ const presents = new Map(((context.track.value as TerminalVisualTrack).presents ?? [])+ .map((present) => [present.id, present] as const));+ return context.generic().map((entity) => {+ const present = entity.presentId === undefined ? undefined : presents.get(entity.presentId);+ const material = present?.elements?.find((element) =>+ (element.kind === "image" || element.kind === "video") && element.artifact?.digest !== undefined);+ const digest = material?.artifact?.digest;+ return withTemporalLineage(context, {+ ...entity,+ ...(present?.subjectId === undefined ? {} : { authoredId: present.subjectId }),+ display: {+ title: present?.subjectId ?? entity.display.title,+ layers: digest === undefined ? [] : [previewLayer(artifactPreview(material?.kind === "image" ? "image" : "video", digest), material?.kind === "image" ? "repeat-x" : "storyboard")],+ },+ presentation: { entity: "media-item", chrome: "standard" },+ });+ });+}++function projectTerminalAudio(context: StudioAdapterContext): readonly StudioEntityDraft[] {+ const clips = new Map(((context.track.value as TerminalAudioTrack).clips ?? [])+ .map((clip) => [clip.id, clip] as const));+ return context.generic().map((entity, index) => {+ const clip = clips.get(context.spans[index]?.id ?? "");+ const digest = clip?.artifact?.digest;+ return withTemporalLineage(context, {+ ...entity,+ ...(clip?.subjectId === undefined ? {} : { authoredId: clip.subjectId }),+ display: {+ title: clip?.subjectId ?? entity.display.title,+ layers: digest === undefined ? [] : [previewLayer(artifactPreview("audio", digest), "waveform")],+ },+ presentation: { entity: "audio-clip", chrome: "standard" },+ });+ });+}++/** Cross-domain terminal protocols understood even when no Companion is installed. */+export const fallbackStudioAdapters: readonly StudioAdapter[] = [+ { id: "@hypit/studio#semantic-take", role: "semantic-take", output: { type: "SemanticTake" } },+ {+ id: "@hypit/studio#semantic-track", role: "semantic-track", output: { type: "SemanticTrack" },+ family: "semantic", tone: "teal", label: "Semantic", icon: "timeline",+ lane: { heightPx: 45 },+ },+ {+ id: "@hypit/studio#audio-track", role: "track", output: { type: "AudioTrack" },+ family: "audio", tone: "green", icon: "waveform",+ project: projectTerminalAudio,+ lane: { heightPx: 48 },+ },+ {+ id: "@hypit/studio#visual-track", role: "track", output: { type: "VisualTrack" },+ family: "media", tone: "blue", icon: "video",+ project: projectTerminalVisual,+ lane: { heightPx: 76 },+ },+];diff --git a/packages/studio/src/parameters.ts b/packages/studio/src/parameters.tsindex 4fda725f..e873e8cb 100644--- a/packages/studio/src/parameters.ts+++ b/packages/studio/src/parameters.ts@@ -3,12 +3,13 @@ import { dirname, isAbsolute, relative, resolve } from "node:path";import type {StudioParameter,StudioParameterDeclaration,+ StudioRecipeReferenceDeclaration,StudioEntityDraft,StudioPlacement,StudioEditHandle,StudioSemanticTimeline,StudioTemporalLineage,- StudioTimelineGesture,+ StudioTimelineEditDeclaration,} from "@hypit/studio-adapter";import type { MarkupSurfaceRegistryLike, SurfaceRecipePropertyVocabulary } from "@hypit/markup";import { parseSvs } from "@hypit/svs";@@ -117,26 +118,28 @@ function recipeParameters(input: {readonly placements: readonly Placement[];readonly surfaces?: MarkupSurfaceRegistryLike;readonly vocabulary?: readonly SurfaceRecipePropertyVocabulary[];+ readonly recipe: StudioRecipeReferenceDeclaration;+ readonly through: readonly string[];}): readonly StudioParameter[] {- const local = input.placements.find((candidate) => candidate.id === input.referencePath);- if (local !== undefined) {- const next = ["recipe", "default", "style", "appearance", "motion", "program"]- .map((name) => ({ name, path: local.referenceAttributes[name] }))- .find((value): value is { name: string; path: string } => value.path !== undefined);- if (next !== undefined && next.path !== input.referencePath) {- const vocabulary = input.surfaces- ?.resolve(local.module, local.surface)- ?.vocabulary?.attributes- .find((attribute) => attribute.name === next.name)- ?.recipe;- const selectedVocabulary = vocabulary ?? input.vocabulary;- return recipeParameters({- ...input,- current: sourceFor(input.root, local.sourcePath, input.files) ?? input.current,- referencePath: next.path,- ...(selectedVocabulary === undefined ? {} : { vocabulary: selectedVocabulary }),- });- }+ const [attribute, ...remaining] = input.through;+ if (attribute !== undefined) {+ const local = input.placements.find((candidate) => candidate.id === input.referencePath);+ if (local === undefined) return [];+ const referencePath = local.referenceAttributes[attribute];+ if (referencePath === undefined || referencePath === input.referencePath) return [];+ const vocabulary = input.surfaces+ ?.resolve(local.module, local.surface)+ ?.vocabulary?.attributes+ .find((candidate) => candidate.name === attribute)+ ?.recipe;+ const selectedVocabulary = vocabulary ?? input.vocabulary;+ return recipeParameters({+ ...input,+ current: sourceFor(input.root, local.sourcePath, input.files) ?? input.current,+ referencePath,+ through: remaining,+ ...(selectedVocabulary === undefined ? {} : { vocabulary: selectedVocabulary }),+ });}const [alias, ...parts] = input.referencePath.split(".");if (alias === undefined || parts.length === 0) return [];@@ -148,33 +151,38 @@ function recipeParameters(input: {const parsed = parseSvs(source.path, svsText(source.text));const recipe = parsed.recipes.find((item) => item.value.path === recipePath);if (recipe === undefined) return [];- return recipe.properties.map((property) => {+ return recipe.properties.flatMap((property): readonly StudioParameter[] => {+ const presentation = input.recipe.parameters.find((candidate) => candidate.name === property.name);+ if (presentation === undefined) return [];const declaration = input.vocabulary?.find((candidate) => candidate.name === property.name);const preimage = source.text.slice(property.valueRange.start, property.valueRange.end);const raw = preimage.trim();- const control = declaration?.values !== undefined+ const options = presentation?.options ?? declaration?.values;+ const summary = presentation?.summary ?? declaration?.summary;+ const control = presentation?.control ?? (options !== undefined? "select" as const: raw === "true" || raw === "false"? "boolean" as const- : /^-?(?:0|[1-9][0-9]*)(?:\.[0-9]+)?$/u.test(raw) ? "number" as const : "text" as const;- return {+ : /^-?(?:0|[1-9][0-9]*)(?:\.[0-9]+)?$/u.test(raw) ? "number" as const : "text" as const);+ return [{id: `${input.draft.id}:${input.referenceName}:${property.name}`,name: property.name,- label: declaration === undefined ? `${input.referenceName} · ${property.name}` : property.name,- ...(declaration?.group === undefined ? {} : { group: declaration.group }),- ...(declaration?.section === undefined ? {} : { section: declaration.section }),- ...(declaration?.summary === undefined ? {} : { summary: declaration.summary }),+ label: presentation?.label ?? (declaration === undefined ? `${input.referenceName} · ${property.name}` : property.name),+ ...(presentation?.group === undefined ? {} : { group: presentation.group }),+ ...(presentation?.section === undefined ? {} : { section: presentation.section }),+ ...(summary === undefined ? {} : { summary }),control,value: raw,language: "svs" as const,- writable: true,- ...(declaration?.values === undefined ? {} : { options: declaration.values }),+ writable: presentation?.writable ?? true,+ ...(options === undefined ? {} : { options }),+ ...(presentation?.unit === undefined ? {} : { unit: presentation.unit }),source: {path: relative(input.root, sourceAbsolute(input.root, source.path)),range: property.valueRange,preimage,},- } satisfies StudioParameter;+ } satisfies StudioParameter];});}@@ -187,8 +195,7 @@ function referencedParameters(input: {readonly declarations: readonly StudioParameterDeclaration[];readonly placements: readonly Placement[];}): readonly StudioParameter[] {- const targetId = input.referencePath.split(".").at(-1);- if (targetId === undefined) return [];+ const targetId = input.referencePath;const target = authoredElements(input.placements).find((candidate) => candidate.id === targetId);if (target === undefined) return [];const file = sourceFor(input.root, target.sourcePath, input.files);@@ -289,8 +296,9 @@ export function parametersForDraft(input: {declarations: declaration.referenced,placements: input.placements ?? [],});- const recipe = ["appearance", "visual-appearance", "motion", "style", "recipe", "program", "default"].includes(declaration.name)- ? recipeParameters({+ const recipe = declaration.recipe === undefined+ ? []+ : recipeParameters({root: input.root,files: input.files,current: file,@@ -299,8 +307,9 @@ export function parametersForDraft(input: {referencePath,placements: input.placements ?? [],...(input.surfaces === undefined ? {} : { surfaces: input.surfaces }),- })- : [];+ recipe: declaration.recipe,+ through: declaration.recipe.through ?? [],+ });return [...reference, ...recipe];});return [...direct, ...recipes];@@ -315,9 +324,9 @@ const ABSOLUTE_DURATION = /^\s*\d+(?:\.\d+)?(?:f|ms|s)\s*$/u;* remain directly writable. Other projections stay visible but read-only* until their package declares an unambiguous inverse.*/-export function timelineAdjustHandles(+export function resolveTimelineEditHandles(parameters: readonly StudioParameter[],- declared: readonly StudioTimelineGesture[] = ["move", "trim-start", "trim-end"],+ declarations: readonly StudioTimelineEditDeclaration[],temporal?: StudioTemporalLineage,semantic?: StudioSemanticTimeline,): readonly StudioEditHandle[] {@@ -328,14 +337,9 @@ export function timelineAdjustHandles(// window when a clip is being dragged.if (parameter.language === "svml" && !byName.has(parameter.name)) byName.set(parameter.name, parameter);}- const start = byName.get("start");- const end = byName.get("end");- const at = byName.get("at");- const duration = byName.get("for");const absolute = (parameter: StudioParameter | undefined): parameter is StudioParameter =>parameter !== undefined && parameter.writable && ABSOLUTE_DURATION.test(parameter.value);- const allowed = new Set(declared);- const disabled = (gesture: StudioTimelineGesture, reason: string): StudioEditHandle => ({+ const disabled = (gesture: StudioTimelineEditDeclaration["gesture"], reason: string): StudioEditHandle => ({id: `timeline.adjust:${gesture}`,operation: "timeline.adjust",gesture,@@ -343,90 +347,88 @@ export function timelineAdjustHandles(disabledReason: reason,});const handles: StudioEditHandle[] = [];- const selectionId = temporal?.source.kind === "selection" ? temporal.source.id : undefined;- const selection = selectionId === undefined- ? undefined- : semantic?.selections.find((candidate) => candidate.id === selectionId);- const momentId = temporal?.source.kind === "moment" ? temporal.source.id : undefined;- const moment = momentId === undefined- ? undefined- : semantic?.moments.find((candidate) => candidate.id === momentId);- if (selection !== undefined) {- const target = {- kind: "selection" as const,- id: selection.id,- startAnchorId: selection.startAnchorId,- endAnchorId: selection.endAnchorId,- };- for (const gesture of ["move", "trim-start", "trim-end"] as const) {- if (!allowed.has(gesture)) continue;+ if (temporal === undefined) return handles;+ const matches = (when: { readonly source: string; readonly projection?: string }): boolean =>+ temporal.source.kind === when.source+ && (when.projection === undefined || temporal.projection?.kind === when.projection);+ for (const declaration of declarations) {+ const before = handles.length;+ let relevant = false;+ let unavailable: string | undefined;+ for (const target of declaration.targets) {+ if (target.kind === "semantic-source") {+ if (temporal.source.kind !== target.source) continue;+ relevant = true;+ const id = temporal.source.id;+ if (id === undefined) {+ unavailable = `该 ${target.source} 投影没有公共作者身份。`;+ continue;+ }+ if (target.source === "selection") {+ const selection = semantic?.selections.find((candidate) => candidate.id === id);+ if (selection === undefined) {+ unavailable = `Selection ${id} 没有出现在当前语义 Candidate 中。`;+ continue;+ }+ handles.push({+ id: `timeline.adjust:${declaration.gesture}`,+ operation: "timeline.adjust",+ gesture: declaration.gesture,+ enabled: true,+ coordinate: "semantic-anchor",+ ...(target.moveEffect === undefined ? {} : { moveEffect: target.moveEffect }),+ snapTo: ["semantic-anchor"],+ semantic: {+ kind: "selection",+ id: selection.id,+ startAnchorId: selection.startAnchorId,+ endAnchorId: selection.endAnchorId,+ },+ });+ } else {+ const moment = semantic?.moments.find((candidate) => candidate.id === id);+ if (moment === undefined) {+ unavailable = `Moment ${id} 没有出现在当前语义 Candidate 中。`;+ continue;+ }+ handles.push({+ id: `timeline.adjust:${declaration.gesture}`,+ operation: "timeline.adjust",+ gesture: declaration.gesture,+ enabled: true,+ coordinate: "semantic-anchor",+ ...(target.moveEffect === undefined ? {} : { moveEffect: target.moveEffect }),+ snapTo: ["semantic-anchor"],+ semantic: { kind: "moment", id: moment.id, anchorId: moment.anchorId },+ });+ }+ break;+ }+ if (!matches(target.when)) continue;+ relevant = true;+ if (target.kind === "disabled") {+ handles.push(disabled(declaration.gesture, target.reason));+ break;+ }+ const resolved = target.parameters.map(({ role, parameter }) => ({ role, parameter: byName.get(parameter) }));+ if (resolved.some((item) => !absolute(item.parameter))) {+ unavailable = `Companion 声明的源码参数不可用:${target.parameters.map((item) => item.parameter).join(", ")}。`;+ continue;+ }handles.push({- id: `timeline.adjust:${gesture}`,- operation: "timeline.adjust",- gesture,- enabled: true,- coordinate: "semantic-anchor",- snapTo: ["semantic-anchor"],- semantic: target,- });- }- } else if (moment !== undefined) {- if (allowed.has("move")) handles.push({- id: "timeline.adjust:move",- operation: "timeline.adjust",- gesture: "move",- enabled: true,- coordinate: "semantic-anchor",- snapTo: ["semantic-anchor"],- semantic: { kind: "moment", id: moment.id, anchorId: moment.anchorId },- });- if (allowed.has("trim-start")) {- handles.push(disabled("trim-start", "起点由 Moment 决定;拖动实体会移动 Moment,不能单独裁起点。"));- }- if (allowed.has("trim-end")) {- if (absolute(duration)) handles.push({- id: "timeline.adjust:trim-end",+ id: `timeline.adjust:${declaration.gesture}`,operation: "timeline.adjust",- gesture: "trim-end",+ gesture: declaration.gesture,enabled: true,coordinate: "program-frame",snapTo: ["frame", "semantic-anchor", "item-edge"],- sources: [{ role: "duration", source: duration.source }],+ sources: resolved.map((item) => ({ role: item.role, source: item.parameter!.source })),});- else handles.push(disabled("trim-end", "该 Moment 消费没有独立可写的 duration。"));+ break;+ }+ if (relevant && handles.length === before) {+ handles.push(disabled(declaration.gesture, unavailable ?? "Companion 声明的作者逆变换在当前实体上不可用。"));}- } else if (absolute(start) && absolute(end)) {- if (allowed.has("move")) handles.push({- id: "timeline.adjust:move", operation: "timeline.adjust", gesture: "move", enabled: true, coordinate: "program-frame",- snapTo: ["frame", "semantic-anchor", "item-edge"], sources: [- { role: "start", source: start.source },- { role: "end", source: end.source },- ],- });- if (allowed.has("trim-start")) handles.push({- id: "timeline.adjust:trim-start", operation: "timeline.adjust", gesture: "trim-start", enabled: true, coordinate: "program-frame",- snapTo: ["frame", "semantic-anchor", "item-edge"], sources: [{ role: "start", source: start.source }],- });- if (allowed.has("trim-end")) handles.push({- id: "timeline.adjust:trim-end", operation: "timeline.adjust", gesture: "trim-end", enabled: true, coordinate: "program-frame",- snapTo: ["frame", "semantic-anchor", "item-edge"], sources: [{ role: "end", source: end.source }],- });- } else if (at !== undefined && !at.writable && absolute(duration)) {- if (allowed.has("move")) handles.push(disabled("move", "起点由 At 引用决定,不能独立移动。"));- if (allowed.has("trim-start")) handles.push(disabled("trim-start", "起点由 At 引用决定,不能独立裁剪。"));- if (allowed.has("trim-end")) handles.push({- id: "timeline.adjust:trim-end", operation: "timeline.adjust", gesture: "trim-end", enabled: true, coordinate: "program-frame",- snapTo: ["frame", "semantic-anchor", "item-edge"], sources: [{ role: "duration", source: duration.source }],- });- } else {- const reason = selectionId !== undefined- ? `Selection ${selectionId} 没有出现在当前语义 Candidate 中。`- : parameters.some((parameter) => parameter.name === "during" && !parameter.writable)- ? "该投影尚未声明唯一的作者语义逆变换。"- : "没有可逆的绝对时间端点源码范围。";- if (allowed.has("move")) handles.push(disabled("move", reason));- if (allowed.has("trim-start")) handles.push(disabled("trim-start", reason));- if (allowed.has("trim-end")) handles.push(disabled("trim-end", reason));}return handles;}diff --git a/packages/studio/src/shared.ts b/packages/studio/src/shared.tsindex b60ba2b2..8a7e2b8a 100644--- a/packages/studio/src/shared.ts+++ b/packages/studio/src/shared.ts@@ -5,9 +5,9 @@import type {Range,- StudioInteraction,+ StudioEntityDisplay,+ StudioIcon,StudioEditHandle,- StudioInspectorDescription,StudioLaneDescription,StudioMaterialPreview,StudioParameter,@@ -21,14 +21,15 @@ import type {StudioTemporalSource,StudioTimelineGesture,StudioTimelinePresentation,+ StudioTimelineTone,StudioTrackFamily,} from "@hypit/studio-adapter";export type {Range,- StudioInteraction,+ StudioEntityDisplay,+ StudioIcon,StudioEditHandle,- StudioInspectorDescription,StudioLaneDescription,StudioMaterialPreview,StudioParameter,@@ -37,6 +38,7 @@ export type {StudioTemporalProjection,StudioTemporalSource,StudioTimelinePresentation,+ StudioTimelineTone,StudioTrackFamily,} from "@hypit/studio-adapter";@@ -47,21 +49,20 @@ export type CandidateStatus = "resolved" | "unresolved";/** Studio-owned interpretation of a terminal projection. */export type StudioTrackBinding = {readonly family: StudioTrackFamily;+ readonly tone: StudioTimelineTone;/** Studio-local lane name. This is presentation, not an authored identity. */readonly label?: string;readonly facet: "visual" | "audio";/** Visual/audio facets from one authored element share this identity. */readonly groupId: string;- readonly icon: string;+ readonly icon: StudioIcon;/** Stable Studio-local adapter id; fallback adapters remain explicit too. */readonly adapter: string;/** Studio-local partition key for an attached projection. */readonly attachmentId?: string;readonly lane: StudioLaneDescription;- readonly inspector: StudioInspectorDescription;readonly authoredTag?: string;readonly references: readonly { readonly name: string; readonly type: string }[];- readonly interaction: StudioInteraction;};/**@@ -93,7 +94,7 @@ export type Clip = {readonly authoredId: string;/** The Script marker that placed it, when something said put it there. */readonly markerId?: string;- readonly label: string;+ readonly display: StudioEntityDisplay;readonly startFrame: number;readonly endFrameExclusive: number;/** Where that authored tag was written. */@@ -101,9 +102,6 @@ export type Clip = {readonly stackOrder: number;readonly presentation: StudioTimelinePresentation;readonly temporal?: StudioTemporalLineage;- /** A real material selected by this Run; absent means Studio draws no fake preview. */- readonly preview?: StudioMaterialPreview;- readonly interaction: StudioInteraction;/** Rendering identities implementing this author entity; optional for non-visual entities. */readonly renderIds: readonly string[];readonly parameters: readonly StudioParameter[];diff --git a/packages/studio/src/snapshot.ts b/packages/studio/src/snapshot.tsindex a3ee684c..084c7a52 100644--- a/packages/studio/src/snapshot.ts+++ b/packages/studio/src/snapshot.ts@@ -26,11 +26,12 @@ import {} from "./studio-registry.js";import type { StudioAdapterRegistry } from "./studio-registry.js";import type { StudioEntityDraft } from "./studio-registry.js";-import { parametersForDraft, timelineAdjustHandles } from "./parameters.js";+import { parametersForDraft, resolveTimelineEditHandles } from "./parameters.js";import type { StudioSourceFile } from "./parameters.js";type Present = {readonly id: string;+ readonly subjectId?: string;readonly span: { readonly startFrame: number; readonly endFrameExclusive: number };readonly stacking: { readonly order: number };};@@ -40,6 +41,7 @@ const SAMPLE_RATE = 48_000;type AudioClip = {readonly id: string;+ readonly subjectId?: string;readonly target: { readonly startSample: number; readonly endSampleExclusive: number };};@@ -51,11 +53,12 @@ type AudioClip = {function spans(track: unknown,frameRate: { readonly numerator: number; readonly denominator: number },-): readonly { id: string; startFrame: number; endFrameExclusive: number; stackOrder: number }[] {+): readonly { id: string; subjectId?: string; startFrame: number; endFrameExclusive: number; stackOrder: number }[] {const held = track as { presents?: readonly Present[]; clips?: readonly AudioClip[] } | undefined;if (held?.presents !== undefined) {return held.presents.map((present) => ({id: present.id,+ ...(present.subjectId === undefined ? {} : { subjectId: present.subjectId }),startFrame: present.span.startFrame,endFrameExclusive: present.span.endFrameExclusive,stackOrder: present.stacking.order,@@ -64,6 +67,7 @@ function spans(const perSecond = frameRate.numerator / frameRate.denominator;return (held?.clips ?? []).map((clip) => ({id: clip.id,+ ...(clip.subjectId === undefined ? {} : { subjectId: clip.subjectId }),startFrame: Math.floor(clip.target.startSample / SAMPLE_RATE * perSecond),endFrameExclusive: Math.max(Math.floor(clip.target.startSample / SAMPLE_RATE * perSecond) + 1,@@ -85,18 +89,7 @@ function authored(placements: readonly Placement[]): readonly Located[] {if (child.id !== undefined) found.push({ id: child.id, range: child.range });}}- // Longest first, so `handsome-1` wins over `handsome`.- return found.sort((left, right) => right.id.length - left.id.length);-}--/**- * A Present is named after the things that produced it, so the authored id it- * mentions is the tag to point at. Matching on whole delimited parts keeps- * `bags` from matching inside `bagsful`.- */-function locate(presentId: string, located: readonly Located[]): Located | undefined {- const parts = new Set(presentId.split(/[:#+]/u).filter(Boolean));- return located.find((item) => parts.has(item.id));+ return found;}function scriptMap(@@ -297,26 +290,6 @@ export function snapshot(registry: StudioAdapterRegistry, built: Preview, input:const located = authored(built.source.observations.placements);const script = scriptMap(built.source.observations.sourceMaps, built);const semantic = semanticTimeline(registry, 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([- ...(script?.selections ?? []).map((item) => item.id),- ...(script?.segments ?? []).map((item) => item.id),- ...(script?.moments ?? []).map((item) => item.id),- ]);- const markerFor = (elementId: string): string | undefined => {- // The tag may be the element itself or one written inside it; either way- // what places it is something it points at.- for (const placement of built.source.observations.placements) {- const child = placement.children.find((item) => item.id === elementId);- const paths = placement.id === elementId ? placement.references : child?.references;- for (const path of paths ?? []) {- const named = path.slice(path.lastIndexOf(".") + 1);- if (markers.has(named)) return named;- }- }- return undefined;- };const tracks: Track[] = [];for (const item of built.tracks) {const projectedSpans = spans(item.value, input.frameRate);@@ -326,19 +299,13 @@ export function snapshot(registry: StudioAdapterRegistry, built: Preview, input:&& candidate.module.name === item.trace.module&& candidate.surface === item.trace.surface);const generic = (): readonly StudioEntityDraft[] => projectedSpans.map((span) => {- const where = locate(span.id, located);- 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- // are four things, and collapsing them onto the marker they share would- // make them one.- const identity = where?.id ?? marker ?? item.name;+ const identity = span.subjectId ?? span.id;+ const where = located.find((candidate) => candidate.id === identity);return {id: `${item.outputRef}:${span.id}`,...(item.type === "VisualTrack" ? { presentId: span.id } : {}),authoredId: identity,- ...(marker === undefined ? {} : { markerId: marker }),- label: where?.id ?? span.id,+ display: { title: identity, layers: [] },startFrame: span.startFrame,endFrameExclusive: span.endFrameExclusive,...(where === undefined ? {} : { elementRange: where.range }),@@ -364,19 +331,20 @@ export function snapshot(registry: StudioAdapterRegistry, built: Preview, input:placements: built.source.observations.placements,surfaces: input.surfaces,});- const editHandles = timelineAdjustHandles(+ const editHandles = resolveTimelineEditHandles(parameters,- registry.timelineGestures(item, placement, draft.lane),+ draft.timelineEdits ?? registry.timelineEdits(item, placement, draft.lane),draft.temporal,semantic,);- return parameters.length === 0 && editHandles.length === 0- ? draft- : { ...draft, parameters, ...(editHandles.length === 0 ? {} : { editHandles }) };+ return {+ draft: parameters.length === 0 ? draft : { ...draft, parameters },+ editHandles,+ };});const clips: Clip[] = drafts- .filter((draft) => draft.lane === undefined)- .map((draft) => sealStudioClip(item.outputRef, draft, binding));+ .filter(({ draft }) => draft.lane === undefined)+ .map(({ draft, editHandles }) => sealStudioClip(item.outputRef, draft, binding, editHandles));const provenance: CandidateProvenance = {output: item.name,outputRef: item.outputRef,@@ -394,13 +362,14 @@ export function snapshot(registry: StudioAdapterRegistry, built: Preview, input:provenance,});for (const attachment of registry.trackAttachments(item)) {- const attachedDrafts = drafts.filter((draft) => draft.lane === attachment.attachmentId);+ const attachedDrafts = drafts.filter(({ draft }) => draft.lane === attachment.attachmentId);if (attachedDrafts.length === 0) continue;tracks.push({id: `${item.outputRef}::studio::${attachment.attachmentId}`,label: attachment.label ?? attachment.attachmentId ?? item.name,row: 0,- clips: attachedDrafts.map((draft) => sealStudioClip(item.outputRef, draft, attachment)),+ clips: attachedDrafts.map(({ draft, editHandles }) =>+ sealStudioClip(item.outputRef, draft, attachment, editHandles)),binding: attachment,provenance,});diff --git a/packages/studio/src/studio-preflight.ts b/packages/studio/src/studio-preflight.tsindex 0aaf47f2..14cf1cf5 100644--- a/packages/studio/src/studio-preflight.ts+++ b/packages/studio/src/studio-preflight.ts@@ -11,8 +11,7 @@ import {placementFor,roleFor,traceFor,- tracedRealizations,- tracedStudioRealizations,+ tracedStudioValues,unique,} from "./studio-trace.js";import type { StudioProjectionRole, StudioTrace } from "./studio-trace.js";@@ -137,26 +136,28 @@ export function inspectStudioRun(...semanticPlacement.children.flatMap((child) => child.references),]).flatMap((ref) => outputFor(source, ref)?.type === "SemanticTake"? [outputFor(source, ref)!.ref] : []);- if (semanticTakeRefs.length === 0) issues.push("Film has no traceable SemanticTake / Speech Track chain");-- const realizationRefs = unique(filmTrackRefs.flatMap((ref) =>- tracedRealizations(registry, source, ref).map((dependency) => dependency.ref)));-- const adapterRealizationRefs = unique(filmTrackRefs.flatMap((ref) =>- tracedStudioRealizations(registry, source, ref)));+ if (semanticTakeRefs.length === 0) issues.push("Film has no traceable SemanticTake chain");++ let adapterValueRefs: readonly string[] = [];+ try {+ adapterValueRefs = unique(filmTrackRefs.flatMap((ref) =>+ tracedStudioValues(registry, source, ref)));+ } catch (error) {+ issues.push(error instanceof Error ? error.message : String(error));+ }+ const adapterValueSet = new Set(adapterValueRefs);const projectionRefs = unique([...filmTrackRefs,...(semanticOutput?.type === "SemanticTrack" ? [semanticOutput.ref] : []),...semanticTakeRefs,- ...realizationRefs,- ...adapterRealizationRefs,+ ...adapterValueRefs,]);const projections: StudioProjection[] = [];const derived: Omit<StudioProjection, "candidatePolicy">[] = [];for (const ref of projectionRefs) {const output = outputFor(source, ref);- const role = roleFor(registry, source, ref);+ const role = roleFor(registry, source, ref) ?? (adapterValueSet.has(ref) ? "realization" : undefined);if (output === undefined || role === undefined) continue;const candidateId = satisfactions.get(ref);const candidate = candidateId === undefined ? undefined : candidates.get(candidateId);diff --git a/packages/studio/src/studio-registry.ts b/packages/studio/src/studio-registry.tsindex 9d70d993..3c2246c1 100644--- a/packages/studio/src/studio-registry.ts+++ b/packages/studio/src/studio-registry.ts@@ -1,14 +1,14 @@import type {StudioAdapter,StudioAdapterContext,+ StudioEditHandle,StudioEntityDraft,StudioLaneAttachment,StudioProjectionRole,StudioResolvedTrack,StudioSpan,- StudioTimelineGesture,+ StudioTimelineEditDeclaration,} from "@hypit/studio-adapter";-import { readonlyInteraction } from "@hypit/studio-adapter";import type { Placement } from "./observe.js";import type { Clip, StudioTrackBinding } from "./shared.js";@@ -16,13 +16,89 @@ import type { Clip, StudioTrackBinding } from "./shared.js";export type { StudioEntityDraft, StudioProjectionRole, StudioSpan } from "@hypit/studio-adapter";const flatLane = {- layout: "flat" as const,- height: { minPx: 44, preferredPx: 52, maxPx: 96 },+ heightPx: 52,};-const standardInspector = {- sections: ["authoring", "resolved", "composition", "identity", "run"] as const,-};+const tones = new Set(["blue", "green", "teal", "violet", "magenta", "orange", "orange-muted", "neutral"]);+const icons = new Set(["captions", "component", "layers", "ranking", "text", "timeline", "video", "waveform"]);+const chromes = new Set(["standard", "group", "point"]);+const layouts = new Set(["repeat-x", "cover", "contain", "storyboard", "waveform"]);++function validateTimelineEdits(subject: string, edits: readonly StudioTimelineEditDeclaration[] | undefined): void {+ const gestures = new Set<string>();+ for (const edit of edits ?? []) {+ if (gestures.has(edit.gesture)) throw new Error(`${subject} repeats timeline gesture ${edit.gesture}`);+ gestures.add(edit.gesture);+ if (edit.targets.length === 0) throw new Error(`${subject} timeline gesture ${edit.gesture} has no inverse target`);+ for (const target of edit.targets) {+ if (target.kind !== "source-parameters") continue;+ if (target.parameters.length === 0) {+ throw new Error(`${subject} timeline gesture ${edit.gesture} has no source parameters`);+ }+ const roles = new Set<string>();+ for (const parameter of target.parameters) {+ if (parameter.parameter.length === 0 || roles.has(parameter.role)) {+ throw new Error(`${subject} timeline gesture ${edit.gesture} has an invalid source parameter binding`);+ }+ roles.add(parameter.role);+ }+ }+ }+}++function validateAdapterVocabulary(adapter: StudioAdapter): void {+ if (adapter.tone !== undefined && !tones.has(adapter.tone)) {+ throw new Error(`Studio adapter ${adapter.id} selects unsupported tone ${adapter.tone}`);+ }+ if (adapter.icon !== undefined && !icons.has(adapter.icon)) {+ throw new Error(`Studio adapter ${adapter.id} selects unsupported icon ${adapter.icon}`);+ }+ validateTimelineEdits(`Studio adapter ${adapter.id}`, adapter.timelineEdits);+ for (const attachment of adapter.attachments ?? []) {+ if (attachment.tone !== undefined && !tones.has(attachment.tone)) {+ throw new Error(`Studio adapter ${adapter.id} attachment ${attachment.id} selects unsupported tone ${attachment.tone}`);+ }+ if (!icons.has(attachment.icon)) {+ throw new Error(`Studio adapter ${adapter.id} attachment ${attachment.id} selects unsupported icon ${attachment.icon}`);+ }+ validateTimelineEdits(`Studio adapter ${adapter.id} attachment ${attachment.id}`, attachment.timelineEdits);+ }+}++function validateDraftVocabulary(adapter: StudioAdapter, draft: StudioEntityDraft): void {+ validateTimelineEdits(`Studio adapter ${adapter.id} entity ${draft.id}`, draft.timelineEdits);+ if (draft.display === undefined || typeof draft.display.title !== "string" || draft.display.title.trim().length === 0) {+ throw new Error(`Studio adapter ${adapter.id} entity ${draft.id} has no display title`);+ }+ if (!Array.isArray(draft.display.layers)) {+ throw new Error(`Studio adapter ${adapter.id} entity ${draft.id} has invalid display layers`);+ }+ if (draft.presentation !== undefined && !chromes.has(draft.presentation.chrome)) {+ throw new Error(`Studio adapter ${adapter.id} entity ${draft.id} selects unsupported chrome ${draft.presentation.chrome}`);+ }+ for (const [index, layer] of draft.display.layers.entries()) {+ if (layer.kind === "text") {+ if (layer.role !== "content" || typeof layer.text !== "string") {+ throw new Error(`Studio adapter ${adapter.id} entity ${draft.id} has invalid text layer ${index}`);+ }+ continue;+ }+ if (layer.kind !== "preview" || (layer.role !== "content" && layer.role !== "decoration")+ || !layouts.has(layer.layout)+ || !(["image", "video", "audio"] as const).includes(layer.preview.kind)) {+ throw new Error(`Studio adapter ${adapter.id} entity ${draft.id} has invalid preview layer ${index}`);+ }+ const source = layer.preview.source;+ if (source.kind === "artifact") {+ if (typeof source.digest !== "string" || source.digest.length === 0) {+ throw new Error(`Studio adapter ${adapter.id} entity ${draft.id} has invalid Artifact source`);+ }+ } else if (source.kind !== "surface-preview"+ || source.module.length === 0 || source.version.length === 0 || source.surface.length === 0) {+ throw new Error(`Studio adapter ${adapter.id} entity ${draft.id} has invalid Surface preview source`);+ }+ }+}function matches(adapter: StudioAdapter,@@ -56,6 +132,7 @@ export class StudioAdapterRegistry {for (const adapter of adapters) {if (ids.has(adapter.id)) throw new Error(`Studio adapter id is repeated: ${adapter.id}`);ids.add(adapter.id);+ validateAdapterVocabulary(adapter);}const replacements = options.replace ?? {};for (const [target, replacement] of Object.entries(replacements)) {@@ -92,34 +169,29 @@ export class StudioAdapterRegistry {return this.adapterFor(type, placement, siblingTypes)?.role;}- dependencyRole(role: StudioProjectionRole, type: string): StudioProjectionRole | undefined {- return this.#adapters- .filter((adapter) => adapter.role === role)- .flatMap((adapter) => adapter.dependencies ?? [])- .find((dependency) => dependency.type === type)?.role;- }-- realizationPorts(+ requiredValuePorts(type: string,placement: Placement | undefined,siblingTypes: readonly string[],): readonly string[] {- return this.adapterFor(type, placement, siblingTypes)?.realizationPorts ?? [];+ return this.adapterFor(type, placement, siblingTypes)?.requiredValues ?? [];}semanticTimelinePresentation(authoredLabel?: string): {readonly family: StudioTrackBinding["family"];+ readonly tone: StudioTrackBinding["tone"];readonly label?: string;- readonly icon: string;+ readonly icon: StudioTrackBinding["icon"];readonly lane: StudioTrackBinding["lane"];} {const adapter = this.adapterFor("SemanticTrack", undefined, []);return {- family: adapter?.family ?? "speech",+ family: adapter?.family ?? "semantic",+ tone: adapter?.tone ?? "teal",...(authoredLabel === undefined? (adapter?.label === undefined ? {} : { label: adapter.label }): { label: authoredLabel }),- icon: adapter?.icon ?? "speech",+ icon: adapter?.icon ?? "timeline",lane: adapter?.lane ?? flatLane,};}@@ -142,6 +214,7 @@ export class StudioAdapterRegistry {const adapter = this.#trackAdapter(track);return (adapter.attachments ?? []).map((attachment: StudioLaneAttachment) => ({family: attachment.family,+ tone: attachment.tone ?? adapter.tone ?? "neutral",...(attachment.label === undefined ? {} : { label: attachment.label }),facet: attachment.facet,groupId: root.groupId,@@ -152,9 +225,7 @@ export class StudioAdapterRegistry {...attachment.lane,attachedTo: attachment.lane.attachedTo ?? root.lane.groupId ?? root.groupId,},- inspector: attachment.inspector ?? adapter.inspector ?? standardInspector,references: root.references,- interaction: attachment.interaction ?? adapter.interaction ?? readonlyInteraction,}));}@@ -166,16 +237,15 @@ export class StudioAdapterRegistry {const label = adapter.label ?? track.trace.authoredId;return {family: adapter.family,+ tone: adapter.tone ?? "neutral",...(label === undefined ? {} : { label }),facet: track.type === "AudioTrack" ? "audio" : "visual",groupId: track.trace.authoredId ?? track.outputRef,icon: adapter.icon ?? (track.type === "AudioTrack" ? "waveform" : "layers"),adapter: adapter.id,lane: adapter.lane ?? flatLane,- inspector: adapter.inspector ?? standardInspector,...(track.trace.placement === undefined ? {} : { authoredTag: track.trace.placement }),references: track.trace.references.map(({ name, type }) => ({ name, type })),- interaction: adapter.interaction ?? readonlyInteraction,};}@@ -183,10 +253,22 @@ export class StudioAdapterRegistry {const adapter = this.#trackAdapter(input.track);const drafts = adapter.project?.(input) ?? input.generic();const preview = input.surfacePreview;- if (adapter.poster?.source !== "surface-preview" || preview === undefined) return drafts;- return drafts.map((draft) => draft.lane !== undefined || draft.preview !== undefined+ const surfaceLayer: StudioEntityDraft["display"]["layers"][number] | undefined = preview === undefined+ ? undefined+ : { kind: "preview", role: "decoration", preview, layout: "repeat-x" };+ const projected: readonly StudioEntityDraft[] = adapter.poster?.source !== "surface-preview" || surfaceLayer === undefined+ ? drafts+ : drafts.map((draft) => draft.lane !== undefined? draft- : { ...draft, preview });+ : {+ ...draft,+ display: {+ ...draft.display,+ layers: [surfaceLayer, ...draft.display.layers],+ },+ });+ for (const draft of projected) validateDraftVocabulary(adapter, draft);+ return projected;}parameterDeclarations(@@ -201,16 +283,16 @@ export class StudioAdapterRegistry {return adapter.parameters ?? [];}- timelineGestures(+ timelineEdits(track: StudioResolvedTrack,placement: Placement | undefined,lane?: string,- ): readonly StudioTimelineGesture[] {+ ): readonly StudioTimelineEditDeclaration[] {const adapter = this.#trackAdapter(track);if (lane !== undefined) {- return adapter.attachments?.find((attachment) => attachment.id === lane)?.timelineGestures ?? [];+ return adapter.attachments?.find((attachment) => attachment.id === lane)?.timelineEdits ?? [];}- return adapter.timelineGestures ?? [];+ return adapter.timelineEdits ?? [];}}@@ -218,27 +300,25 @@ export function sealStudioClip(outputRef: string,draft: StudioEntityDraft,fallback: StudioTrackBinding,+ editHandles: readonly StudioEditHandle[] = [],): Clip {return {id: draft.id.startsWith(`${outputRef}:`) ? draft.id : `${outputRef}:${draft.id}`,...(draft.presentId === undefined ? {} : { presentId: draft.presentId }),authoredId: draft.authoredId,...(draft.markerId === undefined ? {} : { markerId: draft.markerId }),- label: draft.label,+ display: draft.display,startFrame: draft.startFrame,endFrameExclusive: draft.endFrameExclusive,...(draft.elementRange === undefined ? {} : { elementRange: draft.elementRange }),stackOrder: draft.stackOrder,presentation: draft.presentation ?? {entity: fallback.facet === "audio" ? "audio-clip" : "present",- shape: fallback.facet === "audio" ? "waveform" : "block",- depth: 0,+ chrome: "standard",},...(draft.temporal === undefined ? {} : { temporal: draft.temporal }),- ...(draft.preview === undefined ? {} : { preview: draft.preview }),parameters: draft.parameters ?? [],- editHandles: draft.editHandles ?? [],- interaction: draft.interaction ?? fallback.interaction,+ editHandles,renderIds: draft.renderIds ?? (draft.presentId === undefined ? [] : [draft.presentId]),};}diff --git a/packages/studio/src/studio-trace.ts b/packages/studio/src/studio-trace.tsindex c3d32a45..738f68a1 100644--- a/packages/studio/src/studio-trace.ts+++ b/packages/studio/src/studio-trace.ts@@ -84,8 +84,8 @@ export function traceFor(source: CompiledSource, ref: string): StudioTrace {};}-/** Additional same-Surface realizations an adapter needs beyond the terminal Track. */-export function tracedStudioRealizations(+/** Additional same-Surface values a Companion requires beyond the terminal Track. */+export function tracedStudioValues(registry: StudioAdapterRegistry,source: CompiledSource,ref: string,@@ -97,24 +97,16 @@ export function tracedStudioRealizations(const found = outputFor(source, port.ref);return found === undefined ? [] : [found.type];});- const ports = new Set(registry.realizationPorts(output.type, placement, siblingTypes));- return placement.outputPorts- .filter((port) => ports.has(port.name))- .flatMap((port) => {- const found = outputFor(source, port.ref);- return found === undefined ? [] : [found.ref];- });-}--export function tracedRealizations(- registry: StudioAdapterRegistry,- source: CompiledSource,- ref: string,-): readonly { ref: string; role: StudioProjectionRole }[] {- const role = roleFor(registry, source, ref);- if (role === undefined) return [];- return traceFor(source, ref).references.flatMap((dependency) => {- const dependencyRole = registry.dependencyRole(role, dependency.type);- return dependencyRole === undefined ? [] : [{ ref: dependency.ref, role: dependencyRole }];+ const ports = registry.requiredValuePorts(output.type, placement, siblingTypes);+ return ports.map((name) => {+ const port = placement.outputPorts.find((candidate) => candidate.name === name);+ if (port === undefined) {+ throw new Error(`Studio Companion for ${output.type} requires missing ${placement.tag} output port ${name}`);+ }+ const found = outputFor(source, port.ref);+ if (found === undefined) {+ throw new Error(`Studio Companion for ${output.type} cannot resolve ${placement.tag} output port ${name}`);+ }+ return found.ref;});}diff --git a/packages/studio/src/style.css b/packages/studio/src/style.cssindex 45ffd6ac..9b734f0b 100644--- a/packages/studio/src/style.css+++ b/packages/studio/src/style.css@@ -21,16 +21,15 @@--interaction-pressed: var(--brand-600);--danger: #c00015;--ok: #64c99a;- /* Track families occupy fixed hue slots; variants stay on their family's hue. */- --component: #ac571d;- --component-rail: #ff9858;- /* Ranking reveal is a darker component variant, not a new family. */- --ranking-reveal: #7b3702;- --ranking-reveal-rail: #e7834c;- --audio: #38853e;- --audio-rail: #75d079;- --speech: #008889;- --speech-rail: #00d4d5;+ /* Studio palette tokens; Companion families never become CSS selectors. */+ --tone-orange: #ac571d;+ --tone-orange-rail: #ff9858;+ --tone-orange-muted: #7b3702;+ --tone-orange-muted-rail: #e7834c;+ --tone-green: #38853e;+ --tone-green-rail: #75d079;+ --tone-teal: #008889;+ --tone-teal-rail: #00d4d5;/* Semantic ruler: brightness separates content from its own band; hue marks state. */--semantic-segment: #417370;--semantic-word: #005551;@@ -43,14 +42,14 @@--intent-depth-1: #c0aa54;--intent-depth-2: #a28b2b;--intent-depth-3: #846d00;- --media: #1777b8;- --media-rail: #58c0ff;- --text-track: #6f63b8;- --text-rail: #b3a6ff;- --caption: #995398;- --caption-rail: #ea93e8;- --visual: #6a737c;- --visual-rail: #aeb9c4;+ --tone-blue: #1777b8;+ --tone-blue-rail: #58c0ff;+ --tone-violet: #6f63b8;+ --tone-violet-rail: #b3a6ff;+ --tone-magenta: #995398;+ --tone-magenta-rail: #ea93e8;+ --tone-neutral: #6a737c;+ --tone-neutral-rail: #aeb9c4;--timeline-label-width: 188px;--source-width: 350px;--workspace-width: 300px;@@ -808,14 +807,14 @@ button:focus-visible, textarea:focus-visible {height: 1.5px;transform: translateY(-50%);}-.track-media { --track: var(--media); --rail: var(--media-rail); }-.track-speech { --track: var(--speech); --rail: var(--speech-rail); }-.track-caption { --track: var(--caption); --rail: var(--caption-rail); }-.track-component { --track: var(--component); --rail: var(--component-rail); }-.track-ranking-reveal { --track: var(--ranking-reveal); --rail: var(--ranking-reveal-rail); }-.track-audio { --track: var(--audio); --rail: var(--audio-rail); }-.track-text { --track: var(--text-track); --rail: var(--text-rail); }-.track-visual { --track: var(--visual); --rail: var(--visual-rail); }+.track-tone-blue { --track: var(--tone-blue); --rail: var(--tone-blue-rail); }+.track-tone-green { --track: var(--tone-green); --rail: var(--tone-green-rail); }+.track-tone-teal { --track: var(--tone-teal); --rail: var(--tone-teal-rail); }+.track-tone-violet { --track: var(--tone-violet); --rail: var(--tone-violet-rail); }+.track-tone-magenta { --track: var(--tone-magenta); --rail: var(--tone-magenta-rail); }+.track-tone-orange { --track: var(--tone-orange); --rail: var(--tone-orange-rail); }+.track-tone-orange-muted { --track: var(--tone-orange-muted); --rail: var(--tone-orange-muted-rail); }+.track-tone-neutral { --track: var(--tone-neutral); --rail: var(--tone-neutral-rail); }.timeline-lanes { position: relative; min-width: 0; cursor: default; user-select: none; touch-action: pan-y; }.ruler {position: sticky;@@ -937,28 +936,30 @@ button:focus-visible, textarea:focus-visible {font-weight: 500;white-space: nowrap;}-.semantic-segment-duration {- flex: 0 0 auto;- color: rgba(255, 255, 255, .75);- font: 500 11px/1 var(--font-mono);- font-variant-numeric: tabular-nums;-}-.semantic-segment:not(.semantic-wide) .semantic-segment-duration { display: none; }.semantic-word.current { background: var(--semantic-current); color: #fff; }-.semantic-word-label { display: block; min-width: 0; overflow: hidden; font-size: 11px; font-weight: 500; line-height: 1; text-overflow: clip; white-space: nowrap; }+.semantic-word-label {+ display: none;+ font-size: 11px;+ font-weight: 500;+ line-height: 1;+ white-space: nowrap;+}+.semantic-word.word-label-visible .semantic-word-label { display: block; }.semantic-cell-content {position: absolute;top: 0;bottom: 0;- left: var(--item-visible-offset, 0);- width: var(--item-visible-width, 100%);+ left: 0;+ width: 100%;min-width: 0;display: flex;align-items: center;+ justify-content: flex-start;gap: 6px;overflow: hidden;- padding: 0 5px;+ padding: 0 0 0 5px;}+.semantic-word .semantic-cell-content { padding: 0 5px; }.semantic-moment {position: absolute;top: 4px;@@ -1074,14 +1075,14 @@ button:focus-visible, textarea:focus-visible {position: absolute;z-index: 3;top: 0;- left: var(--item-visible-offset, 0);- width: var(--item-visible-width, 100%);+ left: 0;+ width: 100%;height: var(--timeline-item-header-height);display: flex;align-items: center;gap: 6px;overflow: hidden;- padding: 0 5px;+ padding: 0 0 0 5px;border-bottom: 1px solid rgba(255, 255, 255, .13);background: var(--item-head);border-radius: var(--timeline-item-radius) var(--timeline-item-radius) 0 0;@@ -1096,13 +1097,16 @@ button:focus-visible, textarea:focus-visible {background: var(--item-body);border-radius: 0 0 var(--timeline-item-radius) var(--timeline-item-radius);}-.clip-material { position: absolute; z-index: 1; inset: 0; overflow: hidden; pointer-events: none; }+.clip-layers { position: absolute; inset: 0; overflow: hidden; pointer-events: none; }+.clip-layer { position: absolute; inset: 0; display: block; overflow: hidden; pointer-events: none; }.clip-material-image, .clip-material-video {background-position: left center;background-size: auto 100%;opacity: 1;}-.clip-material-image { background-repeat: repeat-x; }+.clip-layer-layout-repeat-x { background-repeat: repeat-x; background-position: left center; background-size: auto 100%; }+.clip-layer-layout-cover { background-repeat: no-repeat; background-position: center; background-size: cover; }+.clip-layer-layout-contain { background-repeat: no-repeat; background-position: left center; background-size: contain; }.clip-material-video { background: none; }.clip-video-frame {position: absolute;@@ -1110,30 +1114,19 @@ button:focus-visible, textarea:focus-visible {bottom: 0;background-repeat: no-repeat;}-.clip-material-audio {+.clip-layer-layout-waveform {inset: 2px 5px;background-repeat: no-repeat;background-position: center;background-size: 100% 100%;opacity: .9;}-.clip-material { display: block; }-.clip-content {- position: absolute;- z-index: 2;- top: 0;- bottom: 0;- left: var(--item-visible-offset, 0);- width: var(--item-visible-width, 100%);- min-width: 0;- overflow: hidden;-}-.clip-content-text {- display: none;+.clip-layer-text {+ display: flex;height: 100%;align-items: center;overflow: hidden;- padding: 0 5px;+ padding: 0 0 0 5px;color: #e7e8eb;font-size: 11px;font-weight: 500;@@ -1146,33 +1139,27 @@ button:focus-visible, textarea:focus-visible {.clip-phase-active, .clip-phase-enter, .clip-phase-exit { background: rgba(255, 255, 255, .24); }.clip-phase-settled, .clip-phase-body { background: rgba(255, 255, 255, .10); }.clip-phase-preferred { border-top: 1px dashed rgba(255, 255, 255, .48); background: transparent; }-.clip-name, .clip-meta { display: block; min-width: 0; overflow: hidden; text-overflow: clip; white-space: nowrap; }-.clip-name { flex: 1 1 auto; color: #eef0f3; font-size: 11px; font-weight: 500; }+.clip-name, .clip-meta { display: block; flex: 0 0 auto; white-space: nowrap; }+.clip-name { color: #eef0f3; font-size: 11px; font-weight: 500; }.clip-meta {- flex: 0 0 auto;- display: none;color: rgba(255, 255, 255, .75);font: 500 11px/1 var(--font-mono);font-variant-numeric: tabular-nums;}-.clip-wide .clip-meta { display: block; }-.clip-media { --track: var(--media); }-.clip-speech { --track: var(--speech); }-.clip-audio { --track: var(--audio); }-.clip-text { --track: var(--text-track); }-.clip-caption { --track: var(--caption); }-.clip-component { --track: var(--component); }-.clip-ranking-reveal { --track: var(--ranking-reveal); }-.clip-visual { --track: var(--visual); }-.clip-shape-waveform.clip-has-material .clip-content { display: none; }-.clip-shape-text .clip-content-text { display: flex; }-.clip-shape-group {+.clip-tone-blue { --track: var(--tone-blue); }+.clip-tone-green { --track: var(--tone-green); }+.clip-tone-teal { --track: var(--tone-teal); }+.clip-tone-violet { --track: var(--tone-violet); }+.clip-tone-magenta { --track: var(--tone-magenta); }+.clip-tone-orange { --track: var(--tone-orange); }+.clip-tone-orange-muted { --track: var(--tone-orange-muted); }+.clip-tone-neutral { --track: var(--tone-neutral); }+.clip-chrome-group {border: 0;background: var(--item-body);box-shadow: none;}-.clip-shape-group > .clip-body { background: var(--item-body); }-.clip-shape-group .clip-meta { display: none; }+.clip-chrome-group > .clip-body { background: var(--item-body); }.timeline-hover {position: absolute;top: 0;diff --git a/packages/studio/src/surface-preview.ts b/packages/studio/src/surface-preview.tsindex 87308113..11a771aa 100644--- a/packages/studio/src/surface-preview.ts+++ b/packages/studio/src/surface-preview.ts@@ -18,7 +18,7 @@ export function findSurfacePreview(return domain.surfaces.resolve(module, surface)?.vocabulary?.preview;}-/** A URL for a selected package resource, not a generated Build artifact. */+/** A selected package resource descriptor; transport remains Studio-owned. */export function studioSurfacePreview(domain: StudioDomain,moduleName: string,@@ -30,6 +30,8 @@ export function studioSurfacePreview(if (preview === undefined) return undefined;const kind = kindOf(preview.mediaType);if (kind === undefined) return undefined;- const query = new URLSearchParams({ module: module.name, version: module.version, surface });- return { kind, url: `/__studio/surface-preview?${query.toString()}` };+ return {+ kind,+ source: { kind: "surface-preview", module: module.name, version: module.version, surface },+ };}diff --git a/packages/studio/src/ui/main.ts b/packages/studio/src/ui/main.tsindex 17b3c913..4725dc03 100644--- a/packages/studio/src/ui/main.ts+++ b/packages/studio/src/ui/main.ts@@ -335,7 +335,7 @@ function renderInspector(snapshot: StudioSnapshot, clipId: string | undefined):hero.querySelector(".selection-kind")!.textContent = track === undefined? "Track": `${track.binding.family} · ${track.binding.facet}`;- hero.querySelector("strong")!.textContent = clip.label;+ hero.querySelector("strong")!.textContent = clip.display.title;hero.querySelector("small")!.textContent = track?.label ?? "Visual track";const timing = group("Timing", [@@ -382,10 +382,11 @@ function renderSemanticInspector(snapshot: StudioSnapshot, segmentId: string): vhero.innerHTML = `<span class="selection-icon" data-selection-icon></span><div class="selection-title"><strong></strong><small></small></div>- <span class="selection-kind">Speech</span>`;+ <span class="selection-kind"></span>`;setIcon(hero.querySelector("[data-selection-icon]")!, snapshot.semantic.presentation.icon);hero.querySelector("strong")!.textContent = segment.id;hero.querySelector("small")!.textContent = "Semantic take";+ hero.querySelector(".selection-kind")!.textContent = snapshot.semantic.presentation.label ?? "Semantic";inspector.replaceChildren(hero, group("Timing", [property("Start", `${segment.startFrame}f`, "property-number"),property("End", `${segment.endFrameExclusive}f`, "property-number"),diff --git a/packages/studio/src/ui/material-preview.ts b/packages/studio/src/ui/material-preview.tsindex 3ddbf433..f5cb8df5 100644--- a/packages/studio/src/ui/material-preview.ts+++ b/packages/studio/src/ui/material-preview.ts@@ -14,6 +14,16 @@ const resolvedAudio = new Map<string, string | undefined>();const storyboards = new Map<string, Promise<Storyboard | undefined>>();const resolvedStoryboards = new Map<string, Storyboard | undefined>();+function previewUrl(preview: StudioMaterialPreview): string {+ if (preview.source.kind === "artifact") return `/__studio/material/${preview.source.digest}`;+ const query = new URLSearchParams({+ module: preview.source.module,+ version: preview.source.version,+ surface: preview.source.surface,+ });+ return `/__studio/surface-preview?${query.toString()}`;+}+function positiveHeader(response: Response, name: string): number | undefined {const value = Number(response.headers.get(name));return Number.isFinite(value) && value > 0 ? value : undefined;@@ -132,34 +142,35 @@ function audioPreview(url: string): Promise<string | undefined> {/** Mount only a real selected artifact; failed decoding deliberately leaves the item plain. */export function mountMaterialPreview(target: HTMLElement, preview: StudioMaterialPreview): void {+ const url = previewUrl(preview);target.classList.add(`clip-material-${preview.kind}`);if (preview.kind === "video") {- if (resolvedStoryboards.has(preview.url)) {- const storyboard = resolvedStoryboards.get(preview.url);+ if (resolvedStoryboards.has(url)) {+ const storyboard = resolvedStoryboards.get(url);if (storyboard !== undefined) renderStoryboard(target, storyboard);return;}- void storyboardFor(preview.url).then((storyboard) => {+ void storyboardFor(url).then((storyboard) => {if (storyboard !== undefined) renderStoryboard(target, storyboard);});return;}if (preview.kind === "image") {- target.style.backgroundImage = `url(${JSON.stringify(preview.url)})`;+ target.style.backgroundImage = `url(${JSON.stringify(url)})`;target.classList.add("ready");return;}- if (resolvedAudio.has(preview.url)) {- const url = resolvedAudio.get(preview.url);- if (url !== undefined) {- target.style.backgroundImage = `url(${JSON.stringify(url)})`;+ if (resolvedAudio.has(url)) {+ const waveform = resolvedAudio.get(url);+ if (waveform !== undefined) {+ target.style.backgroundImage = `url(${JSON.stringify(waveform)})`;target.classList.add("ready");}return;}- void audioPreview(preview.url).then((url) => {- if (url === undefined || !target.isConnected) return;- target.style.backgroundImage = `url(${JSON.stringify(url)})`;+ void audioPreview(url).then((waveform) => {+ if (waveform === undefined || !target.isConnected) return;+ target.style.backgroundImage = `url(${JSON.stringify(waveform)})`;target.classList.add("ready");});}diff --git a/packages/studio/src/ui/overlay.ts b/packages/studio/src/ui/overlay.tsindex 1019cfaa..d44eabdf 100644--- a/packages/studio/src/ui/overlay.ts+++ b/packages/studio/src/ui/overlay.ts@@ -111,7 +111,7 @@ export function createOverlay(store: Store, measure: Measure): Overlay {label.setAttribute("x", String(box.xPx + 10));label.setAttribute("y", String(Math.max(28, box.yPx - 12)));label.setAttribute("class", "box-label");- label.textContent = onScreen ? selected.label : `${selected.label} (not at this frame)`;+ label.textContent = onScreen ? selected.display.title : `${selected.display.title} (not at this frame)`;group.append(label);element.append(group);};diff --git a/packages/studio/src/ui/timeline.ts b/packages/studio/src/ui/timeline.tsindex 0ac5fcd8..62b72982 100644--- a/packages/studio/src/ui/timeline.ts+++ b/packages/studio/src/ui/timeline.ts@@ -27,42 +27,22 @@ const itemMetrics = {} as const;const labelFont = '500 11px -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif';-const monoLabelFont = '500 11px "SF Mono", "SFMono-Regular", ui-monospace, Menlo, Monaco, "Cascadia Mono", "Segoe UI Mono", Consolas, monospace';-const graphemes = new Intl.Segmenter(undefined, { granularity: "grapheme" });const textMeasure = document.createElement("canvas").getContext("2d");const textWidths = new Map<string, number>();+const wordLabelPaddingPx = 5;+const wordLabelEnterBufferPx = 1;function measuredText(value: string, font = labelFont): number {const key = `${font}\u0000${value}`;const cached = textWidths.get(key);if (cached !== undefined) return cached;- if (textMeasure === null) return [...graphemes.segment(value)].length * 7;+ if (textMeasure === null) return Array.from(value).length * 7;textMeasure.font = font;const width = textMeasure.measureText(value).width;textWidths.set(key, width);return width;}-/** Return the longest prefix whose final grapheme is wholly visible. */-function fittedText(value: string, width: number): string {- const available = Math.max(0, width - 1);- if (measuredText(value) <= available) return value;- const parts = [...graphemes.segment(value)].map((part) => part.segment);- let low = 0;- let high = parts.length;- while (low < high) {- const middle = Math.ceil((low + high) / 2);- if (measuredText(parts.slice(0, middle).join("")) <= available) low = middle;- else high = middle - 1;- }- return parts.slice(0, low).join("");-}--function fitLabel(node: HTMLElement, value: string, width: number): void {- node.dataset.fullLabel = value;- node.textContent = fittedText(value, width);-}-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")}`;@@ -90,31 +70,14 @@ function displayTrackName(track: StudioSnapshot["tracks"][number]): string {return track.label;}-function clipHeaderLabel(clip: StudioSnapshot["tracks"][number]["clips"][number]): string {- return clip.presentation.shape === "text" ? clip.authoredId : clip.label;-}--function clipBodyLabel(clip: StudioSnapshot["tracks"][number]["clips"][number]): string {- return clip.presentation.shape === "text" ? clip.label : "";-}--/**- * Keep an item's authored geometry intact while placing its text inside the- * portion of that geometry which is actually visible in the current window.- * Material, phases and edit handles must continue to use the full rectangle.- */-function placeVisibleLabel(- node: HTMLElement,+function visibleItemWidth(from: number,to: number,laneWidth: number,): number {const visibleFrom = Math.max(0, from);const visibleTo = Math.min(1, to);- const visibleWidth = Math.max(0, visibleTo - visibleFrom) * laneWidth;- node.style.setProperty("--item-visible-offset", `${Math.max(0, visibleFrom - from) * laneWidth}px`);- node.style.setProperty("--item-visible-width", `${Math.max(1, visibleWidth - itemMetrics.gapPx)}px`);- return visibleWidth;+ return Math.max(0, visibleTo - visibleFrom) * laneWidth;}export function createTimeline(store: Store): Timeline {@@ -183,6 +146,7 @@ export function createTimeline(store: Store): Timeline {let built = -1;let paintFrame = 0;let rebuildFrame = 0;+ const readableWordLabels = new Set<string>();let clipNodes: readonly {readonly node: HTMLElement;readonly start: number;@@ -389,7 +353,7 @@ export function createTimeline(store: Store): Timeline {const next = state.snapshot.semantic.anchors.find((anchor) => anchor.id === target.anchorId)?.frame;if (current === undefined || next === undefined) return undefined;const delta = next - current.frame;- return edit.clip.temporal?.projection?.kind === "point"+ return edit.handle.moveEffect === "move-start"? { startFrame: edit.clip.startFrame + delta, endFrameExclusive: edit.clip.endFrameExclusive }: { startFrame: edit.clip.startFrame + delta, endFrameExclusive: edit.clip.endFrameExclusive + delta };}@@ -599,11 +563,11 @@ export function createTimeline(store: Store): Timeline {// This is one semantic ruler group, not a regular Film lane. Its three// bands share the same inner inset as ordinary items, so the first pixel// of the semantic content aligns with the first pixel of the label card.- const laneHeight = presentation.lane.height.preferredPx;+ const laneHeight = presentation.lane.heightPx;const bandHeight = Math.max(1, (laneHeight - itemMetrics.insetYPx * 2) / 3);const label = createTrackLabel(- presentation.label ?? "Speech",- presentation.family,+ presentation.label ?? "Semantic",+ presentation.tone,presentation.icon,`${snapshot.semantic.segments.length} take${snapshot.semantic.segments.length === 1 ? "" : "s"}`,laneHeight,@@ -612,7 +576,7 @@ export function createTimeline(store: Store): Timeline {labels.append(label);const lane = document.createElement("div");- lane.className = `lane semantic-lane track-${presentation.family}`;+ lane.className = `lane semantic-lane track-tone-${presentation.tone}`;lane.style.height = `${laneHeight}px`;lane.style.setProperty("--semantic-band-height", `${bandHeight}px`);const laneWidth = lanes.clientWidth;@@ -649,20 +613,13 @@ export function createTimeline(store: Store): Timeline {node.style.left = `${from * 100}%`;const segmentWidth = Math.max(0, to - from) * 100;node.style.width = `max(2px, calc(${segmentWidth}% - ${itemMetrics.gapPx}px))`;- const visibleWidthPx = placeVisibleLabel(node, from, to, laneWidth);- node.title = `${segment.id} · ${segment.startFrame}-${segment.endFrameExclusive}f`;+ node.title = segment.id;const segmentLabel = document.createElement("span");segmentLabel.className = "semantic-segment-label";- node.classList.toggle("semantic-wide", visibleWidthPx >= 140);+ segmentLabel.textContent = segment.id;const head = document.createElement("div");head.className = "semantic-cell-content";- const segmentDuration = document.createElement("span");- segmentDuration.className = "semantic-segment-duration";- const segmentDurationText = `${segment.endFrameExclusive - segment.startFrame}f`;- segmentDuration.textContent = segmentDurationText;- fitLabel(segmentLabel, segment.id, visibleWidthPx - itemMetrics.gapPx - 10- - (visibleWidthPx >= 140 ? measuredText(segmentDurationText, monoLabelFont) + 6 : 0));- head.append(segmentLabel, segmentDuration);+ head.append(segmentLabel);node.append(head);node.addEventListener("click", (event) => {event.stopPropagation();@@ -694,12 +651,22 @@ export function createTimeline(store: Store): Timeline {word.dataset.semanticToken = token.id;word.setAttribute("aria-label", token.text);word.style.left = `${wordFrom * 100}%`;- word.style.width = `max(1px, calc(${Math.max(0, wordTo - wordFrom) * 100}% - 1px))`;- const wordVisibleWidth = placeVisibleLabel(word, wordFrom, wordTo, laneWidth);- word.title = `${token.text} · ${token.startFrame}-${token.endFrameExclusive}f`;+ const wordWidth = Math.max(0, wordTo - wordFrom);+ word.style.width = `max(1px, calc(${wordWidth * 100}% - ${itemMetrics.gapPx}px))`;+ word.title = token.text;const text = document.createElement("span");text.className = "semantic-word-label";- fitLabel(text, token.text, wordVisibleWidth - itemMetrics.gapPx - 10);+ text.textContent = token.text;+ const wordWidthPx = Math.max(1, wordWidth * laneWidth - itemMetrics.gapPx);+ const textWidthPx = measuredText(token.text);+ const contentWidthPx = Math.max(0, wordWidthPx - wordLabelPaddingPx * 2);+ const wasReadable = readableWordLabels.has(token.id);+ const textFitsCell = contentWidthPx >= textWidthPx + (wasReadable ? 0 : wordLabelEnterBufferPx);+ if (textFitsCell) readableWordLabels.add(token.id);+ else readableWordLabels.delete(token.id);+ const textFitsViewport = wordFrom >= 0+ && wordFrom * laneWidth + wordLabelPaddingPx * 2 + textWidthPx <= laneWidth;+ word.classList.toggle("word-label-visible", textFitsCell && textFitsViewport);const wordContent = document.createElement("span");wordContent.className = "semantic-cell-content";wordContent.append(text);@@ -722,11 +689,10 @@ export function createTimeline(store: Store): Timeline {node.setAttribute("aria-label", `Selection ${selection.id}`);node.style.left = `${from * 100}%`;node.style.width = `max(2px, calc(${Math.max(0, to - from) * 100}% - ${itemMetrics.gapPx}px))`;- const selectionVisibleWidth = placeVisibleLabel(node, from, to, laneWidth);- node.title = `${selection.id} · ${selection.startFrame}-${selection.endFrameExclusive}f`;+ node.title = selection.id;const selectionLabel = document.createElement("span");selectionLabel.className = "semantic-selection-label";- fitLabel(selectionLabel, selection.id, selectionVisibleWidth - itemMetrics.gapPx - 10);+ selectionLabel.textContent = selection.id;const selectionContent = document.createElement("div");selectionContent.className = "semantic-cell-content";selectionContent.append(selectionLabel);@@ -748,7 +714,7 @@ export function createTimeline(store: Store): Timeline {node.tabIndex = 0;node.setAttribute("aria-label", `Moment ${moment.id}`);node.style.left = `${at * 100}%`;- node.title = `${moment.id} · ${moment.frame}f`;+ node.title = moment.id;node.addEventListener("click", (event) => {event.stopPropagation();store.selectSemanticMoment(moment.id, "timeline");@@ -766,7 +732,7 @@ export function createTimeline(store: Store): Timeline {nextClipNodes: { node: HTMLElement; start: number; end: number; id: string }[],attached = false,): void => {- const kind = track.binding.family;+ const tone = track.binding.tone;const freeFrom: number[] = [];const rowOf = new Map<string, number>();for (const clip of [...track.clips].sort((a, b) => b.stackOrder - a.stackOrder || a.startFrame - b.startFrame)) {@@ -778,11 +744,11 @@ export function createTimeline(store: Store): Timeline {const depth = Math.max(1, freeFrom.length);const folded = depth > 1 && !opened.has(track.id);const shownRows = folded ? 1 : depth;- const laneHeight = track.binding.lane.height.preferredPx;+ const laneHeight = track.binding.lane.heightPx;const displayedItems = track.clips.length;const label = createTrackLabel(displayTrackName(track),- kind,+ tone,track.binding.icon,`${displayedItems} item${displayedItems === 1 ? "" : "s"}`,shownRows * laneHeight,@@ -809,15 +775,13 @@ export function createTimeline(store: Store): Timeline {labels.append(label);const lane = document.createElement("div");- lane.className = `lane track-${kind} track-facet-${track.binding.facet}${attached ? " lane-attached" : ""}`;+ lane.className = `lane track-tone-${tone} track-facet-${track.binding.facet}${attached ? " lane-attached" : ""}`;lane.style.height = `${shownRows * laneHeight}px`;lane.style.setProperty("--lane-height", `${laneHeight}px`);- lane.style.setProperty("--lane-min-height", `${track.binding.lane.height.minPx}px`);- lane.style.setProperty("--lane-max-height", `${track.binding.lane.height.maxPx}px`);const laneWidth = lanes.clientWidth;const materialMounts: {readonly target: HTMLElement;- readonly preview: NonNullable<StudioSnapshot["tracks"][number]["clips"][number]["preview"]>;+ readonly preview: Extract<StudioSnapshot["tracks"][number]["clips"][number]["display"]["layers"][number], { readonly kind: "preview" }>["preview"];}[] = [];for (const clip of track.clips) {const from = place(clip.startFrame, snapshot.space.frameCount, zoom.window());@@ -827,23 +791,30 @@ export function createTimeline(store: Store): Timeline {if (folded && row > 0) continue;const node = document.createElement("button");node.type = "button";- node.className = `clip clip-${kind} clip-facet-${track.binding.facet} clip-shape-${clip.presentation.shape}`;+ node.className = `clip clip-tone-${tone} clip-facet-${track.binding.facet} clip-chrome-${clip.presentation.chrome}`;node.classList.toggle("clip-editable", clip.editHandles.some((handle) => handle.enabled));node.dataset.clip = clip.id;- node.setAttribute("aria-label", clip.label);+ node.setAttribute("aria-label", clip.display.title);node.style.left = `${from * 100}%`;node.style.width = `max(2px, calc(${Math.max(0, to - from) * 100}% - ${itemMetrics.gapPx}px))`;- const visibleWidthPx = placeVisibleLabel(node, from, to, laneWidth);- node.classList.toggle("clip-wide", visibleWidthPx >= 110);+ const visibleWidthPx = visibleItemWidth(from, to, laneWidth);node.classList.toggle("clip-preview-wide", visibleWidthPx >= 92);node.style.top = `${row * laneHeight}px`;- node.title = `${clip.label} · ${clip.startFrame}-${clip.endFrameExclusive}f`;- node.innerHTML = `<span class="clip-head"><span class="clip-name"></span><span class="clip-meta"></span></span><span class="clip-body"><span class="clip-material" aria-hidden="true"></span><span class="clip-content"><span class="clip-content-text"></span></span><span class="clip-phases"></span></span><span class="clip-selection" aria-hidden="true"></span>`;- const material = node.querySelector<HTMLElement>(".clip-material")!;- if (clip.preview !== undefined) {- node.classList.add("clip-has-material");- materialMounts.push({ target: material, preview: clip.preview });- }+ node.title = `${clip.display.title} · ${clip.startFrame}-${clip.endFrameExclusive}f`;+ node.innerHTML = `<span class="clip-head"><span class="clip-name"></span><span class="clip-meta"></span></span><span class="clip-body"><span class="clip-layers" aria-hidden="true"></span><span class="clip-phases"></span></span><span class="clip-selection" aria-hidden="true"></span>`;+ const layers = node.querySelector<HTMLElement>(".clip-layers")!;+ clip.display.layers.forEach((layer, index) => {+ const layerNode = document.createElement("span");+ layerNode.className = `clip-layer clip-layer-${layer.kind} clip-layer-role-${layer.role}`;+ layerNode.style.zIndex = String(index + 1);+ if (layer.kind === "text") {+ layerNode.textContent = layer.text;+ } else {+ layerNode.classList.add(`clip-layer-layout-${layer.layout}`);+ materialMounts.push({ target: layerNode, preview: layer.preview });+ }+ layers.append(layerNode);+ });const phaseLayer = node.querySelector<HTMLElement>(".clip-phases")!;for (const phase of clip.temporal?.phases ?? []) {if (phase.endFrameExclusive <= clip.startFrame || phase.startFrame >= clip.endFrameExclusive) continue;@@ -853,13 +824,12 @@ export function createTimeline(store: Store): Timeline {phaseNode.style.width = `${(phase.endFrameExclusive - phase.startFrame) / Math.max(1, clip.endFrameExclusive - clip.startFrame) * 100}%`;phaseLayer.append(phaseNode);}- const metaText = `${((clip.endFrameExclusive - clip.startFrame) / fps(snapshot)).toFixed(2)}s`;+ const metaText = clip.presentation.chrome === "point"+ ? `${(clip.startFrame / fps(snapshot)).toFixed(2)}s`+ : `${((clip.endFrameExclusive - clip.startFrame) / fps(snapshot)).toFixed(2)}s`;const headerLabel = node.querySelector<HTMLElement>(".clip-name")!;- const bodyLabel = node.querySelector<HTMLElement>(".clip-content-text")!;node.querySelector(".clip-meta")!.textContent = metaText;- fitLabel(headerLabel, clipHeaderLabel(clip), visibleWidthPx - itemMetrics.gapPx - 10- - (visibleWidthPx >= 110 ? measuredText(metaText, monoLabelFont) + 6 : 0));- fitLabel(bodyLabel, clipBodyLabel(clip), visibleWidthPx - itemMetrics.gapPx - 10);+ headerLabel.textContent = clip.display.title;node.addEventListener("pointerdown", (event) => {const rect = node.getBoundingClientRect();const edge = Math.min(8, Math.max(4, rect.width / 3));@@ -897,7 +867,7 @@ export function createTimeline(store: Store): Timeline {store.select(clip.id, "timeline");return;}- if (clip.interaction.select) store.select(clip.id, "timeline");+ store.select(clip.id, "timeline");});node.addEventListener("dblclick", () => store.seek(clip.startFrame, "timeline"));nextClipNodes.push({ node, start: clip.startFrame, end: clip.endFrameExclusive, id: clip.id });diff --git a/packages/studio/test/parameters.test.ts b/packages/studio/test/parameters.test.tsindex 7e1be01e..46f6054e 100644--- a/packages/studio/test/parameters.test.ts+++ b/packages/studio/test/parameters.test.ts@@ -6,15 +6,17 @@ import type {StudioSemanticTimeline,StudioTemporalLineage,} from "@hypit/studio-adapter";+import { projectedWindowTimelineEdits } from "@hypit/studio-adapter";import type { MarkupSurfaceRegistryLike, RegisteredSurface } from "@hypit/markup";-import { parametersForDraft, timelineAdjustHandles } from "../src/parameters.js";+import { parametersForDraft, resolveTimelineEditHandles } from "../src/parameters.js";const semantic: StudioSemanticTimeline = {presentation: {family: "speech",- icon: "speech",- lane: { layout: "flat", height: { minPx: 44, preferredPx: 52, maxPx: 96 } },+ tone: "teal",+ icon: "timeline",+ lane: { heightPx: 52 },},anchors: [{ id: "segment:a:start", kind: "segment-start", frame: 0, segmentId: "a" },@@ -47,7 +49,9 @@ test("timeline gestures resolve through the shared Selection identity", () => {},phases: [],};- const handles = timelineAdjustHandles([], ["move", "trim-start", "trim-end"], temporal, semantic);+ const handles = resolveTimelineEditHandles(+ [], projectedWindowTimelineEdits({ start: "start", end: "end", duration: "for" }), temporal, semantic,+ );assert.deepEqual(handles.map((handle) => [handle.operation, handle.gesture, handle.coordinate, handle.enabled]), [["timeline.adjust", "move", "semantic-anchor", true],@@ -63,7 +67,9 @@ test("timeline gestures resolve through the shared Selection identity", () => {});test("moving a Moment projection resolves to the shared Moment identity", () => {- const handles = timelineAdjustHandles([], ["move", "trim-start", "trim-end"], {+ const handles = resolveTimelineEditHandles([], projectedWindowTimelineEdits({+ start: "start", end: "end", duration: "for",+ }), {source: { kind: "moment", id: "beat" },projection: { kind: "point", expression: "moment.beat", frame: 12 },phases: [],@@ -84,6 +90,48 @@ test("moving a Moment projection resolves to the shared Moment identity", () =>});});+test("absolute Window edits use only the Companion's exact parameter vocabulary", () => {+ const source = (start: number, end: number) => ({+ path: "main.svml",+ range: { start, end },+ preimage: "1f",+ });+ const parameters = [+ {+ id: "from", name: "from", label: "From", control: "text" as const,+ value: "1f", language: "svml" as const, writable: true, source: source(0, 2),+ },+ {+ id: "until", name: "until", label: "Until", control: "text" as const,+ value: "20f", language: "svml" as const, writable: true, source: source(3, 6),+ },+ ];+ const handles = resolveTimelineEditHandles(+ parameters,+ projectedWindowTimelineEdits({ start: "from", end: "until", duration: "length" }),+ {+ source: { kind: "program" },+ projection: {+ kind: "window", startExpression: "1f", endExpression: "20f",+ startFrame: 1, endFrameExclusive: 20,+ },+ phases: [],+ },+ semantic,+ );++ assert.deepEqual(handles.map((handle) => ({+ gesture: handle.gesture,+ enabled: handle.enabled,+ roles: handle.sources?.map((item) => item.role),+ starts: handle.sources?.map((item) => item.source.range.start),+ })), [+ { gesture: "move", enabled: true, roles: ["start", "end"], starts: [0, 3] },+ { gesture: "trim-start", enabled: true, roles: ["start"], starts: [0] },+ { gesture: "trim-end", enabled: true, roles: ["end"], starts: [3] },+ ]);+});+test("parameter Source paths stay relative to the author workspace", () => {const text = "start=\"1f\"";const parameters = parametersForDraft({@@ -102,7 +150,7 @@ test("parameter Source paths stay relative to the author workspace", () => {referenceAttributes: {}, referenceTypes: {}, references: [],},draft: {- id: "entity:item", authoredId: "item", label: "item",+ id: "entity:item", authoredId: "item", display: { title: "item", layers: [] },startFrame: 1, endFrameExclusive: 2, stackOrder: 0,elementRange: { start: 0, end: text.length },},@@ -113,7 +161,7 @@ test("parameter Source paths stay relative to the author workspace", () => {assert.equal(parameters[0]!.source.preimage, "1f");});-test("a derived entity follows its actual Style and the package-owned Recipe vocabulary", () => {+test("a derived entity follows its actual Style and Companion-owned Recipe presentation", () => {const main = "<caption-fine:Track id=\"captions\" program={caption-program}/>";const sheet = `<sheet version="1">caption.alt { x: 0.4; handoff: overlap; }@@ -148,8 +196,8 @@ test("a derived entity follows its actual Style and the package-owned Recipe vocvocabulary: { summary: "Caption Style", example: "<Style/>", attributes: [{name: "recipe", kind: "reference", required: true, summary: "Recipe",recipe: [- { name: "x", required: true, summary: "Horizontal position", group: "where", section: "region" },- { name: "handoff", required: false, summary: "Cue handoff", group: "when", section: "envelope", values: ["cut", "overlap"] },+ { name: "x", required: true, summary: "Horizontal position" },+ { name: "handoff", required: false, summary: "Cue handoff", values: ["cut", "overlap"] },],}] },handler: () => ({ records: [], components: [], fragments: [], exports: [] }),@@ -170,12 +218,21 @@ test("a derived entity follows its actual Style and the package-owned Recipe vocplacement: track,placements: [track, style],draft: {- id: "captions:cue:2", authoredId: "captions", presentId: "cue:2", label: "cue:2",+ id: "captions:cue:2", authoredId: "captions", presentId: "cue:2", display: { title: "cue:2", layers: [] },startFrame: 0, endFrameExclusive: 10, stackOrder: 70,elementRange: track.range,parameterReferences: { program: "alternate-caption" },},- declarations: [{ name: "program", label: "Program", writable: false }],+ declarations: [{+ name: "program", label: "Program", writable: false,+ recipe: {+ through: ["recipe"],+ parameters: [+ { name: "x", group: "where", section: "region" },+ { name: "handoff", group: "when", section: "envelope" },+ ],+ },+ }],surfaces,});diff --git a/packages/typography-track-studio/README.md b/packages/typography-track-studio/README.mdnew file mode 100644index 00000000..0a931e29--- /dev/null+++ b/packages/typography-track-studio/README.md@@ -0,0 +1,3 @@+# `@hypit/typography-track-studio`++Hypit Studio Companion for `@hypit/typography-track`.diff --git a/packages/typography-track-studio/package.json b/packages/typography-track-studio/package.jsonnew file mode 100644index 00000000..40c31600--- /dev/null+++ b/packages/typography-track-studio/package.json@@ -0,0 +1,13 @@+{+ "name": "@hypit/typography-track-studio",+ "version": "0.0.0-dev",+ "license": "SEE LICENSE IN LICENSE",+ "private": true,+ "type": "module",+ "exports": { ".": "./src/index.ts" },+ "hypit": { "activation": "./src/activation.ts" },+ "dependencies": {+ "@hypit/studio-adapter": "workspace:*",+ "@hypit/typography-track": "workspace:*"+ }+}diff --git a/packages/typography-track-studio/src/activation.ts b/packages/typography-track-studio/src/activation.tsnew file mode 100644index 00000000..32773d1f--- /dev/null+++ b/packages/typography-track-studio/src/activation.ts@@ -0,0 +1,7 @@+import { createStudioAdapterHostFacet } from "@hypit/studio-adapter";+import { typographyTrackStudioAdapters } from "./index.js";++export default {+ format: "hypit.node-package@1" as const,+ hostFacets: [createStudioAdapterHostFacet(typographyTrackStudioAdapters)],+};diff --git a/packages/typography-track-studio/src/index.ts b/packages/typography-track-studio/src/index.tsnew file mode 100644index 00000000..b12032f9--- /dev/null+++ b/packages/typography-track-studio/src/index.ts@@ -0,0 +1,74 @@+import { typographyTrackMarkupSurfaces } from "@hypit/typography-track";+import type { TypographyTrackProgram } from "@hypit/typography-track";+import type { StudioAdapter, StudioAdapterContext, StudioEntityDraft, StudioRecipeParameterDeclaration } from "@hypit/studio-adapter";+import { childEntities, projectedWindowTimelineEdits, requiredSurfaceValue, temporalLineageFor, textLayer } from "@hypit/studio-adapter";++const typographyStyleRecipe: readonly StudioRecipeParameterDeclaration[] = (typographyTrackMarkupSurfaces+ .find((surface) => surface.name === "style")?.vocabulary.attributes+ .find((attribute) => attribute.name === "recipe")?.recipe ?? []).map((property) => {+ const where = [+ "stack-order", "inline-size", "block-size", "padding", "align", "block-align", "wrap", "overflow",+ "max-lines", "minimum-scale", "clip", "columns", "column-gap", "point-anchor-x", "point-anchor-y",+ ].includes(property.name) || property.name.startsWith("path-");+ return {+ name: property.name,+ group: where ? "where" : "how",+ section: where ? "layout" : "typography",+ };+ });++function textOf(item: TypographyTrackProgram["items"][number]): string {+ return item.document.paragraphs.map((paragraph) => paragraph.inlines+ .map((inline) => inline.kind === "text" ? inline.text : " ")+ .join(""))+ .join(" ")+ .replace(/\s+/gu, " ")+ .trim();+}++function projectTypography(context: StudioAdapterContext): readonly StudioEntityDraft[] {+ const program = requiredSurfaceValue(context, "program") as TypographyTrackProgram;+ const items = program.items.map((item) => ({+ id: item.id,+ startFrame: item.span.startFrame,+ endFrameExclusive: item.span.endFrameExclusive,+ stackOrder: item.style.stackingOrder,+ }));+ return childEntities(context, items, "typography-item", "standard").map((entity, index) => {+ const item = program.items[index];+ if (item === undefined) return entity;+ const label = textOf(item);+ const temporal = temporalLineageFor(context, item.id, "window");+ return {+ ...entity,+ display: { ...entity.display, layers: label.length === 0 ? [] : [textLayer(label)] },+ ...(temporal?.source.kind === "program" || temporal?.source.id === undefined+ ? {}+ : { markerId: temporal.source.id }),+ ...(temporal === undefined ? {} : { temporal }),+ };+ });+}++export const typographyTrackStudioAdapters: readonly StudioAdapter[] = [+ {+ id: "track", role: "track",+ output: { type: "VisualTrack", surface: "track", modules: ["@hypit/typography-track"] },+ family: "text", tone: "violet", icon: "text",+ timelineEdits: projectedWindowTimelineEdits({ start: "start", end: "end", duration: "for" }),+ parameters: [+ { name: "placement", label: "Placement", writable: false },+ { name: "content", label: "Content", writable: false },+ { name: "start", label: "Start", writable: true },+ { name: "end", label: "End", writable: true },+ { name: "for", label: "For", writable: true },+ {+ name: "style", label: "Style", writable: false,+ recipe: { through: ["recipe"], parameters: typographyStyleRecipe },+ },+ { name: "motion", label: "Motion", writable: false },+ ],+ requiredValues: ["program"], project: projectTypography,+ lane: { heightPx: 48 },+ },+];diff --git a/pnpm-lock.yaml b/pnpm-lock.yamlindex 634a6d24..181a0185 100644--- a/pnpm-lock.yaml+++ b/pnpm-lock.yaml@@ -24,6 +24,9 @@ importers:'@hypit/audio-track':specifier: workspace:*version: link:packages/audio-track+ '@hypit/audio-track-studio':+ specifier: workspace:*+ version: link:packages/audio-track-studio'@hypit/background-removal':specifier: workspace:*version: link:packages/background-removal@@ -33,9 +36,15 @@ importers:'@hypit/caption-fine':specifier: workspace:*version: link:packages/caption-fine+ '@hypit/caption-fine-studio':+ specifier: workspace:*+ version: link:packages/caption-fine-studio'@hypit/comment-sticker':specifier: workspace:*version: link:packages/comment-sticker+ '@hypit/comment-sticker-studio':+ specifier: workspace:*+ version: link:packages/comment-sticker-studio'@hypit/composition':specifier: workspace:*version: link:packages/composition@@ -48,6 +57,9 @@ importers:'@hypit/deck-track':specifier: workspace:*version: link:packages/deck-track+ '@hypit/deck-track-studio':+ specifier: workspace:*+ version: link:packages/deck-track-studio'@hypit/estimate':specifier: workspace:*version: link:packages/estimate@@ -84,6 +96,9 @@ importers:'@hypit/media-track':specifier: workspace:*version: link:packages/media-track+ '@hypit/media-track-studio':+ specifier: workspace:*+ version: link:packages/media-track-studio'@hypit/mimo-tts':specifier: workspace:*version: link:packages/mimo-tts@@ -129,6 +144,9 @@ importers:'@hypit/ranking':specifier: workspace:*version: link:packages/ranking+ '@hypit/ranking-studio':+ specifier: workspace:*+ version: link:packages/ranking-studio'@hypit/raster':specifier: workspace:*version: link:packages/raster@@ -150,6 +168,9 @@ importers:'@hypit/screen-overlay':specifier: workspace:*version: link:packages/screen-overlay+ '@hypit/screen-overlay-studio':+ specifier: workspace:*+ version: link:packages/screen-overlay-studio'@hypit/script':specifier: workspace:*version: link:packages/script@@ -180,15 +201,15 @@ importers:'@hypit/speech-track':specifier: workspace:*version: link:packages/speech-track+ '@hypit/speech-track-studio':+ specifier: workspace:*+ version: link:packages/speech-track-studio'@hypit/store-sqlite':specifier: workspace:*version: link:packages/store-sqlite'@hypit/studio-adapter':specifier: workspace:*version: link:packages/studio-adapter- '@hypit/studio-video-adapters':- specifier: workspace:*- version: link:packages/studio-video-adapters'@hypit/svs':specifier: workspace:*version: link:packages/svs@@ -201,6 +222,9 @@ importers:'@hypit/typography-track':specifier: workspace:*version: link:packages/typography-track+ '@hypit/typography-track-studio':+ specifier: workspace:*+ version: link:packages/typography-track-studio'@hypit/visual-ir':specifier: workspace:*version: link:packages/visual-ir@@ -308,6 +332,15 @@ importers:specifier: workspace:*version: link:../visual-ir+ packages/audio-track-studio:+ dependencies:+ '@hypit/audio-track':+ specifier: workspace:*+ version: link:../audio-track+ '@hypit/studio-adapter':+ specifier: workspace:*+ version: link:../studio-adapter+packages/background-removal:dependencies:'@hypit/artifact':@@ -403,6 +436,18 @@ importers:specifier: workspace:*version: link:../script+ packages/caption-fine-studio:+ dependencies:+ '@hypit/caption-fine':+ specifier: workspace:*+ version: link:../caption-fine+ '@hypit/narrative':+ specifier: workspace:*+ version: link:../narrative+ '@hypit/studio-adapter':+ specifier: workspace:*+ version: link:../studio-adapter+packages/cli:dependencies:'@hypit/compiler-node':@@ -482,6 +527,15 @@ importers:specifier: workspace:*version: link:../hyperframes+ packages/comment-sticker-studio:+ dependencies:+ '@hypit/comment-sticker':+ specifier: workspace:*+ version: link:../comment-sticker+ '@hypit/studio-adapter':+ specifier: workspace:*+ version: link:../studio-adapter+packages/compiler-markup-node:dependencies:'@hypit/compiler-node':@@ -669,6 +723,15 @@ importers:specifier: workspace:*version: link:../media-pipeline+ packages/deck-track-studio:+ dependencies:+ '@hypit/deck-track':+ specifier: workspace:*+ version: link:../deck-track+ '@hypit/studio-adapter':+ specifier: workspace:*+ version: link:../studio-adapter+packages/driver-node:dependencies:'@hypit/component-kit':@@ -1462,6 +1525,15 @@ importers:specifier: workspace:*version: link:../temporal+ packages/media-track-studio:+ dependencies:+ '@hypit/media-track':+ specifier: workspace:*+ version: link:../media-track+ '@hypit/studio-adapter':+ specifier: workspace:*+ version: link:../studio-adapter+packages/mimo-tts:dependencies:'@hypit/artifact':@@ -1950,6 +2022,15 @@ importers:specifier: workspace:*version: link:../core+ packages/ranking-studio:+ dependencies:+ '@hypit/ranking':+ specifier: workspace:*+ version: link:../ranking+ '@hypit/studio-adapter':+ specifier: workspace:*+ version: link:../studio-adapter+packages/raster:dependencies:'@hypit/artifact':@@ -2222,6 +2303,15 @@ importers:specifier: workspace:*version: link:../visual-ir+ packages/screen-overlay-studio:+ dependencies:+ '@hypit/screen-overlay':+ specifier: workspace:*+ version: link:../screen-overlay+ '@hypit/studio-adapter':+ specifier: workspace:*+ version: link:../studio-adapter+packages/script:dependencies:'@hypit/markup':@@ -2439,6 +2529,15 @@ importers:specifier: workspace:*version: link:../validation+ packages/speech-track-studio:+ dependencies:+ '@hypit/speech-track':+ specifier: workspace:*+ version: link:../speech-track+ '@hypit/studio-adapter':+ specifier: workspace:*+ version: link:../studio-adapter+packages/store-sqlite:dependencies:'@hypit/core':@@ -2453,9 +2552,18 @@ importers:packages/studio:dependencies:+ '@hypit/audio-track-studio':+ specifier: workspace:*+ version: link:../audio-track-studio+ '@hypit/caption-fine-studio':+ specifier: workspace:*+ version: link:../caption-fine-studio'@hypit/cli':specifier: workspace:*version: link:../cli+ '@hypit/comment-sticker-studio':+ specifier: workspace:*+ version: link:../comment-sticker-studio'@hypit/compiler-node':specifier: workspace:*version: link:../compiler-node@@ -2468,6 +2576,9 @@ importers:'@hypit/core':specifier: workspace:*version: link:../core+ '@hypit/deck-track-studio':+ specifier: workspace:*+ version: link:../deck-track-studio'@hypit/driver-node':specifier: workspace:*version: link:../driver-node@@ -2480,6 +2591,9 @@ importers:'@hypit/markup':specifier: workspace:*version: link:../markup+ '@hypit/media-track-studio':+ specifier: workspace:*+ version: link:../media-track-studio'@hypit/package-loader-node':specifier: workspace:*version: link:../package-loader-node@@ -2489,6 +2603,9 @@ importers:'@hypit/protocol':specifier: workspace:*version: link:../protocol+ '@hypit/ranking-studio':+ specifier: workspace:*+ version: link:../ranking-studio'@hypit/run':specifier: workspace:*version: link:../run@@ -2498,21 +2615,27 @@ importers:'@hypit/runtime-host-node':specifier: workspace:*version: link:../runtime-host-node+ '@hypit/screen-overlay-studio':+ specifier: workspace:*+ version: link:../screen-overlay-studio'@hypit/script':specifier: workspace:*version: link:../script'@hypit/semantic-track':specifier: workspace:*version: link:../semantic-track+ '@hypit/speech-track-studio':+ specifier: workspace:*+ version: link:../speech-track-studio'@hypit/studio-adapter':specifier: workspace:*version: link:../studio-adapter- '@hypit/studio-video-adapters':- specifier: workspace:*- version: link:../studio-video-adapters'@hypit/svs':specifier: workspace:*version: link:../svs+ '@hypit/typography-track-studio':+ specifier: workspace:*+ version: link:../typography-track-studio'@hypit/validation':specifier: workspace:*version: link:../validation@@ -2535,12 +2658,6 @@ importers:specifier: workspace:*version: link:../host- packages/studio-video-adapters:- dependencies:- '@hypit/studio-adapter':- specifier: workspace:*- version: link:../studio-adapter-packages/svs:dependencies:'@hypit/core':@@ -2657,6 +2774,15 @@ importers:specifier: workspace:*version: link:../validation+ packages/typography-track-studio:+ dependencies:+ '@hypit/studio-adapter':+ specifier: workspace:*+ version: link:../studio-adapter+ '@hypit/typography-track':+ specifier: workspace:*+ version: link:../typography-track+packages/validation:dependencies:'@hypit/component-kit':