Skip to content

armgit / hypit

Public Imported from GitHub
0

Clone any viral video with AI agents. Not just a script, the whole workflow: swap the face, the words, the B-roll, ship 100 variants in one command, and get your 100M views.

refactor: close temporal domain ownership

kashorin190c54c435a2
diff --git a/examples/complex-explainer/packages/launch-scenes/src/activation.js b/examples/complex-explainer/packages/launch-scenes/src/activation.js
index 4f2bb06b..22283300 100644
--- a/examples/complex-explainer/packages/launch-scenes/src/activation.js
+++ b/examples/complex-explainer/packages/launch-scenes/src/activation.js
@@ -32,7 +32,7 @@ const module = { name: "@explainer/launch-scenes", version: "1" },
const options = type("Options"),
events = type("Events");
const common = [
- port("timeline", timelineTypes.track),
+ port("timeline", timelineTypes.timeline),
port("within", spatialTypes.frame),
port("window", temporalTypes.window),
port("font", mediaTypes.fontArtifact),
@@ -65,7 +65,7 @@ export const manifest = {
compositionTypes.visualTrack,
mediaTypes.fontArtifact,
mediaTypes.blobArtifact,
- timelineTypes.track,
+ timelineTypes.timeline,
spatialTypes.frame,
temporalTypes.window,
temporalTypes.instant,
@@ -80,7 +80,7 @@ export const manifest = {
{
name: "append",
inputs: [
- port("timeline", timelineTypes.track),
+ port("timeline", timelineTypes.timeline),
port("events", events),
port("options", options),
port("at", temporalTypes.instant),
diff --git a/examples/complex-explainer/packages/opening-system/src/activation.js b/examples/complex-explainer/packages/opening-system/src/activation.js
index 946b873d..6c407cd9 100644
--- a/examples/complex-explainer/packages/opening-system/src/activation.js
+++ b/examples/complex-explainer/packages/opening-system/src/activation.js
@@ -35,7 +35,7 @@ const optionsType = type("Options"),
const producer = (name) => ({ module, name });
const port = (name, type) => ({ name, type });
const common = [
- port("timeline", timelineTypes.track),
+ port("timeline", timelineTypes.timeline),
port("within", spatialTypes.frame),
port("window", temporalTypes.window),
port("options", optionsType),
@@ -50,7 +50,7 @@ export const manifest = {
mediaTypes.fontArtifact,
mediaTypes.synchronized,
mediaTypes.blobArtifact,
- timelineTypes.track,
+ timelineTypes.timeline,
spatialTypes.frame,
temporalTypes.window,
temporalTypes.duration, temporalTypes.extent, temporalTypes.shiftSpec,
@@ -441,7 +441,7 @@ const declarations = Object.keys(defaults).map((tag) => ({
optionsType,
itemsType,
compositionTypes.visualTrack,
- timelineTypes.track,
+ timelineTypes.timeline,
temporalTypes.window,
temporalTypes.instant,
temporalTypes.windowSpec,
diff --git a/examples/complex-explainer/packages/opening-system/src/portrait-inset.js b/examples/complex-explainer/packages/opening-system/src/portrait-inset.js
index bbf70202..4a130093 100644
--- a/examples/complex-explainer/packages/opening-system/src/portrait-inset.js
+++ b/examples/complex-explainer/packages/opening-system/src/portrait-inset.js
@@ -20,7 +20,7 @@ const styles = (o) =>
export function installPortraitInset(module, manifest, component) {
const types = presenterTypes(module);
const inputs = [
- { name: "timeline", type: timelineTypes.track },
+ { name: "timeline", type: timelineTypes.timeline },
{ name: "within", type: spatialTypes.frame },
{ name: "window", type: temporalTypes.window },
{ name: "sources", type: types.sources },
diff --git a/examples/complex-explainer/packages/opening-system/src/portrait-transition.js b/examples/complex-explainer/packages/opening-system/src/portrait-transition.js
index ee2ebbd5..62f86c4d 100644
--- a/examples/complex-explainer/packages/opening-system/src/portrait-transition.js
+++ b/examples/complex-explainer/packages/opening-system/src/portrait-transition.js
@@ -20,7 +20,7 @@ const styles = (o) =>
export function installPortraitTransition(module, manifest, component) {
const types = presenterTypes(module);
const inputs = [
- { name: "timeline", type: timelineTypes.track },
+ { name: "timeline", type: timelineTypes.timeline },
{ name: "within", type: spatialTypes.frame },
{ name: "window", type: temporalTypes.window },
{ name: "sources", type: types.sources },
diff --git a/examples/complex-explainer/packages/opening-system/src/presenter.js b/examples/complex-explainer/packages/opening-system/src/presenter.js
index 904b64ea..5c03f4a2 100644
--- a/examples/complex-explainer/packages/opening-system/src/presenter.js
+++ b/examples/complex-explainer/packages/opening-system/src/presenter.js
@@ -167,19 +167,19 @@ export function installPresenter(module, manifest, component) {
ordinary: { module, name: "ordinary-presenter" },
};
const common = [
- { name: "timeline", type: timelineTypes.track },
+ { name: "timeline", type: timelineTypes.timeline },
{ name: "window", type: temporalTypes.window },
{ name: "sources", type: types.sources },
];
manifest.producers.push(
{ name: producers.source.name, inputs: [
{ name: "spec", type: types.sourceSpec }, { name: "media", type: mediaTypes.synchronized },
- { name: "window", type: temporalTypes.window }, { name: "timeline", type: timelineTypes.track },
+ { name: "window", type: temporalTypes.window }, { name: "timeline", type: timelineTypes.timeline },
], outputs: [{ name: "sources", type: types.sources }], needs: [] },
{ name: producers.combineSources.name, inputs: [{ name: "left", type: types.sources }, { name: "right", type: types.sources }], outputs: [{ name: "sources", type: types.sources }], needs: [] },
{ name: producers.create.name, inputs: [], outputs: [{ name: "program", type: types.program }], needs: [] },
{ name: producers.append.name, inputs: [{ name: "program", type: types.program }, { name: "window", type: temporalTypes.window }, { name: "visual", type: compositionTypes.visualTrack }], outputs: [{ name: "program", type: types.program }], needs: [] },
- { name: producers.resolve.name, inputs: [{ name: "program", type: types.program }, { name: "timeline", type: timelineTypes.track }, { name: "header", type: types.header }], outputs: [{ name: "visual", type: compositionTypes.visualTrack }], needs: [] },
+ { name: producers.resolve.name, inputs: [{ name: "program", type: types.program }, { name: "timeline", type: timelineTypes.timeline }, { name: "header", type: types.header }], outputs: [{ name: "visual", type: compositionTypes.visualTrack }], needs: [] },
);
component.producers.push(
{ producer: producers.source, handler: ({ inputs }) => ({ outputs: { sources: stored(sourcesValue([sourceValue(inline(inputs.spec, "PresenterSourceSpec"), inline(inputs.media, "SynchronizedMedia"), inline(inputs.window, "TemporalWindow"), inline(inputs.timeline, "Timeline"))])) }, needs: {} }) },
@@ -262,7 +262,7 @@ export function installPresenter(module, manifest, component) {
],
vocabulary: { summary: "Continuing presenter role owned by the explainer project.", attributes: [
{ name: "id", kind: "identifier", required: true, summary: "Presenter identity." },
- { name: "timeline", kind: "reference", required: true, accepts: [timelineTypes.track], summary: "Completed Timeline." },
+ { name: "timeline", kind: "reference", required: true, accepts: [timelineTypes.timeline], summary: "Completed Timeline." },
{ name: "within", kind: "reference", required: true, accepts: [spatialTypes.frame], summary: "Picture plane available to Presenter treatments that move beyond their local Frame." },
], children: [
{ tag: "Source", cardinality: "many", summary: "One native presenter media occurrence.", attributes: [
@@ -295,7 +295,7 @@ export function installPresenter(module, manifest, component) {
else throw Error("Presenter accepts only Source and Use children.");
}
if (!sourceDeclarations.length || !uses.length) throw Error("Presenter requires at least one Source and one Use.");
- const sourceInputs = [{ name: "timeline", type: timelineTypes.track }, ...sourceDeclarations.flatMap((_, index) => [
+ const sourceInputs = [{ name: "timeline", type: timelineTypes.timeline }, ...sourceDeclarations.flatMap((_, index) => [
{ name: `spec-${index}`, type: types.sourceSpec }, { name: `media-${index}`, type: mediaTypes.synchronized }, { name: `window-${index}`, type: temporalTypes.window },
])];
const sourceOps = sourceDeclarations.map((_, index) => ({ id: `source-${index}`, producer: producers.source, inputs: {
@@ -320,7 +320,7 @@ export function installPresenter(module, manifest, component) {
components.push({ id: `${id}.__sources`, fragment: sourceFragment.id, inputs: { timeline: context.timeline.ref, ...Object.fromEntries(sourceDeclarations.flatMap((source, index) => [
[`spec-${index}`, { kind: "record", id: source.specId }], [`media-${index}`, source.media.ref], [`window-${index}`, source.window.ref],
])) }, outputs: { sources: `${id}.__sources.value` }, range: element.range });
- const collectorInputs = [{ name: "timeline", type: timelineTypes.track }, { name: "header", type: types.header }];
+ const collectorInputs = [{ name: "timeline", type: timelineTypes.timeline }, { name: "header", type: types.header }];
const bindings = { timeline: context.timeline.ref, header: { kind: "record", id: `${id}.header` } };
const ops = [{ id: "empty", producer: producers.create, inputs: {}, result: { kind: "output", name: "program" } }];
let previous = "empty";
diff --git a/examples/complex-explainer/packages/opening-system/src/pullback.js b/examples/complex-explainer/packages/opening-system/src/pullback.js
index 36338e5a..99145441 100644
--- a/examples/complex-explainer/packages/opening-system/src/pullback.js
+++ b/examples/complex-explainer/packages/opening-system/src/pullback.js
@@ -20,7 +20,7 @@ export function installPullback(module, manifest, component, optionsType, mode="
const types = presenterTypes(module);
const isFade=mode==="fade-out",tag=isFade?"FadeOut":"Pullback";
const inputs = [
- { name: "timeline", type: timelineTypes.track },
+ { name: "timeline", type: timelineTypes.timeline },
{ name: "within", type: spatialTypes.frame },
{ name: "window", type: temporalTypes.window },
{ name: "sources", type: types.sources },
diff --git a/examples/complex-explainer/packages/opening-system/src/reframe.js b/examples/complex-explainer/packages/opening-system/src/reframe.js
index 9ac55c32..31b41b9d 100644
--- a/examples/complex-explainer/packages/opening-system/src/reframe.js
+++ b/examples/complex-explainer/packages/opening-system/src/reframe.js
@@ -19,7 +19,7 @@ const styles = (o) =>
export function installReframe(module, manifest, component) {
const types = presenterTypes(module);
const inputs = [
- { name: "timeline", type: timelineTypes.track },
+ { name: "timeline", type: timelineTypes.timeline },
{ name: "within", type: spatialTypes.frame },
{ name: "window", type: temporalTypes.window },
{ name: "sources", type: types.sources },
diff --git a/examples/complex-explainer/packages/web-scenes/src/activation.js b/examples/complex-explainer/packages/web-scenes/src/activation.js
index 176e9ed9..39abacf1 100644
--- a/examples/complex-explainer/packages/web-scenes/src/activation.js
+++ b/examples/complex-explainer/packages/web-scenes/src/activation.js
@@ -38,7 +38,7 @@ const module = { name: "@explainer/web-scenes", version: "1" },
const options = type("Options"),
events = type("Events");
const common = [
- port("timeline", timelineTypes.track),
+ port("timeline", timelineTypes.timeline),
port("within", spatialTypes.frame),
port("window", temporalTypes.window),
port("font", mediaTypes.fontArtifact),
@@ -186,7 +186,7 @@ export const manifest = {
mediaTypes.blobArtifact,
mediaTypes.fontArtifact,
mediaTypes.synchronized,
- timelineTypes.track,
+ timelineTypes.timeline,
spatialTypes.frame,
temporalTypes.window,
temporalTypes.instant,
@@ -201,7 +201,7 @@ export const manifest = {
{
name: "append",
inputs: [
- port("timeline", timelineTypes.track),
+ port("timeline", timelineTypes.timeline),
port("events", events),
port("options", options),
port("at", temporalTypes.instant),
diff --git a/examples/minimal-author-package/packages/example-component/src/fragment.ts b/examples/minimal-author-package/packages/example-component/src/fragment.ts
index bc2120ba..3ac72860 100644
--- a/examples/minimal-author-package/packages/example-component/src/fragment.ts
+++ b/examples/minimal-author-package/packages/example-component/src/fragment.ts
@@ -10,7 +10,7 @@ const input = (name: string) => ({ kind: "fragment-input" as const, name });
const operation = (id: string) => ({ kind: "fragment-operation" as const, operation: id });
export function createExampleFragment(producer: typeof exampleProducers[keyof typeof exampleProducers], id: string, image = false) {
- const inputs = [{ name: "timeline", type: timelineTypes.track }, { name: "within", type: spatialTypes.frame },
+ const inputs = [{ name: "timeline", type: timelineTypes.timeline }, { name: "within", type: spatialTypes.frame },
...(image ? [{ name: "image", type: artifactTypes.blob }] : [])];
const renderInputs = { timeline: input("timeline"), within: input("within"), ...(image ? { image: input("image") } : {}) };
return sealGraphFragment({
diff --git a/examples/minimal-author-package/packages/example-component/src/manifest.ts b/examples/minimal-author-package/packages/example-component/src/manifest.ts
index 8f1d4af1..cb500f98 100644
--- a/examples/minimal-author-package/packages/example-component/src/manifest.ts
+++ b/examples/minimal-author-package/packages/example-component/src/manifest.ts
@@ -36,7 +36,7 @@ export const exampleManifest: ModuleManifest = {
{ module: compositionTypes.visualTrack.module },
{ module: mediaTypes.fontStack.module },
{ module: spatialTypes.frame.module },
- { module: timelineTypes.track.module },
+ { module: timelineTypes.timeline.module },
{ module: svsRecipeType.module },
{ module: temporalTypes.window.module },
],
@@ -46,7 +46,7 @@ export const exampleManifest: ModuleManifest = {
name: producer.name,
inputs: producer === exampleProducers.appendItems
? [{ name: "previous", type: exampleTypes.itemSet }, { name: "item", type: exampleTypes.itemSet }]
- : [{ name: "timeline", type: timelineTypes.track }, { name: "within", type: spatialTypes.frame },
+ : [{ name: "timeline", type: timelineTypes.timeline }, { name: "within", type: spatialTypes.frame },
...(producer === exampleProducers.renderImage ? [{ name: "image", type: artifactTypes.blob }] : [])],
outputs: producer === exampleProducers.appendItems
? [{ name: "set", type: exampleTypes.itemSet }]
@@ -61,7 +61,7 @@ const vocabulary = (summary: string, example: string) => ({
preview: previewImage("Box.png"),
attributes: [
{ name: "id", kind: "identifier" as const, required: true, summary: "Names this instance." },
- { name: "timeline", kind: "reference" as const, required: true, accepts: [timelineTypes.track], summary: "Selects the complete Timeline." },
+ { name: "timeline", kind: "reference" as const, required: true, accepts: [timelineTypes.timeline], summary: "Selects the complete Timeline." },
{ name: "within", kind: "reference" as const, required: true, accepts: [spatialTypes.frame], summary: "Places the complete surface in this picture-plane Frame." },
],
ports: [{ name: "visual", type: compositionTypes.visualTrack, summary: "The terminal visual contribution." }],
diff --git a/examples/semantic-composition/packages/chat-scene/src/activation.ts b/examples/semantic-composition/packages/chat-scene/src/activation.ts
index 38a18ee5..b724994f 100644
--- a/examples/semantic-composition/packages/chat-scene/src/activation.ts
+++ b/examples/semantic-composition/packages/chat-scene/src/activation.ts
@@ -19,13 +19,13 @@ const module = { name: "@example/chat-scene", version: "1" } as const;
const types = Object.fromEntries(["Options", "Message", "Messages"].map(name => [name, { module, name }])) as Record<"Options" | "Message" | "Messages", TypeRef>;
const producers = Object.fromEntries(["empty", "append", "render"].map(name => [name, { module, name }])) as Record<"empty" | "append" | "render", { module: typeof module; name: string }>;
export const manifest: ModuleManifest = { format: "hypit.module@1", ...module,
- dependencies: [compositionTypes.visualTrack, mediaTypes.fontStack, timelineTypes.track, spatialTypes.frame, temporalTypes.instant].map(type => ({ module: type.module })),
+ dependencies: [compositionTypes.visualTrack, mediaTypes.fontStack, timelineTypes.timeline, spatialTypes.frame, temporalTypes.instant].map(type => ({ module: type.module })),
types: Object.values(types).map(type => ({ name: type.name })), capabilities: [], producers: [
{ name: "empty", inputs: [], outputs: [{ name: "messages", type: types.Messages }], needs: [] },
{ name: "append", inputs: [{ name: "messages", type: types.Messages }, { name: "message", type: types.Message },
- { name: "at", type: temporalTypes.instant }, { name: "timeline", type: timelineTypes.track }], outputs: [{ name: "messages", type: types.Messages }], needs: [] },
+ { name: "at", type: temporalTypes.instant }, { name: "timeline", type: timelineTypes.timeline }], outputs: [{ name: "messages", type: types.Messages }], needs: [] },
{ name: "render", inputs: [{ name: "messages", type: types.Messages }, { name: "options", type: types.Options },
- { name: "timeline", type: timelineTypes.track }, { name: "within", type: spatialTypes.frame },
+ { name: "timeline", type: timelineTypes.timeline }, { name: "within", type: spatialTypes.frame },
{ name: "window", type: temporalTypes.window }, { name: "font", type: mediaTypes.fontStack }], outputs: [{ name: "visual", type: compositionTypes.visualTrack }], needs: [] },
],
};
@@ -62,7 +62,7 @@ export const decodeSurface: StructuredSurfaceHandler = ({ element, resolveRefere
const options: ChatOptions = { id, title: textAttribute(element, "title"), entranceFrames: Number(element.attributes["entrance-frames"] ?? "10") };
const records = [...window.records, { id: `${id}.options`, type: types.Options, value: value(options), range: element.range }];
const components = [...window.components], fragments = [...window.fragments];
- const inputs = [{ name: "timeline", type: timelineTypes.track }, { name: "within", type: spatialTypes.frame },
+ const inputs = [{ name: "timeline", type: timelineTypes.timeline }, { name: "within", type: spatialTypes.frame },
{ name: "font", type: mediaTypes.fontStack }, { name: "window", type: temporalTypes.window }, { name: "options", type: types.Options }];
const bindings: Record<string, SurfaceResolvedReference["ref"]> = { timeline: context.timeline.ref, within: reference("within", spatialTypes.frame).ref,
font: reference("font", mediaTypes.fontStack).ref, window: window.ref, options: { kind: "record", id: `${id}.options` } };
@@ -93,7 +93,7 @@ export const decodeSurface: StructuredSurfaceHandler = ({ element, resolveRefere
{ id, fragment: fragment.id, inputs: bindings, outputs: { visual: `${id}.visual` }, range: element.range }], exports: [`${id}.visual`] };
};
const declaration = { name: "scene", tag: "Scene", mode: "structured" as const,
- outputs: [compositionTypes.visualTrack, timelineTypes.track, temporalTypes.window, temporalTypes.instant, temporalTypes.windowSpec, temporalTypes.instantSpec, ...Object.values(types)],
+ outputs: [compositionTypes.visualTrack, timelineTypes.timeline, temporalTypes.window, temporalTypes.instant, temporalTypes.windowSpec, temporalTypes.instantSpec, ...Object.values(types)],
vocabulary: { summary: "A conversation whose message arrivals and scrolling form one visual scene.", attributes: [
...temporalContextAttributeVocabulary, ...temporalWindowAttributeVocabulary,
...["id", "title", "within", "font"].map(name => ({ name, kind: "expression" as const, required: true, summary: name })),
diff --git a/examples/semantic-composition/packages/responsive-explainer/src/activation.ts b/examples/semantic-composition/packages/responsive-explainer/src/activation.ts
index 6b1b5fd2..6e91d89a 100644
--- a/examples/semantic-composition/packages/responsive-explainer/src/activation.ts
+++ b/examples/semantic-composition/packages/responsive-explainer/src/activation.ts
@@ -21,13 +21,13 @@ const module = { name: "@example/responsive-explainer", version: "1" } as const;
const optionsType = { module, name: "ExplainerOptions" };
const producer = { module, name: "compose" };
const inputs = [
- { name: "timeline", type: timelineTypes.track }, { name: "within", type: spatialTypes.frame },
+ { name: "timeline", type: timelineTypes.timeline }, { name: "within", type: spatialTypes.frame },
{ name: "window", type: temporalTypes.window }, { name: "reveal", type: temporalTypes.instant },
{ name: "media", type: mediaTypes.synchronized }, { name: "sourceWindow", type: temporalTypes.window },
{ name: "font", type: mediaTypes.fontStack }, { name: "options", type: optionsType },
];
export const manifest: ModuleManifest = { format: "hypit.module@1", ...module,
- dependencies: [compositionTypes.visualTrack, mediaTypes.fontStack, timelineTypes.track,
+ dependencies: [compositionTypes.visualTrack, mediaTypes.fontStack, timelineTypes.timeline,
spatialTypes.frame, temporalTypes.window, temporalTypes.instant]
.map(type => ({ module: type.module })),
types: [{ name: optionsType.name }], capabilities: [],
diff --git a/packages/audio-track-studio/src/index.ts b/packages/audio-track-studio/src/index.ts
index 273c9486..dc763ffa 100644
--- a/packages/audio-track-studio/src/index.ts
+++ b/packages/audio-track-studio/src/index.ts
@@ -9,7 +9,7 @@ import {
previewLayer,
requiredSurfaceValue,
temporalLineageFor,
- temporalSemanticSource,
+ temporalDomainSource,
} from "@hypit/studio-adapter";
function projectAudio(context: StudioTrackCompanionContext) {
@@ -26,7 +26,7 @@ function projectAudio(context: StudioTrackCompanionContext) {
return childEntities(context, clips, "audio-clip", "standard").map((entity, index) => {
const clip = clips[index]!;
const temporal = temporalLineageFor(context, clip.id, "window");
- const semanticSource = temporalSemanticSource(temporal);
+ const semanticSource = temporalDomainSource(temporal);
return {
...entity,
display: {
diff --git a/packages/audio-track/src/fragment.ts b/packages/audio-track/src/fragment.ts
index 2f2b33db..e88ece4a 100644
--- a/packages/audio-track/src/fragment.ts
+++ b/packages/audio-track/src/fragment.ts
@@ -48,7 +48,7 @@ export function createAudioTrackFragment(clips: readonly AudioTrackFragmentItem[
return sealGraphFragment({
inputs: [
{ name: "header", type: audioTrackTypes.header },
- { name: "timeline", type: timelineTypes.track },
+ { name: "timeline", type: timelineTypes.timeline },
...[...inputTypes].map(([inputName, type]) => ({ name: inputName, type })),
],
operations,
diff --git a/packages/audio-track/src/manifest.ts b/packages/audio-track/src/manifest.ts
index f2c57d10..c79d5951 100644
--- a/packages/audio-track/src/manifest.ts
+++ b/packages/audio-track/src/manifest.ts
@@ -69,7 +69,7 @@ export const audioTrackProgramSchema: ValueSchema = object({
const clipInputs = [
{ name: "set", type: audioTrackTypes.set }, { name: "header", type: audioTrackTypes.header },
- { name: "timeline", type: timelineTypes.track }, { name: "media", type: mediaTypes.synchronized },
+ { name: "timeline", type: timelineTypes.timeline }, { name: "media", type: mediaTypes.synchronized },
{ name: "spec", type: audioTrackTypes.clipSpec }, { name: "window", type: temporalTypes.window },
] as const;
@@ -161,7 +161,7 @@ export const audioTrackManifest: ModuleManifest = {
{ name: audioTrackProducers.createSet.name, inputs: [], outputs: [{ name: "set", type: audioTrackTypes.set }], needs: [] },
{ name: audioTrackProducers.appendClip.name, inputs: [...clipInputs], outputs: [{ name: "set", type: audioTrackTypes.set }], needs: [] },
{ name: audioTrackProducers.finalize.name, inputs: [{ name: "set", type: audioTrackTypes.set }, { name: "header", type: audioTrackTypes.header }], outputs: [{ name: "program", type: audioTrackTypes.program }], needs: [] },
- { name: audioTrackProducers.render.name, inputs: [{ name: "timeline", type: timelineTypes.track }, { name: "program", type: audioTrackTypes.program }], outputs: [{ name: "track", type: compositionTypes.audioTrack }], needs: [] },
+ { name: audioTrackProducers.render.name, inputs: [{ name: "timeline", type: timelineTypes.timeline }, { name: "program", type: audioTrackTypes.program }], outputs: [{ name: "track", type: compositionTypes.audioTrack }], needs: [] },
],
};
diff --git a/packages/audio-track/test/audio-track.test.ts b/packages/audio-track/test/audio-track.test.ts
index f0dbc962..36eec001 100644
--- a/packages/audio-track/test/audio-track.test.ts
+++ b/packages/audio-track/test/audio-track.test.ts
@@ -312,7 +312,7 @@ test("the self-described Audio Surface parses into the same finite Producer grap
const fixtureSurfaceDigest = fixtureResource("example.audio-inputs/surface@1");
const fixtureSurface = {
name: "inputs", tag: "Inputs", mode: "structured",
- outputs: [mediaTypes.synchronized, timelineTypes.track],
+ outputs: [mediaTypes.synchronized, timelineTypes.timeline],
} as const;
const fixtureManifest: ModuleManifest = {
format: "hypit.module@1",
@@ -343,7 +343,7 @@ test("the self-described Audio Surface parses into the same finite Producer grap
registry.registerStructured({ module: fixtureModule, declaration: fixtureSurface, handler: ({ element }) => ({
records: [
{ id: "source", type: mediaTypes.synchronized, value: { kind: "inline", value: media("surface", 48_000) }, range: element.range },
- { id: "semantic", type: timelineTypes.track, value: { kind: "inline", value: semantic }, range: element.range },
+ { id: "semantic", type: timelineTypes.timeline, value: { kind: "inline", value: semantic }, range: element.range },
],
components: [],
fragments: [],
diff --git a/packages/caption-fine-studio/src/index.ts b/packages/caption-fine-studio/src/index.ts
index c6ae56d4..5417030e 100644
--- a/packages/caption-fine-studio/src/index.ts
+++ b/packages/caption-fine-studio/src/index.ts
@@ -12,7 +12,7 @@ import type {
StudioEntityDraft,
StudioInspectorFieldDeclaration,
} from "@hypit/studio-adapter";
-import { authoredChildFor, temporalLineageFor, temporalSemanticSource, requiredReferencedValue, requiredSurfaceValue } from "@hypit/studio-adapter";
+import { authoredChildFor, temporalLineageFor, temporalDomainSource, requiredReferencedValue, requiredSurfaceValue } from "@hypit/studio-adapter";
const styleSurface = captionFineMarkupSurfaces.find((surface) => surface.name === "style");
@@ -140,7 +140,7 @@ export function projectCaption(context: StudioTrackCompanionContext): readonly S
const child = authoredChildFor(context, authoredId, [temporalTypes.windowSpec]);
if (child === undefined) throw new Error(`Caption Use ${authoredId} has no author provenance.`);
const temporal = temporalLineageFor(context, authoredId, "window");
- const semantic = temporalSemanticSource(temporal);
+ const semantic = temporalDomainSource(temporal);
return {
id: `${context.track.outputRef}:use:${authoredId}`, authoredId,
display: { title: use.styleId, layers: [] },
diff --git a/packages/caption-fine-studio/test/adapter.test.ts b/packages/caption-fine-studio/test/adapter.test.ts
index a101bbc8..aea2b98a 100644
--- a/packages/caption-fine-studio/test/adapter.test.ts
+++ b/packages/caption-fine-studio/test/adapter.test.ts
@@ -66,7 +66,7 @@ test("Caption Companion projects Cue text and Style from public domain values",
spans: [{ id: "cue-1", startFrame: 8, endFrameExclusive: 24, stackOrder: 70 }],
values: new Map<string, unknown>([["captions.schedule", schedule], ["captions.timing", {timelineId:"speech",documentId:document.id, cues:[{id:"cue-1",startFrame:10,endFrameExclusive:20,units:schedule.cues[0]!.units}]}], ["story.caption", document]]),
temporalBindings: [],
- semantic: { timelineId: "speech", narrativeId: "story", 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: [] } },
+ temporalDomains: [],
generic: () => [base],
} satisfies StudioTrackCompanionContext;
const [cue] = projectCaptionContents(context);
diff --git a/packages/caption-fine/src/fragment.ts b/packages/caption-fine/src/fragment.ts
index ab17a9a5..db8c7b05 100644
--- a/packages/caption-fine/src/fragment.ts
+++ b/packages/caption-fine/src/fragment.ts
@@ -14,7 +14,7 @@ const operation = (id: string) => ({ kind: "fragment-operation" as const, operat
export const fineCaptionTrackFragment = sealGraphFragment({
inputs: [
{ name: "document", type: captionTypes.document },
- { name: "timeline", type: timelineTypes.track },
+ { name: "timeline", type: timelineTypes.timeline },
{ name: "within", type: spatialTypes.frame },
{ name: "timing", type: captionTypes.timing },
{ name: "program", type: captionTypes.program },
@@ -56,7 +56,7 @@ export const fineCaptionTrackFragment = sealGraphFragment({
export const fineCaptionRegionTrackFragment = sealGraphFragment({
inputs: [
{ name: "document", type: captionTypes.document },
- { name: "timeline", type: timelineTypes.track },
+ { name: "timeline", type: timelineTypes.timeline },
{ name: "within", type: spatialTypes.frame },
{ name: "timing", type: captionTypes.timing },
{ name: "program", type: captionTypes.program },
diff --git a/packages/caption-fine/src/manifest.ts b/packages/caption-fine/src/manifest.ts
index 87ec17ad..11a96b7c 100644
--- a/packages/caption-fine/src/manifest.ts
+++ b/packages/caption-fine/src/manifest.ts
@@ -374,7 +374,7 @@ export const captionFineManifest: ModuleManifest = {
{ name: "schedule", type: captionFineTypes.schedule },
{ name: "program", type: captionTypes.program },
{ name: "document", type: captionTypes.document },
- { name: "timeline", type: timelineTypes.track },
+ { name: "timeline", type: timelineTypes.timeline },
{ name: "within", type: spatialTypes.frame },
],
outputs: [{ name: "track", type: compositionTypes.visualTrack }],
@@ -386,7 +386,7 @@ export const captionFineManifest: ModuleManifest = {
{ name: "schedule", type: captionFineTypes.schedule },
{ name: "program", type: captionTypes.program },
{ name: "document", type: captionTypes.document },
- { name: "timeline", type: timelineTypes.track },
+ { name: "timeline", type: timelineTypes.timeline },
{ name: "within", type: spatialTypes.frame },
{ name: "regions", type: regionTrackTypes.track },
],
diff --git a/packages/caption-fine/src/surface.ts b/packages/caption-fine/src/surface.ts
index d2dd4ea4..550c55d6 100644
--- a/packages/caption-fine/src/surface.ts
+++ b/packages/caption-fine/src/surface.ts
@@ -134,7 +134,7 @@ export const decodeFineCaptionTrackSurface: StructuredSurfaceHandler = ({ elemen
value: { kind: "inline", value: { id } }, range: element.range }];
const components: SurfaceComponentDraft[] = [];
const fragments: ReturnType<typeof sealGraphFragment>[] = [];
- const inputs: { name: string; type: SurfaceResolvedReference["type"] }[] = [{ name: "document", type: captionTypes.document }, { name: "timing", type: captionTypes.timing }, { name: "timeline", type: timelineTypes.track }, { name: "within", type: spatialTypes.frame }, { name: "header", type: captionTypes.header }];
+ const inputs: { name: string; type: SurfaceResolvedReference["type"] }[] = [{ name: "document", type: captionTypes.document }, { name: "timing", type: captionTypes.timing }, { name: "timeline", type: timelineTypes.timeline }, { name: "within", type: spatialTypes.frame }, { name: "header", type: captionTypes.header }];
const bindings: Record<string, SurfaceResolvedReference["ref"]> = { document: document.ref, timing: timing.ref, timeline: context.timeline.ref, within: within.ref, header: { kind: "record", id: `${id}.header` } };
const operations: FragmentOperation[] = [{ id: "create", producer: captionProducers.create,
inputs: { document: input("document"), header: input("header") }, result: { kind: "output", name: "program" } }];
diff --git a/packages/caption-fine/test/caption-fine.test.ts b/packages/caption-fine/test/caption-fine.test.ts
index c17e73c1..7eadf5f6 100644
--- a/packages/caption-fine/test/caption-fine.test.ts
+++ b/packages/caption-fine/test/caption-fine.test.ts
@@ -460,7 +460,7 @@ test("Caption Surface wires one Timeline to both ordinary and tracked-region ren
const { captionTypes } = await import("@hypit/caption");
const { regionTrackTypes } = await import("@hypit/region-track");
const { spatialTypes } = await import("@hypit/spatial");
- const types = { timeline: timelineTypes.track, document: captionTypes.document,
+ const types = { timeline: timelineTypes.timeline, document: captionTypes.document,
timing: captionTypes.timing, within: spatialTypes.frame, program: captionTypes.program, regions: regionTrackTypes.track };
for (const tracking of [false, true]) {
const names = tracking ? ["timeline", "document", "timing", "within", "regions"] as const
@@ -541,7 +541,7 @@ test("Caption Uses share the temporal author language and reject the removed Pro
const { captionTypes } = await import("@hypit/caption");
const { temporalTypes } = await import("@hypit/temporal");
const { spatialTypes } = await import("@hypit/spatial");
- const refs: Record<string, import("@hypit/protocol").TypeRef> = { timeline: timelineTypes.track, document: captionTypes.document,
+ const refs: Record<string, import("@hypit/protocol").TypeRef> = { timeline: timelineTypes.timeline, document: captionTypes.document,
timing: captionTypes.timing, within: spatialTypes.frame,
style: captionTypes.style, window: temporalTypes.window, instant: temporalTypes.instant };
const decode = async (body:string,extra="") => decodeFineCaptionTrackSurface({sourceName:"caption.svml",
diff --git a/packages/comment-sticker-studio/src/index.ts b/packages/comment-sticker-studio/src/index.ts
index 7cfa8e5a..e6728c7f 100644
--- a/packages/comment-sticker-studio/src/index.ts
+++ b/packages/comment-sticker-studio/src/index.ts
@@ -2,7 +2,7 @@ import { commentStickerMarkupSurfaces, commentStickerModuleRef, commentStickerTy
import type { CommentStickerProgram } from "@hypit/comment-sticker";
import { compositionTypes } from "@hypit/composition";
import type { StudioTrackCompanion, StudioTrackCompanionContext, StudioEntityDraft, StudioInspectorFieldDeclaration, StudioSourceBindingDeclaration } from "@hypit/studio-adapter";
-import { artifactPreview, childEntities, previewLayer, requiredSurfaceValue, temporalLineageFor, temporalSemanticSource, textLayer } from "@hypit/studio-adapter";
+import { artifactPreview, childEntities, previewLayer, requiredSurfaceValue, temporalLineageFor, temporalDomainSource, textLayer } from "@hypit/studio-adapter";
const frameParameters: readonly StudioSourceBindingDeclaration[] = [
{ name: "within" },
@@ -82,7 +82,7 @@ function projectComments(context: StudioTrackCompanionContext): readonly StudioE
const item = program.items[index];
if (item === undefined) return entity;
const temporal = temporalLineageFor(context, item.id, "window");
- const semanticSource = temporalSemanticSource(temporal);
+ const semanticSource = temporalDomainSource(temporal);
return {
...entity,
display: {
diff --git a/packages/comment-sticker/src/fragment.ts b/packages/comment-sticker/src/fragment.ts
index 9294115c..0c01908a 100644
--- a/packages/comment-sticker/src/fragment.ts
+++ b/packages/comment-sticker/src/fragment.ts
@@ -112,7 +112,7 @@ export function createCommentStickerFragment(items: readonly CommentStickerFragm
return sealGraphFragment({
inputs: [
{ name: "header", type: commentStickerTypes.header },
- { name: "timeline", type: timelineTypes.track },
+ { name: "timeline", type: timelineTypes.timeline },
...[...types].map(([inputName, type]) => ({ name: inputName, type })),
],
operations,
diff --git a/packages/comment-sticker/src/manifest.ts b/packages/comment-sticker/src/manifest.ts
index 287e23d7..4c24ce0d 100644
--- a/packages/comment-sticker/src/manifest.ts
+++ b/packages/comment-sticker/src/manifest.ts
@@ -133,7 +133,7 @@ export const commentStickerProgramSchema: ValueSchema = object({
});
const appendInputs = [
{ name: "set", type: commentStickerTypes.set }, { name: "header", type: commentStickerTypes.header },
- { name: "timeline", type: timelineTypes.track },
+ { name: "timeline", type: timelineTypes.timeline },
{ name: "frame", type: spatialTypes.frame }, { name: "style", type: commentStickerTypes.style },
{ name: "spec", type: commentStickerTypes.itemSpec },
{ name: "content", type: commentStickerTypes.content }, { name: "window", type: temporalTypes.window },
@@ -363,7 +363,7 @@ export const commentStickerManifest: ModuleManifest = {
needs: [],
})),
{ name: commentStickerProducers.finalize.name, inputs: [{ name: "set", type: commentStickerTypes.set }, { name: "header", type: commentStickerTypes.header }], outputs: [{ name: "program", type: commentStickerTypes.program }], needs: [] },
- { name: commentStickerProducers.render.name, inputs: [{ name: "timeline", type: timelineTypes.track }, { name: "program", type: commentStickerTypes.program }], outputs: [{ name: "track", type: compositionTypes.visualTrack }], needs: [] },
+ { name: commentStickerProducers.render.name, inputs: [{ name: "timeline", type: timelineTypes.timeline }, { name: "program", type: commentStickerTypes.program }], outputs: [{ name: "track", type: compositionTypes.visualTrack }], needs: [] },
],
};
diff --git a/packages/comment-sticker/test/comment-sticker.test.ts b/packages/comment-sticker/test/comment-sticker.test.ts
index 6bd4dd25..69c294e4 100644
--- a/packages/comment-sticker/test/comment-sticker.test.ts
+++ b/packages/comment-sticker/test/comment-sticker.test.ts
@@ -167,7 +167,7 @@ test("Style Surface consumes an explicit SVS Recipe and exact Font Stack", async
test("Track Surface lowers mixed literal and resolved-Window Stickers to a finite explicit graph", async () => {
const blob = { kind: "blob" as const, resource: fixtureResource("comment-avatar"), size: 128, mediaType: "image/png" };
const refs = new Map<string, SurfaceResolvedReference>([
- ["video.timeline", authored("video.timeline", timelineTypes.track, semantic)],
+ ["video.timeline", authored("video.timeline", timelineTypes.timeline, semantic)],
["layout.comment", authored("layout.comment", spatialTypes.frame, frame)],
["social", authored("social", commentStickerTypes.style, style)],
["avatar", authored("avatar", artifactTypes.blob, blob)],
diff --git a/packages/depth-stack-studio/src/index.ts b/packages/depth-stack-studio/src/index.ts
index 91fed908..3cdc6b64 100644
--- a/packages/depth-stack-studio/src/index.ts
+++ b/packages/depth-stack-studio/src/index.ts
@@ -2,7 +2,7 @@ import { depthStackMarkupSurfaces, depthStackModuleRef } from "@hypit/depth-stac
import type { DepthStackProgram } from "@hypit/depth-stack";
import { compositionTypes } from "@hypit/composition";
import type { StudioTrackCompanion, StudioTrackCompanionContext, StudioEntityDraft, StudioInspectorFieldDeclaration } from "@hypit/studio-adapter";
-import { requiredSurfaceValue, temporalLineageFor, temporalSemanticSource } from "@hypit/studio-adapter";
+import { requiredSurfaceValue, temporalLineageFor, temporalDomainSource } from "@hypit/studio-adapter";
const deckProperties = (depthStackMarkupSurfaces
.find((surface) => surface.name === "track")?.vocabulary.attributes
@@ -84,7 +84,7 @@ function projectDeck(context: StudioTrackCompanionContext): readonly StudioEntit
return program.cards.map((card, index): StudioEntityDraft => {
const child = children.get(card.id);
const temporal = temporalLineageFor(context, card.id, "activation");
- const markerId = temporalSemanticSource(temporal)?.id;
+ const markerId = temporalDomainSource(temporal)?.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];
diff --git a/packages/depth-stack/src/fragment.ts b/packages/depth-stack/src/fragment.ts
index 43e89657..17a615af 100644
--- a/packages/depth-stack/src/fragment.ts
+++ b/packages/depth-stack/src/fragment.ts
@@ -42,7 +42,7 @@ export function createDepthStackFragment(
const inputs: Array<GraphFragment["inputs"][number]> = [
{ name: "frame", type: spatialTypes.frame },
{ name: "header", type: depthStackTypes.header },
- { name: "timeline", type: timelineTypes.track },
+ { name: "timeline", type: timelineTypes.timeline },
{ name: "spec", type: depthStackTypes.spec },
];
const operations: FragmentOperation[] = [
diff --git a/packages/depth-stack/src/manifest.ts b/packages/depth-stack/src/manifest.ts
index df034466..3c941c38 100644
--- a/packages/depth-stack/src/manifest.ts
+++ b/packages/depth-stack/src/manifest.ts
@@ -116,7 +116,7 @@ export const depthStackProgramSchema: ValueSchema = object({
const finalizeInputs = [
{ name: "set", type: depthStackTypes.cardSet }, { name: "header", type: depthStackTypes.header },
{ name: "frame", type: spatialTypes.frame }, { name: "spec", type: depthStackTypes.spec },
- { name: "timeline", type: timelineTypes.track },
+ { name: "timeline", type: timelineTypes.timeline },
] as const;
export const depthStackMarkupSurfaces = [
@@ -376,7 +376,7 @@ export const depthStackManifest: ModuleManifest = {
{ name: depthStackProducers.bindLabelText.name, inputs: [{ name: "style", type: depthStackTypes.cardLabelStyle }, { name: "content", type: textTypes.text }], outputs: [{ name: "label", type: depthStackTypes.cardLabel }], needs: [] },
{ name: depthStackProducers.createCards.name, inputs: [], outputs: [{ name: "set", type: depthStackTypes.cardSet }], needs: [] },
{ name: depthStackProducers.appendCard.name, inputs: [
- { name: "set", type: depthStackTypes.cardSet }, { name: "timeline", type: timelineTypes.track }, { name: "material", type: visualTrackTypes.layerSet },
+ { name: "set", type: depthStackTypes.cardSet }, { name: "timeline", type: timelineTypes.timeline }, { name: "material", type: visualTrackTypes.layerSet },
{ name: "label", type: depthStackTypes.cardLabel }, { name: "spec", type: depthStackTypes.cardSpec },
{ name: "activation", type: temporalTypes.instant },
], outputs: [{ name: "set", type: depthStackTypes.cardSet }], needs: [] },
@@ -384,7 +384,7 @@ export const depthStackManifest: ModuleManifest = {
inputs: [...finalizeInputs, { name: "terminal", type: temporalTypes.instant }],
outputs: [{ name: "program", type: depthStackTypes.program }], needs: [] },
{ name: depthStackProducers.render.name, inputs: [
- { name: "timeline", type: timelineTypes.track },
+ { name: "timeline", type: timelineTypes.timeline },
{ name: "program", type: depthStackTypes.program },
], outputs: [{ name: "track", type: compositionTypes.visualTrack }], needs: [] },
],
diff --git a/packages/depth-stack/test/depth-stack.test.ts b/packages/depth-stack/test/depth-stack.test.ts
index 98cb460e..44629cac 100644
--- a/packages/depth-stack/test/depth-stack.test.ts
+++ b/packages/depth-stack/test/depth-stack.test.ts
@@ -416,7 +416,7 @@ test("the author Surface keeps every source, trigger, terminal, Frame and option
record: { value: { kind: "inline", value: { path, properties } } } as never,
});
const references = new Map<string, SurfaceResolvedReference>([
- ["timeline", plain("timeline", timelineTypes.track)],
+ ["timeline", plain("timeline", timelineTypes.timeline)],
["within", plain("within", spatialTypes.frame)],
["frame", plain("frame", spatialTypes.frame)],
["first", plain("first", artifactTypes.blob)], ["first-extent", plain("first-extent", spatialTypes.extent)],
diff --git a/packages/film-studio/src/index.ts b/packages/film-studio/src/index.ts
index 9ebda4b1..31a3411b 100644
--- a/packages/film-studio/src/index.ts
+++ b/packages/film-studio/src/index.ts
@@ -7,7 +7,7 @@ import { filmModuleRef } from "@hypit/film";
export const filmStudioCompanions: readonly StudioFilmCompanion[] = [{
id: "film",
match: { module: filmModuleRef, surface: "film", outputType: compositionTypes.composition },
- timeSources: [{ attribute: "timeline", type: timelineTypes.track }],
+ timeSources: [{ attribute: "timeline", type: timelineTypes.timeline }],
tracks: {
childSurface: "Track",
sourceAttribute: "source",
diff --git a/packages/film/src/fragment.ts b/packages/film/src/fragment.ts
index ccc68c52..7c8ff830 100644
--- a/packages/film/src/fragment.ts
+++ b/packages/film/src/fragment.ts
@@ -66,7 +66,7 @@ export function createFilmAssemblyFragment(options: FilmAssemblyFragmentOptions)
inputs: [
{ name: "program", type: filmTypes.program },
{ name: "canvas", type: spatialTypes.canvas },
- { name: "timeline", type: timelineTypes.track },
+ { name: "timeline", type: timelineTypes.timeline },
...tracks.map((track) => ({
name: track.name,
type: track.kind === "visual" ? compositionTypes.visualTrack : compositionTypes.audioTrack,
diff --git a/packages/film/src/manifest.ts b/packages/film/src/manifest.ts
index c4257456..504caf56 100644
--- a/packages/film/src/manifest.ts
+++ b/packages/film/src/manifest.ts
@@ -121,7 +121,7 @@ export const filmManifest: ModuleManifest = {
name: filmProducers.appendVisualTrack.name,
inputs: [
{ name: "set", type: filmTypes.trackSet },
- { name: "timeline", type: timelineTypes.track },
+ { name: "timeline", type: timelineTypes.timeline },
{ name: "track", type: compositionTypes.visualTrack },
],
outputs: [{ name: "set", type: filmTypes.trackSet }],
@@ -131,7 +131,7 @@ export const filmManifest: ModuleManifest = {
name: filmProducers.appendAudioTrack.name,
inputs: [
{ name: "set", type: filmTypes.trackSet },
- { name: "timeline", type: timelineTypes.track },
+ { name: "timeline", type: timelineTypes.timeline },
{ name: "track", type: compositionTypes.audioTrack },
],
outputs: [{ name: "set", type: filmTypes.trackSet }],
@@ -142,7 +142,7 @@ export const filmManifest: ModuleManifest = {
inputs: [
{ name: "program", type: filmTypes.program },
{ name: "canvas", type: spatialTypes.canvas },
- { name: "timeline", type: timelineTypes.track },
+ { name: "timeline", type: timelineTypes.timeline },
{ name: "set", type: filmTypes.trackSet },
],
outputs: [{ name: "composition", type: compositionTypes.composition }],
diff --git a/packages/film/test/film.test.ts b/packages/film/test/film.test.ts
index 681c944d..22019dc7 100644
--- a/packages/film/test/film.test.ts
+++ b/packages/film/test/film.test.ts
@@ -120,8 +120,8 @@ const closure = createResolvedClosure([
filmManifest,
]);
const records = await Promise.all([
- sealRecord({ id: "timeline", type: timelineTypes.track, value: stored(space) }),
- sealRecord({ id: "semantic", type: timelineTypes.track, value: stored(semantic) }),
+ sealRecord({ id: "timeline", type: timelineTypes.timeline, value: stored(space) }),
+ sealRecord({ id: "semantic", type: timelineTypes.timeline, value: stored(semantic) }),
sealRecord({ id: "canvas", type: spatialTypes.canvas, value: stored(canvas) }),
sealRecord({ id: "film-program", type: filmTypes.program, value: stored(filmProgram) }),
sealRecord({ id: "title", type: compositionTypes.visualTrack, value: stored(titleVisual) }),
diff --git a/packages/film/test/surface.test.ts b/packages/film/test/surface.test.ts
index cb4fa64f..295a64c8 100644
--- a/packages/film/test/surface.test.ts
+++ b/packages/film/test/surface.test.ts
@@ -43,7 +43,7 @@ const fixtureModule = { name: "example.film-fixture", version: "1" } as const;
const fixtureSurfaceDigest = fixtureResource("example.film-fixture/inputs-surface@1");
const fixtureSurface = {
name: "inputs", tag: "Inputs", mode: "structured",
- outputs: [timelineTypes.track, compositionTypes.visualTrack, compositionTypes.audioTrack],
+ outputs: [timelineTypes.timeline, compositionTypes.visualTrack, compositionTypes.audioTrack],
} as const;
const fixtureManifest: ModuleManifest = {
format: "hypit.module@1",
@@ -103,7 +103,7 @@ async function compileFilm(options: { readonly styles?: string; readonly tracks?
const surfaces = new MarkupSurfaceRegistry();
surfaces.registerStructured({ module: fixtureModule, declaration: fixtureSurface, handler: ({ element }) => ({
records: [
- { id: "semantic", type: timelineTypes.track, value: { kind: "inline", value: semantic }, range: element.range },
+ { id: "semantic", type: timelineTypes.timeline, value: { kind: "inline", value: semantic }, range: element.range },
{ id: "visual", type: compositionTypes.visualTrack, value: { kind: "inline", value: visual }, range: element.range },
{ id: "audio", type: compositionTypes.audioTrack, value: { kind: "inline", value: audio }, range: element.range },
],
@@ -192,7 +192,7 @@ test("Film rejects a repeated Track reference during check, before executing its
test("Film distinguishes component output ports and resolves duplicate aliases", async () => {
const range = { source: "main.svml", start: 0, end: 1 };
const refs = new Map<string, SurfaceResolvedReference>();
- for (const [path, type] of [["canvas", spatialTypes.canvas], ["timeline", timelineTypes.track]] as const) {
+ for (const [path, type] of [["canvas", spatialTypes.canvas], ["timeline", timelineTypes.timeline]] as const) {
refs.set(path, { path, type, ref: { kind: "record", id: path } });
}
refs.set("appearance", { path: "appearance", type: svsRecipeType,
diff --git a/packages/hyperframes/src/fragment.ts b/packages/hyperframes/src/fragment.ts
index 27536c7e..7eaeea82 100644
--- a/packages/hyperframes/src/fragment.ts
+++ b/packages/hyperframes/src/fragment.ts
@@ -16,7 +16,7 @@ const operation = (id: string) => ({ kind: "fragment-operation" as const, operat
export const hyperframesDocumentFragment = sealGraphFragment({
inputs: [
{ name: "composition", type: compositionTypes.composition },
- { name: "timeline", type: timelineTypes.track },
+ { name: "timeline", type: timelineTypes.timeline },
],
operations: [{
id: "compile-document",
diff --git a/packages/hyperframes/src/manifest.ts b/packages/hyperframes/src/manifest.ts
index 1fb10f0c..3bbd7dbb 100644
--- a/packages/hyperframes/src/manifest.ts
+++ b/packages/hyperframes/src/manifest.ts
@@ -71,7 +71,7 @@ export const hyperframesManifest: ModuleManifest = {
name: hyperframesProducers.compile.name,
inputs: [
{ name: "composition", type: compositionTypes.composition },
- { name: "timeline", type: timelineTypes.track },
+ { name: "timeline", type: timelineTypes.timeline },
],
outputs: [{ name: "document", type: hyperframesTypes.document }],
needs: [],
diff --git a/packages/interview-emoji-reveal/src/fragment.ts b/packages/interview-emoji-reveal/src/fragment.ts
index 28631747..a9b1e4a9 100644
--- a/packages/interview-emoji-reveal/src/fragment.ts
+++ b/packages/interview-emoji-reveal/src/fragment.ts
@@ -46,7 +46,7 @@ export function createEmojiRevealFragment(items: readonly EmojiRevealFragmentIte
);
return sealGraphFragment({
inputs: [
- { name: "header", type: emojiRevealTypes.header }, { name: "timeline", type: timelineTypes.track },
+ { name: "header", type: emojiRevealTypes.header }, { name: "timeline", type: timelineTypes.timeline },
{ name: "within", type: spatialTypes.frame }, { name: "outer", type: temporalTypes.window }, { name: "style", type: emojiRevealTypes.style },
{ name: "placeholder", type: artifactTypes.blob },
...items.flatMap((item) => [
diff --git a/packages/interview-emoji-reveal/src/manifest.ts b/packages/interview-emoji-reveal/src/manifest.ts
index 7e875d90..b50aa24a 100644
--- a/packages/interview-emoji-reveal/src/manifest.ts
+++ b/packages/interview-emoji-reveal/src/manifest.ts
@@ -156,16 +156,16 @@ export const emojiRevealManifest: ModuleManifest = {
producers: [
{ name: emojiRevealProducers.createSet.name, inputs: [], outputs: [{ name: "set", type: emojiRevealTypes.set }], needs: [] },
{ name: emojiRevealProducers.appendItem.name,
- inputs: [{ name: "set", type: emojiRevealTypes.set }, { name: "timeline", type: timelineTypes.track }, { name: "spec", type: emojiRevealTypes.itemSpec }, { name: "icon", type: artifactTypes.blob }, { name: "activation", type: temporalTypes.instant }],
+ inputs: [{ name: "set", type: emojiRevealTypes.set }, { name: "timeline", type: timelineTypes.timeline }, { name: "spec", type: emojiRevealTypes.itemSpec }, { name: "icon", type: artifactTypes.blob }, { name: "activation", type: temporalTypes.instant }],
outputs: [{ name: "set", type: emojiRevealTypes.set }], needs: [] },
{ name: emojiRevealProducers.appendPresetItem.name,
inputs: [{ name: "set", type: emojiRevealTypes.set }, { name: "spec", type: emojiRevealTypes.itemSpec }, { name: "icon", type: artifactTypes.blob }],
outputs: [{ name: "set", type: emojiRevealTypes.set }], needs: [] },
{ name: emojiRevealProducers.finalize.name,
- inputs: [{ name: "header", type: emojiRevealTypes.header }, { name: "timeline", type: timelineTypes.track }, { name: "outer", type: temporalTypes.window }, { name: "style", type: emojiRevealTypes.style }, { name: "placeholder", type: artifactTypes.blob }, { name: "set", type: emojiRevealTypes.set }],
+ inputs: [{ name: "header", type: emojiRevealTypes.header }, { name: "timeline", type: timelineTypes.timeline }, { name: "outer", type: temporalTypes.window }, { name: "style", type: emojiRevealTypes.style }, { name: "placeholder", type: artifactTypes.blob }, { name: "set", type: emojiRevealTypes.set }],
outputs: [{ name: "program", type: emojiRevealTypes.program }], needs: [] },
{ name: emojiRevealProducers.render.name,
- inputs: [{ name: "within", type: spatialTypes.frame }, { name: "timeline", type: timelineTypes.track }, { name: "program", type: emojiRevealTypes.program }],
+ inputs: [{ name: "within", type: spatialTypes.frame }, { name: "timeline", type: timelineTypes.timeline }, { name: "program", type: emojiRevealTypes.program }],
outputs: [{ name: "track", type: compositionTypes.visualTrack }], needs: [] },
],
};
diff --git a/packages/media-pipeline/src/manifest.ts b/packages/media-pipeline/src/manifest.ts
index 908c3c24..54a807b7 100644
--- a/packages/media-pipeline/src/manifest.ts
+++ b/packages/media-pipeline/src/manifest.ts
@@ -611,7 +611,7 @@ export const mediaPipelineManifest: ModuleManifest = {
name: mediaPipelineProducers.planAudio.name,
inputs: [
{ name: "composition", type: compositionTypes.composition },
- { name: "timeline", type: timelineTypes.track },
+ { name: "timeline", type: timelineTypes.timeline },
],
outputs: [{ name: "plan", type: mediaPipelineTypes.audioProgramPlan }],
needs: [],
diff --git a/packages/narrative-temporal/src/component.ts b/packages/narrative-temporal/src/component.ts
index 5327a013..d32354ef 100644
--- a/packages/narrative-temporal/src/component.ts
+++ b/packages/narrative-temporal/src/component.ts
@@ -1,5 +1,5 @@
import type { ComponentPackage } from "@hypit/component-kit";
-import type { Narrative, NarrativeExcerpt, NarrativeMomentRef, NarrativeSelectionRef } from "@hypit/narrative";
+import type { Narrative, NarrativeSegmentRef, NarrativeMomentRef, NarrativeSelectionRef } from "@hypit/narrative";
import { canonicalize } from "@hypit/protocol";
import type { ProducerRef, StoredValue } from "@hypit/protocol";
import type { LocalTemporalDomain, TemporalWindow } from "@hypit/temporal";
@@ -23,7 +23,7 @@ export const narrativeTemporalComponent = {
producer: narrativeTemporalProducers.materializeSegmentBoundaries,
handler: ({ inputs }) => ({ outputs: { alignment: { kind: "inline", value: canonicalize(materializeSegmentBoundaryAlignment(
inline<Narrative>(inputs.narrative?.value, "Narrative"),
- inline<NarrativeExcerpt>(inputs.segment?.value, "NarrativeExcerpt"),
+ inline<NarrativeSegmentRef>(inputs.segment?.value, "NarrativeSegmentRef"),
inline<LocalTemporalDomain>(inputs.domain?.value, "LocalTemporalDomain"),
)) } }, needs: {} }),
}, {
@@ -68,7 +68,7 @@ function projectionFacet(producer: ProducerRef, inputName: "selection" | "segmen
return { outputs: { instant: { kind: "inline" as const, value: canonicalize(projectNarrativeInstant({
timeline: inline<Timeline>(inputs.timeline?.value, "Timeline"),
narrative: inline<NarrativeProjection>(inputs.projection?.value, "NarrativeProjection"),
- source: inline<NarrativeSelectionRef | NarrativeExcerpt | NarrativeMomentRef>(inputs[inputName]?.value, inputName),
+ source: inline<NarrativeSelectionRef | NarrativeSegmentRef | NarrativeMomentRef>(inputs[inputName]?.value, inputName),
sourceKind, spec,
})) } }, needs: {} };
} };
diff --git a/packages/narrative-temporal/src/manifest.ts b/packages/narrative-temporal/src/manifest.ts
index d5ed278e..1f39ac26 100644
--- a/packages/narrative-temporal/src/manifest.ts
+++ b/packages/narrative-temporal/src/manifest.ts
@@ -26,14 +26,14 @@ export const narrativeTemporalManifest: ModuleManifest = {
dependencies: [narrativeDependency, temporalDependency, timelineDependency],
types: Object.values(narrativeTemporalTypes).map((type) => ({ name: type.name })), capabilities: [], producers: [{
name: narrativeTemporalProducers.materializeSegmentBoundaries.name,
- inputs: [{ name: "narrative", type: narrativeTypes.narrative }, { name: "segment", type: narrativeTypes.excerpt },
+ inputs: [{ name: "narrative", type: narrativeTypes.narrative }, { name: "segment", type: narrativeTypes.segmentRef },
{ name: "domain", type: temporalTypes.localDomain }],
outputs: [{ name: "alignment", type: narrativeTemporalTypes.narrativeAlignment }], needs: [],
}, {
name: narrativeTemporalProducers.projectAlignment.name,
inputs: [{ name: "alignment", type: narrativeTemporalTypes.narrativeAlignment },
{ name: "domain", type: temporalTypes.localDomain }, { name: "window", type: temporalTypes.window },
- { name: "timeline", type: timelineTypes.track }],
+ { name: "timeline", type: timelineTypes.timeline }],
outputs: [{ name: "parts", type: narrativeTemporalTypes.narrativeProjectionParts }], needs: [],
}, {
name: narrativeTemporalProducers.combineProjectionParts.name,
@@ -42,22 +42,22 @@ export const narrativeTemporalManifest: ModuleManifest = {
}, {
name: narrativeTemporalProducers.finalizeProjection.name,
inputs: [{ name: "header", type: narrativeTemporalTypes.narrativeProjectionHeader },
- { name: "narrative", type: narrativeTypes.narrative }, { name: "timeline", type: timelineTypes.track },
+ { name: "narrative", type: narrativeTypes.narrative }, { name: "timeline", type: timelineTypes.timeline },
{ name: "parts", type: narrativeTemporalTypes.narrativeProjectionParts }],
outputs: [{ name: "projection", type: narrativeTemporalTypes.narrativeProjection }], needs: [],
}, {
name: narrativeTemporalProducers.projectSelectionInstant.name,
- inputs: [{ name: "timeline", type: timelineTypes.track }, { name: "projection", type: narrativeTemporalTypes.narrativeProjection },
+ inputs: [{ name: "timeline", type: timelineTypes.timeline }, { name: "projection", type: narrativeTemporalTypes.narrativeProjection },
{ name: "selection", type: narrativeTypes.selection }, { name: "spec", type: narrativeTemporalTypes.narrativeInstantSpec }],
outputs: [{ name: "instant", type: temporalTypes.instant }], needs: [],
}, {
name: narrativeTemporalProducers.projectSegmentInstant.name,
- inputs: [{ name: "timeline", type: timelineTypes.track }, { name: "projection", type: narrativeTemporalTypes.narrativeProjection },
- { name: "segment", type: narrativeTypes.excerpt }, { name: "spec", type: narrativeTemporalTypes.narrativeInstantSpec }],
+ inputs: [{ name: "timeline", type: timelineTypes.timeline }, { name: "projection", type: narrativeTemporalTypes.narrativeProjection },
+ { name: "segment", type: narrativeTypes.segmentRef }, { name: "spec", type: narrativeTemporalTypes.narrativeInstantSpec }],
outputs: [{ name: "instant", type: temporalTypes.instant }], needs: [],
}, {
name: narrativeTemporalProducers.projectMomentInstant.name,
- inputs: [{ name: "timeline", type: timelineTypes.track }, { name: "projection", type: narrativeTemporalTypes.narrativeProjection },
+ inputs: [{ name: "timeline", type: timelineTypes.timeline }, { name: "projection", type: narrativeTemporalTypes.narrativeProjection },
{ name: "moment", type: narrativeTypes.moment }, { name: "spec", type: narrativeTemporalTypes.narrativeInstantSpec }],
outputs: [{ name: "instant", type: temporalTypes.instant }], needs: [],
}],
diff --git a/packages/narrative-temporal/src/materialize.ts b/packages/narrative-temporal/src/materialize.ts
index efed9970..55ff3802 100644
--- a/packages/narrative-temporal/src/materialize.ts
+++ b/packages/narrative-temporal/src/materialize.ts
@@ -1,24 +1,24 @@
-import type { Narrative, NarrativeExcerpt } from "@hypit/narrative";
+import type { Narrative, NarrativeSegmentRef } from "@hypit/narrative";
import { assertLocalTemporalDomain } from "@hypit/temporal";
import type { LocalTemporalDomain } from "@hypit/temporal";
import { sealNarrativeAlignment } from "./identity.js";
import type { NarrativeAlignment } from "./types.js";
-function authoredSegment(narrative: Narrative, excerpt: NarrativeExcerpt): Narrative["segments"][number] {
- if (narrative.id !== excerpt.narrativeId) throw new Error(`NarrativeExcerpt ${excerpt.id} belongs to another Narrative.`);
+function authoredSegment(narrative: Narrative, excerpt: NarrativeSegmentRef): Narrative["segments"][number] {
+ if (narrative.id !== excerpt.narrativeId) throw new Error(`NarrativeSegmentRef ${excerpt.id} belongs to another Narrative.`);
if (excerpt.kind !== "segment") throw new Error("NarrativeAlignment materialization requires a Segment excerpt.");
const segment = narrative.segments.find((candidate) => candidate.id === excerpt.id);
if (segment === undefined) throw new Error(`Narrative does not contain Segment ${excerpt.id}.`);
if (excerpt.tokenStart !== segment.tokenStart || excerpt.tokenEndExclusive !== segment.tokenEndExclusive) {
- throw new Error(`NarrativeExcerpt ${excerpt.id} does not describe its authored Segment.`);
+ throw new Error(`NarrativeSegmentRef ${excerpt.id} does not describe its authored Segment.`);
}
return segment;
}
export function materializeSegmentBoundaryAlignment(
narrative: Narrative,
- excerpt: NarrativeExcerpt,
+ excerpt: NarrativeSegmentRef,
domain: LocalTemporalDomain,
): NarrativeAlignment {
assertLocalTemporalDomain(domain);
diff --git a/packages/narrative-temporal/src/projection.ts b/packages/narrative-temporal/src/projection.ts
index 9d870204..b7321d26 100644
--- a/packages/narrative-temporal/src/projection.ts
+++ b/packages/narrative-temporal/src/projection.ts
@@ -1,4 +1,4 @@
-import type { NarrativeExcerpt, NarrativeMomentRef, NarrativeSelectionRef } from "@hypit/narrative";
+import type { NarrativeSegmentRef, NarrativeMomentRef, NarrativeSelectionRef } from "@hypit/narrative";
import { durationInFrames, projectDomainFrame, resolvedInstant } from "@hypit/temporal";
import type { LocalTemporalDomain, TemporalInstant, TemporalWindow } from "@hypit/temporal";
import { assertTimelineIdentity, timelineFrameCount } from "@hypit/timeline";
@@ -82,7 +82,7 @@ export function momentFrame(projection: NarrativeProjection, moment: NarrativeMo
return narrativeBoundaryFrame(projection, moment.anchorId);
}
-export function segmentFrameSpan(projection: NarrativeProjection, segment: NarrativeExcerpt) {
+export function segmentFrameSpan(projection: NarrativeProjection, segment: NarrativeSegmentRef) {
assert(segment.kind === "segment" && segment.narrativeId === projection.narrativeId,
`Segment ${segment.id} belongs to another Narrative.`);
const projected = projection.segments.find((candidate) => candidate.segmentId === segment.id);
@@ -102,19 +102,19 @@ export function tokenFrameSpan(projection: NarrativeProjection, tokenIds: readon
}
function narrativeBase(boundary: NarrativeInstantSpec["boundary"], projection: NarrativeProjection,
- source: NarrativeSelectionRef | NarrativeMomentRef | NarrativeExcerpt, sourceKind: "selection" | "moment" | "segment"): number {
+ source: NarrativeSelectionRef | NarrativeMomentRef | NarrativeSegmentRef, sourceKind: "selection" | "moment" | "segment"): number {
if (sourceKind === "moment") {
if (boundary !== "cue") throw new Error("A Narrative Moment only has a cue boundary.");
return momentFrame(projection, source as NarrativeMomentRef);
}
if (boundary === "cue") throw new Error("A Narrative interval has start and end boundaries, not cue.");
const span = sourceKind === "selection" ? selectionFrameSpan(projection, source as NarrativeSelectionRef)
- : segmentFrameSpan(projection, source as NarrativeExcerpt);
+ : segmentFrameSpan(projection, source as NarrativeSegmentRef);
return boundary === "start" ? span.startFrame : span.endFrameExclusive;
}
export function projectNarrativeInstant(input: { readonly timeline: Timeline; readonly narrative: NarrativeProjection;
- readonly source: NarrativeSelectionRef | NarrativeMomentRef | NarrativeExcerpt;
+ readonly source: NarrativeSelectionRef | NarrativeMomentRef | NarrativeSegmentRef;
readonly sourceKind: "selection" | "moment" | "segment"; readonly spec: NarrativeInstantSpec }): TemporalInstant {
assertTimelineIdentity(input.timeline);
assert(input.narrative.timelineId === input.timeline.id, "NarrativeProjection belongs to another Timeline.");
diff --git a/packages/narrative-temporal/src/surface.ts b/packages/narrative-temporal/src/surface.ts
index bd242b07..81350815 100644
--- a/packages/narrative-temporal/src/surface.ts
+++ b/packages/narrative-temporal/src/surface.ts
@@ -60,7 +60,7 @@ function projectionOutput(element: StructuredElement,
? { element, id: textAttribute(element, "id"), kind: "window", sourceKind: "selection",
source: reference(selection, `${element.name}.selection`, narrativeTypes.selection, resolveReference) }
: { element, id: textAttribute(element, "id"), kind: "window", sourceKind: "segment",
- source: reference(segment, `${element.name}.segment`, narrativeTypes.excerpt, resolveReference) };
+ source: reference(segment, `${element.name}.segment`, narrativeTypes.segmentRef, resolveReference) };
}
if (tag !== "Instant") throw new Error(`Projection accepts Map, Window and Instant children only.`);
assertAttributes(element, ["id", "selection", "segment", "moment", "boundary", "offset"], ["id"]); assertEmptyElement(element);
@@ -68,7 +68,7 @@ function projectionOutput(element: StructuredElement,
if (sources.length !== 1) throw new Error(`${element.name} requires exactly one of selection, segment or moment.`);
const sourceKind = sources[0] as "selection" | "segment" | "moment";
const sourceType = sourceKind === "selection" ? narrativeTypes.selection
- : sourceKind === "segment" ? narrativeTypes.excerpt : narrativeTypes.moment;
+ : sourceKind === "segment" ? narrativeTypes.segmentRef : narrativeTypes.moment;
const boundaryRaw = element.attributes.boundary;
if (sourceKind === "moment") {
if (boundaryRaw !== undefined) throw new Error(`${element.name}.boundary is invalid for a Moment.`);
@@ -94,9 +94,9 @@ function projectionProducer(kind: ProjectionOutput["sourceKind"]) {
function outputFragment(output: ProjectionOutput): GraphFragment {
const sourceType = output.sourceKind === "selection" ? narrativeTypes.selection
- : output.sourceKind === "segment" ? narrativeTypes.excerpt : narrativeTypes.moment;
+ : output.sourceKind === "segment" ? narrativeTypes.segmentRef : narrativeTypes.moment;
const ports: Array<{ readonly name: string; readonly type: TypeRef }> = [
- { name: "timeline", type: timelineTypes.track },
+ { name: "timeline", type: timelineTypes.timeline },
{ name: "projection", type: narrativeTemporalTypes.narrativeProjection },
{ name: "source", type: sourceType },
{ name: "start-spec", type: narrativeTemporalTypes.narrativeInstantSpec },
@@ -127,7 +127,7 @@ export const decodeNarrativeProjectionSurface: StructuredSurfaceHandler = ({ ele
assertAttributes(element, ["id", "narrative", "timeline"]);
const id = textAttribute(element, "id");
const narrative = reference(element.attributes.narrative, `${element.name}.narrative`, narrativeTypes.narrative, resolveReference);
- const timeline = reference(element.attributes.timeline, `${element.name}.timeline`, timelineTypes.track, resolveReference);
+ const timeline = reference(element.attributes.timeline, `${element.name}.timeline`, timelineTypes.timeline, resolveReference);
const maps: ProjectionMap[] = [], requested: ProjectionOutput[] = [];
const outputIds = new Set<string>();
for (const child of element.children) {
@@ -149,7 +149,7 @@ export const decodeNarrativeProjectionSurface: StructuredSurfaceHandler = ({ ele
const ports: Array<{ readonly name: string; readonly type: TypeRef }> = [
{ name: "header", type: narrativeTemporalTypes.narrativeProjectionHeader },
- { name: "narrative", type: narrativeTypes.narrative }, { name: "timeline", type: timelineTypes.track },
+ { name: "narrative", type: narrativeTypes.narrative }, { name: "timeline", type: timelineTypes.timeline },
];
const bindings: Record<string, SurfaceResolvedReference["ref"] | { kind: "record"; id: string }> = {
header: { kind: "record", id: `${id}.__header` }, narrative: narrative.ref, timeline: timeline.ref,
@@ -235,7 +235,7 @@ export const narrativeProjectionMarkupSurface = {
attributes: [
{ name: "id", kind: "identifier", required: true, summary: "Names this projection." },
{ name: "narrative", kind: "reference", required: true, accepts: [narrativeTypes.narrative], summary: "Selects the Narrative identity." },
- { name: "timeline", kind: "reference", required: true, accepts: [timelineTypes.track], summary: "Selects the target Timeline." },
+ { name: "timeline", kind: "reference", required: true, accepts: [timelineTypes.timeline], summary: "Selects the target Timeline." },
],
children: [
{ tag: "Map", cardinality: "many", summary: "Projects one local NarrativeAlignment through an exact domain-to-Window relation.", attributes: [
@@ -246,13 +246,13 @@ export const narrativeProjectionMarkupSurface = {
{ tag: "Window", cardinality: "many", summary: "Publishes one selected Segment or Selection as an absolute Window.", attributes: [
{ name: "id", kind: "identifier", required: true, summary: "Scoped absolute output name." },
{ name: "selection", kind: "reference", required: false, accepts: [narrativeTypes.selection], summary: "Selection to project." },
- { name: "segment", kind: "reference", required: false, accepts: [narrativeTypes.excerpt], summary: "Segment to project." },
+ { name: "segment", kind: "reference", required: false, accepts: [narrativeTypes.segmentRef], summary: "Segment to project." },
] },
{ tag: "Instant", cardinality: "many", summary: "Publishes one Narrative boundary as an absolute Instant.", attributes: [
{ name: "id", kind: "identifier", required: true, summary: "Scoped absolute output name." },
{ name: "moment", kind: "reference", required: false, accepts: [narrativeTypes.moment], summary: "Moment cue to project." },
{ name: "selection", kind: "reference", required: false, accepts: [narrativeTypes.selection], summary: "Selection boundary source." },
- { name: "segment", kind: "reference", required: false, accepts: [narrativeTypes.excerpt], summary: "Segment boundary source." },
+ { name: "segment", kind: "reference", required: false, accepts: [narrativeTypes.segmentRef], summary: "Segment boundary source." },
{ name: "boundary", kind: "literal", required: false, values: ["start", "end"], summary: "Boundary for Selection or Segment." },
{ name: "offset", kind: "literal", required: false, summary: "Exact signed offset applied after projection." },
] },
diff --git a/packages/narrative-temporal/test/surface.test.ts b/packages/narrative-temporal/test/surface.test.ts
index 2ae909ad..2377ad9f 100644
--- a/packages/narrative-temporal/test/surface.test.ts
+++ b/packages/narrative-temporal/test/surface.test.ts
@@ -20,10 +20,10 @@ test("Projection Surface balances maps and publishes only requested absolute val
({ path, type, ref: { kind: "record", id: path } });
const references = new Map<string, SurfaceResolvedReference>([
["story", typed("story", narrativeTypes.narrative)],
- ["film", typed("film", timelineTypes.track)],
+ ["film", typed("film", timelineTypes.timeline)],
["proof", typed("proof", narrativeTypes.selection)],
["reveal", typed("reveal", narrativeTypes.moment)],
- ["ending", typed("ending", narrativeTypes.excerpt)],
+ ["ending", typed("ending", narrativeTypes.segmentRef)],
...["one", "two", "three"].flatMap((id): Array<[string, SurfaceResolvedReference]> => [
[`${id}.alignment`, typed(`${id}.alignment`, narrativeTemporalTypes.narrativeAlignment)],
[`${id}.domain`, typed(`${id}.domain`, temporalTypes.localDomain)],
diff --git a/packages/narrative/src/component.ts b/packages/narrative/src/component.ts
index c9d1dad7..455579ed 100644
--- a/packages/narrative/src/component.ts
+++ b/packages/narrative/src/component.ts
@@ -2,7 +2,7 @@ import type { ComponentPackage } from "@hypit/component-kit";
import type { StoredValue } from "@hypit/protocol";
import {
- assertNarrativeExcerptIdentity,
+ assertNarrativeSegmentRefIdentity,
assertNarrativeIdentity,
assertNarrativeMomentRefIdentity,
assertNarrativeSelectionRefIdentity,
@@ -10,7 +10,7 @@ import {
import { narrativeTypes } from "./manifest.js";
import type {
Narrative,
- NarrativeExcerpt,
+ NarrativeSegmentRef,
NarrativeMomentRef,
NarrativeSelectionRef,
} from "./types.js";
@@ -23,7 +23,7 @@ function inline<T>(value: StoredValue, subject: string): T {
export const narrativeComponent = {
validators: [
{ type: narrativeTypes.narrative, handler: ({ value }) => assertNarrativeIdentity(inline<Narrative>(value, "Narrative")) },
- { type: narrativeTypes.excerpt, handler: ({ value }) => assertNarrativeExcerptIdentity(inline<NarrativeExcerpt>(value, "NarrativeExcerpt")) },
+ { type: narrativeTypes.segmentRef, handler: ({ value }) => assertNarrativeSegmentRefIdentity(inline<NarrativeSegmentRef>(value, "NarrativeSegmentRef")) },
{ type: narrativeTypes.selection, handler: ({ value }) => assertNarrativeSelectionRefIdentity(inline<NarrativeSelectionRef>(value, "NarrativeSelection")) },
{ type: narrativeTypes.moment, handler: ({ value }) => assertNarrativeMomentRefIdentity(inline<NarrativeMomentRef>(value, "NarrativeMoment")) },
],
diff --git a/packages/narrative/src/identity.ts b/packages/narrative/src/identity.ts
index d7f09fda..532bc762 100644
--- a/packages/narrative/src/identity.ts
+++ b/packages/narrative/src/identity.ts
@@ -1,6 +1,6 @@
import type {
Narrative,
- NarrativeExcerpt,
+ NarrativeSegmentRef,
NarrativeMomentRef,
NarrativeSelectionRef,
} from "./types.js";
@@ -27,8 +27,8 @@ export function assertNarrativeIdentity(value: Narrative): void {
unique(value.turns.map((item) => item.id), "Narrative Turn id");
unique(value.selections.map((item) => item.id), "Narrative Selection id");
unique(value.moments.map((item) => item.id), "Narrative Moment id");
- const anchorIds = unique(value.semanticIndex.anchors.map((item) => item.id), "Narrative Anchor id");
- const anchors = value.semanticIndex.anchors;
+ const anchorIds = unique(value.anchors.map((item) => item.id), "Narrative Anchor id");
+ const anchors = value.anchors;
const anchorOrder = new Map(anchors.map((anchor, index) => [anchor.id, index] as const));
let anchorCursor = 0;
let tokenCursor = 0;
@@ -91,13 +91,13 @@ export function assertNarrativeIdentity(value: Narrative): void {
}
}
-export function assertNarrativeExcerptIdentity(value: NarrativeExcerpt): void {
- if (value.kind !== "segment") throw new Error("NarrativeExcerpt must be a Segment.");
- nonempty(value.narrativeId, "NarrativeExcerpt narrativeId");
- nonempty(value.id, "NarrativeExcerpt id");
+export function assertNarrativeSegmentRefIdentity(value: NarrativeSegmentRef): void {
+ if (value.kind !== "segment") throw new Error("NarrativeSegmentRef must be a Segment.");
+ nonempty(value.narrativeId, "NarrativeSegmentRef narrativeId");
+ nonempty(value.id, "NarrativeSegmentRef id");
if (!Number.isSafeInteger(value.tokenStart) || !Number.isSafeInteger(value.tokenEndExclusive)
|| value.tokenStart < 0 || value.tokenEndExclusive < value.tokenStart) {
- throw new Error("NarrativeExcerpt Token coverage is invalid.");
+ throw new Error("NarrativeSegmentRef Token coverage is invalid.");
}
}
diff --git a/packages/narrative/src/index.ts b/packages/narrative/src/index.ts
index d0927d05..8deb869b 100644
--- a/packages/narrative/src/index.ts
+++ b/packages/narrative/src/index.ts
@@ -1,12 +1,12 @@
export { narrativeDependency, narrativeManifest, narrativeModuleRef, narrativeTypes } from "./manifest.js";
export { narrativeComponent } from "./component.js";
export {
- assertNarrativeExcerptIdentity,
+ assertNarrativeSegmentRefIdentity,
assertNarrativeIdentity,
assertNarrativeMomentRefIdentity,
assertNarrativeSelectionRefIdentity,
} from "./identity.js";
-export { narrativeExcerptSchema, narrativeMomentSchema, narrativeSchema, narrativeSelectionSchema } from "./schema.js";
+export { narrativeSegmentRefSchema, narrativeMomentSchema, narrativeSchema, narrativeSelectionSchema } from "./schema.js";
export type * from "./types.js";
export { narrativeAnchorTokenBoundary, narrativeSelectionTokenRange, narrativeTokensForSelection } from "./selection.js";
diff --git a/packages/narrative/src/manifest.ts b/packages/narrative/src/manifest.ts
index 5f25a11e..44bea287 100644
--- a/packages/narrative/src/manifest.ts
+++ b/packages/narrative/src/manifest.ts
@@ -1,6 +1,6 @@
import type { ModuleManifest, TypeRef } from "@hypit/protocol";
import {
- narrativeExcerptSchema,
+ narrativeSegmentRefSchema,
narrativeSchema,
narrativeMomentSchema,
narrativeSelectionSchema,
@@ -9,7 +9,7 @@ import {
export const narrativeModuleRef = { name: "@hypit/narrative", version: "1" } as const;
export const narrativeTypes = {
narrative: { module: narrativeModuleRef, name: "Narrative" },
- excerpt: { module: narrativeModuleRef, name: "NarrativeExcerpt" },
+ segmentRef: { module: narrativeModuleRef, name: "NarrativeSegmentRef" },
selection: { module: narrativeModuleRef, name: "NarrativeSelection" },
moment: { module: narrativeModuleRef, name: "NarrativeMoment" },
} satisfies Record<string, TypeRef>;
@@ -18,7 +18,7 @@ export const narrativeManifest: ModuleManifest = {
dependencies: [],
types: [
{ name: narrativeTypes.narrative.name },
- { name: narrativeTypes.excerpt.name },
+ { name: narrativeTypes.segmentRef.name },
{ name: narrativeTypes.selection.name },
{ name: narrativeTypes.moment.name },
],
diff --git a/packages/narrative/src/schema.ts b/packages/narrative/src/schema.ts
index 8b2a4985..0308d4bb 100644
--- a/packages/narrative/src/schema.ts
+++ b/packages/narrative/src/schema.ts
@@ -15,7 +15,7 @@ const semanticAnchor: ValueSchema = { kind: "oneOf", variants: [
segmentId: { schema: string }, tokenId: { schema: string },
}),
] };
-export const narrativeExcerptSchema: ValueSchema = object({
+export const narrativeSegmentRefSchema: ValueSchema = object({
narrativeId: { schema: string },
kind: { schema: { kind: "literal", value: "segment" } }, id: { schema: string },
tokenStart: { schema: integer }, tokenEndExclusive: { schema: integer },
@@ -41,10 +41,7 @@ export const narrativeSchema: ValueSchema = object({
moments: { schema: { kind: "array", items: object({
id: { schema: string }, anchorId: { schema: string },
}) } },
- semanticIndex: { schema: object({
-
- anchors: { schema: { kind: "array", minItems: 2, items: semanticAnchor } },
- }) },
+ anchors: { schema: { kind: "array", minItems: 2, items: semanticAnchor } },
});
export const narrativeMomentSchema: ValueSchema = object({
diff --git a/packages/narrative/src/selection.ts b/packages/narrative/src/selection.ts
index cef31c2f..9f56bb57 100644
--- a/packages/narrative/src/selection.ts
+++ b/packages/narrative/src/selection.ts
@@ -9,7 +9,7 @@ export type NarrativeTokenRange = {
/** Resolve a semantic anchor to a boundary in the authored token sequence. */
export function narrativeAnchorTokenBoundary(narrative: Narrative, anchorId: string): number {
- const anchor = narrative.semanticIndex.anchors.find((item) => item.id === anchorId);
+ const anchor = narrative.anchors.find((item) => item.id === anchorId);
if (anchor === undefined) throw new Error(`Narrative ${narrative.id} has no anchor ${anchorId}.`);
const segment = narrative.segments.find((item) => item.id === anchor.segmentId);
if (segment === undefined) throw new Error(`Anchor ${anchorId} has no authored Segment.`);
@@ -27,7 +27,7 @@ export function narrativeSelectionTokenRange(
if ("narrativeId" in selection && selection.narrativeId !== narrative.id) {
throw new Error(`Selection ${selection.id} belongs to another Narrative.`);
}
- const anchors = narrative.semanticIndex.anchors;
+ const anchors = narrative.anchors;
const start = anchors.findIndex((item) => item.id === selection.startAnchorId);
const end = anchors.findIndex((item) => item.id === selection.endAnchorId);
if (start < 0 || end < 0 || end < start) {
diff --git a/packages/narrative/src/types.ts b/packages/narrative/src/types.ts
index 4c8d6ac8..e7792703 100644
--- a/packages/narrative/src/types.ts
+++ b/packages/narrative/src/types.ts
@@ -71,9 +71,7 @@ export type Narrative = {
readonly turns: readonly NarrativeTurn[];
readonly selections: readonly NarrativeSelection[];
readonly moments: readonly NarrativeMoment[];
- readonly semanticIndex: {
- readonly anchors: readonly SemanticAnchor[];
- };
+ readonly anchors: readonly SemanticAnchor[];
};
/**
@@ -81,7 +79,7 @@ export type Narrative = {
* generation and speech packages consume this shared value without importing
* Script's parser or source representation.
*/
-export type NarrativeExcerpt = {
+export type NarrativeSegmentRef = {
readonly kind: "segment";
/** Author-visible `<script id>` that owns this Segment. */
readonly narrativeId: string;
diff --git a/packages/ranking-studio/src/index.ts b/packages/ranking-studio/src/index.ts
index af79fe17..a5f0ab96 100644
--- a/packages/ranking-studio/src/index.ts
+++ b/packages/ranking-studio/src/index.ts
@@ -4,7 +4,7 @@ import type { RankingProgram, RankingSchedule, RankingSoundEventPlan } from "@hy
import { compositionTypes } from "@hypit/composition";
import type { AudioTrack } from "@hypit/composition";
import type { StudioTrackCompanion, StudioTrackCompanionContext, StudioEntityDraft, StudioInspectorFieldDeclaration, StudioSourceBindingDeclaration } from "@hypit/studio-adapter";
-import { artifactPreview, authoredChildFor, previewLayer, requiredSurfaceValue, temporalLineageFor, temporalSemanticSource } from "@hypit/studio-adapter";
+import { artifactPreview, authoredChildFor, previewLayer, requiredSurfaceValue, temporalLineageFor, temporalDomainSource } from "@hypit/studio-adapter";
const fontInspector = openFontStudioFields("style");
@@ -115,7 +115,7 @@ function projectRanking(context: StudioTrackCompanionContext): readonly StudioEn
if (placement === undefined) return context.generic();
const boardId = placement.id ?? context.track.outputRef;
const outerTemporal = temporalLineageFor(context, boardId, "outer");
- const outerSemanticSource = temporalSemanticSource(outerTemporal);
+ const outerSemanticSource = temporalDomainSource(outerTemporal);
const group: StudioEntityDraft = {
id: `${context.track.outputRef}:entity:${boardId}`,
authoredId: boardId,
@@ -135,7 +135,7 @@ function projectRanking(context: StudioTrackCompanionContext): readonly StudioEn
const child = authoredChildFor(context, entry.itemId, [rankingTypes.itemSpec, rankingTypes.textItemShell]);
const item = programItems.get(entry.itemId);
const temporal = temporalLineageFor(context, entry.itemId, "mode" in entry ? "window" : "activation");
- const semanticSource = temporalSemanticSource(temporal);
+ const semanticSource = temporalDomainSource(temporal);
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;
diff --git a/packages/ranking/src/fragment.ts b/packages/ranking/src/fragment.ts
index cb205707..561fec2e 100644
--- a/packages/ranking/src/fragment.ts
+++ b/packages/ranking/src/fragment.ts
@@ -57,7 +57,7 @@ export function createRankingFragment(
const selected = definition(variant);
const inputs: Array<GraphFragment["inputs"][number]> = [
{ name: "header", type: rankingTypes.header },
- { name: "timeline", type: timelineTypes.track },
+ { name: "timeline", type: timelineTypes.timeline },
{ name: "outer", type: temporalTypes.window },
...(variant === "top-three" ? [
{ name: "terminal", type: temporalTypes.instant },
diff --git a/packages/ranking/src/manifest.ts b/packages/ranking/src/manifest.ts
index d18b7ec2..afbe36b8 100644
--- a/packages/ranking/src/manifest.ts
+++ b/packages/ranking/src/manifest.ts
@@ -734,7 +734,7 @@ export const rankingManifest: ModuleManifest = {
], outputs: [{ name: "set", type: rankingTypes.triggeredCandidates }], needs: [] },
{ name: rankingProducers.schedule.name, inputs: [
{ name: "header", type: rankingTypes.header }, { name: "items", type: rankingTypes.itemSpecs },
- { name: "timeline", type: timelineTypes.track },
+ { name: "timeline", type: timelineTypes.timeline },
{ name: "outer", type: temporalTypes.window }, { name: "candidates", type: rankingTypes.triggeredCandidates },
{ name: "terminal", type: temporalTypes.instant },
], outputs: [{ name: "schedule", type: rankingTypes.schedule }], needs: [] },
@@ -747,7 +747,7 @@ export const rankingManifest: ModuleManifest = {
], outputs: [{ name: "set", type: rankingTypes.tierWindows }], needs: [] },
{ name: rankingProducers.tierSchedule.name, inputs: [
{ name: "header", type: rankingTypes.header }, { name: "items", type: rankingTypes.itemSpecs },
- { name: "timeline", type: timelineTypes.track },
+ { name: "timeline", type: timelineTypes.timeline },
{ name: "outer", type: temporalTypes.window }, { name: "windows", type: rankingTypes.tierWindows },
], outputs: [{ name: "schedule", type: rankingTypes.schedule }], needs: [] },
{ name: rankingProducers.createColumnWindows.name, inputs: [], outputs: [
@@ -759,7 +759,7 @@ export const rankingManifest: ModuleManifest = {
], outputs: [{ name: "set", type: rankingTypes.columnWindows }], needs: [] },
{ name: rankingProducers.columnSchedule.name, inputs: [
{ name: "header", type: rankingTypes.header }, { name: "items", type: rankingTypes.itemSpecs },
- { name: "timeline", type: timelineTypes.track },
+ { name: "timeline", type: timelineTypes.timeline },
{ name: "outer", type: temporalTypes.window }, { name: "windows", type: rankingTypes.columnWindows },
], outputs: [{ name: "schedule", type: rankingTypes.schedule }], needs: [] },
...([
@@ -793,7 +793,7 @@ export const rankingManifest: ModuleManifest = {
{ name: eventProducer.name, inputs: [
{ name: "schedule", type: rankingTypes.schedule }, { name: "style", type: styleType }, { name: "specs", type: rankingTypes.itemSpecs },
], outputs: [{ name: "events", type: rankingTypes.soundEvents }], needs: [] },
- { name: renderProducer.name, inputs: [{ name: "timeline", type: timelineTypes.track }, { name: "program", type: programType }], outputs: [{ name: "track", type: compositionTypes.visualTrack }], needs: [] },
+ { name: renderProducer.name, inputs: [{ name: "timeline", type: timelineTypes.timeline }, { name: "program", type: programType }], outputs: [{ name: "track", type: compositionTypes.visualTrack }], needs: [] },
]),
{ name: rankingProducers.createSounds.name, inputs: [], outputs: [{ name: "sounds", type: rankingTypes.sounds }], needs: [] },
...([
@@ -803,7 +803,7 @@ export const rankingManifest: ModuleManifest = {
name: producer.name, inputs: [{ name: "sounds", type: rankingTypes.sounds }, { name: "media", type: mediaTypes.synchronized }], outputs: [{ name: "sounds", type: rankingTypes.sounds }], needs: [],
})),
{ name: rankingProducers.renderAudio.name, inputs: [
- { name: "timeline", type: timelineTypes.track }, { name: "events", type: rankingTypes.soundEvents },
+ { name: "timeline", type: timelineTypes.timeline }, { name: "events", type: rankingTypes.soundEvents },
{ name: "style", type: rankingTypes.soundStyle }, { name: "sounds", type: rankingTypes.sounds },
], outputs: [{ name: "track", type: compositionTypes.audioTrack }], needs: [] },
],
diff --git a/packages/ranking/test/ranking.test.ts b/packages/ranking/test/ranking.test.ts
index 6a92c43c..aaddd439 100644
--- a/packages/ranking/test/ranking.test.ts
+++ b/packages/ranking/test/ranking.test.ts
@@ -9,7 +9,7 @@ import { projectMomentInstantFixture, projectSegmentWindow, projectSelectionWind
import { createResolvedClosure } from "@hypit/core";
import type { FontArtifactRef, SynchronizedMedia } from "@hypit/media";
import { mediaTypes } from "@hypit/media";
-import type { NarrativeExcerpt, NarrativeMomentRef, NarrativeSelectionRef } from "@hypit/narrative";
+import type { NarrativeSegmentRef, NarrativeMomentRef, NarrativeSelectionRef } from "@hypit/narrative";
import { sealCanvas, sealSpatialFrame } from "@hypit/spatial";
import type { SvsRecipe } from "@hypit/svs";
@@ -137,7 +137,7 @@ const terminal: NarrativeMomentRef = {
id: "ranking-complete",
anchorId: "terminal",
};
-const rankingSegment: NarrativeExcerpt = { narrativeId: "script", kind: "segment", id: "ranking", tokenStart: 0, tokenEndExclusive: 1 };
+const rankingSegment: NarrativeSegmentRef = { narrativeId: "script", kind: "segment", id: "ranking", tokenStart: 0, tokenEndExclusive: 1 };
const selection = (id: string, startAnchorId: string, endAnchorId: string): NarrativeSelectionRef => ({
narrativeId: "script", id, startAnchorId, endAnchorId,
});
@@ -235,7 +235,7 @@ function appendProjectedTierWindow(
}));
}
-function projectColumnSegmentOuterWindow(semantic: typeof timeline, segment: NarrativeExcerpt, subjectId: string): TemporalWindow {
+function projectColumnSegmentOuterWindow(semantic: typeof timeline, segment: NarrativeSegmentRef, subjectId: string): TemporalWindow {
return projectSegmentWindow({
itemId: `${segment.id}:outer`, subjectId, semantic, narrative: narrativeProjection, segment,
projection: { start: { ref: "segment.start" }, end: { ref: "segment.end" } },
@@ -525,7 +525,7 @@ test("all three author Surfaces preserve absolute temporal, spatial, font, image
record: { value: { kind: "inline", value } } as never,
});
const references = new Map<string, SurfaceResolvedReference>([
- ["semantic", plain("semantic", timelineTypes.track)],
+ ["semantic", plain("semantic", timelineTypes.timeline)],
["frame", plain("frame", spatialTypes.frame)],
["outer", plain("outer", temporalTypes.window)],
["ranking-segment", plain("ranking-segment", temporalTypes.window)],
@@ -645,7 +645,7 @@ test("Ranking author Surfaces fail closed on impossible image and sound combinat
const ref = (path: string): MarkupAttributeValue => ({ kind: "reference", path });
const plain = (path: string, type: SurfaceResolvedReference["type"]): SurfaceResolvedReference => ({ path, ref: { kind: "record", id: path }, type });
const references = new Map<string, SurfaceResolvedReference>([
- ["semantic", plain("semantic", timelineTypes.track)],
+ ["semantic", plain("semantic", timelineTypes.timeline)],
["frame", plain("frame", spatialTypes.frame)], ["outer", plain("outer", temporalTypes.window)],
["icon", plain("icon", mediaTypes.blobArtifact)],
["style", plain("style", rankingTypes.tierStyle)], ["style.sound", plain("style.sound", rankingTypes.soundStyle)],
diff --git a/packages/region-track/src/fragment.ts b/packages/region-track/src/fragment.ts
index c69e1270..7171e982 100644
--- a/packages/region-track/src/fragment.ts
+++ b/packages/region-track/src/fragment.ts
@@ -10,7 +10,7 @@ const input = (name: string) => ({ kind: "fragment-input" as const, name });
export const regionTrackFragment = sealGraphFragment({
inputs: [
{ name: "within", type: spatialTypes.frame },
- { name: "timeline", type: timelineTypes.track },
+ { name: "timeline", type: timelineTypes.timeline },
{ name: "recipe", type: svsRecipeType },
],
operations: [{ id: "resolve", producer: regionTrackProducers.resolve, inputs: {
diff --git a/packages/region-track/src/manifest.ts b/packages/region-track/src/manifest.ts
index 0854bf5b..cf2d9ff5 100644
--- a/packages/region-track/src/manifest.ts
+++ b/packages/region-track/src/manifest.ts
@@ -18,7 +18,7 @@ export const regionTrackMarkupSurface = {
attributes: [
{ name: "id", kind: "identifier", required: true, summary: "Names the RegionTrack value." },
{ name: "within", kind: "reference", required: true, accepts: [spatialTypes.frame], summary: "Chooses the program-picture Frame normalized regions occupy." },
- { name: "timeline", kind: "reference", required: true, accepts: [timelineTypes.track], summary: "Chooses the Timeline whose Frames index the evidence." },
+ { name: "timeline", kind: "reference", required: true, accepts: [timelineTypes.timeline], summary: "Chooses the Timeline whose Frames index the evidence." },
{ name: "recipe", kind: "reference", required: true, accepts: [svsRecipeType], summary: "Chooses a Recipe with one or more named region series.", recipe: [
{ name: "series", required: true, summary: "Lists {id, regions}; each regions array contains one normalized [x, y, width, height] or null per Timeline Frame." },
] },
@@ -43,7 +43,7 @@ export const regionTrackManifest: ModuleManifest = {
name: regionTrackProducers.resolve.name,
inputs: [
{ name: "within", type: spatialTypes.frame },
- { name: "timeline", type: timelineTypes.track },
+ { name: "timeline", type: timelineTypes.timeline },
{ name: "recipe", type: svsRecipeType },
],
outputs: [{ name: "track", type: regionTrackTypes.track }], needs: [],
diff --git a/packages/region-track/src/surface.ts b/packages/region-track/src/surface.ts
index d31bc87b..b513bbfb 100644
--- a/packages/region-track/src/surface.ts
+++ b/packages/region-track/src/surface.ts
@@ -28,7 +28,7 @@ export const decodeRegionTrackSurface: StructuredSurfaceHandler = ({ element, re
if (element.children.some((child) => child.kind === "element" || child.value.trim())) throw new Error(`${element.name} must be empty.`);
const id = text(element, "id");
const within = reference(element, "within", spatialTypes.frame, resolveReference);
- const timeline = reference(element, "timeline", timelineTypes.track, resolveReference);
+ const timeline = reference(element, "timeline", timelineTypes.timeline, resolveReference);
const recipe = reference(element, "recipe", svsRecipeType, resolveReference);
return {
records: [],
diff --git a/packages/render-hyperframes/src/fragment.ts b/packages/render-hyperframes/src/fragment.ts
index b6b81db5..e635468f 100644
--- a/packages/render-hyperframes/src/fragment.ts
+++ b/packages/render-hyperframes/src/fragment.ts
@@ -18,7 +18,7 @@ export function createRenderHyperframesFragment(selectedRange = false) {
return sealGraphFragment({
inputs: [
{ name: "composition", type: compositionTypes.composition },
- { name: "timeline", type: timelineTypes.track },
+ { name: "timeline", type: timelineTypes.timeline },
...(selectedRange ? [{ name: "range", type: mediaTypes.frameRange }] : []),
],
operations: [
diff --git a/packages/render-hyperframes/test/render.test.ts b/packages/render-hyperframes/test/render.test.ts
index 6b5b0d05..17e76fed 100644
--- a/packages/render-hyperframes/test/render.test.ts
+++ b/packages/render-hyperframes/test/render.test.ts
@@ -108,7 +108,7 @@ const compositionRecord = await admitRecord(closure, sealRecord({
}), validatorRegistry());
const spaceRecord = await admitRecord(closure, sealRecord({
id: "space",
- type: timelineTypes.track,
+ type: timelineTypes.timeline,
value: stored(space),
}), validatorRegistry());
const linked = link(closure, [compositionRecord, spaceRecord]);
@@ -305,7 +305,7 @@ const fixtureModule = { name: "example.composition-fixture", version: "1" } as c
const fixtureSurfaceDigest = fixtureResource("example.composition-fixture/surface@1");
const fixtureSurface = {
name: "composition", tag: "Composition", mode: "structured",
- outputs: [compositionTypes.composition, timelineTypes.track],
+ outputs: [compositionTypes.composition, timelineTypes.timeline],
} as const;
const fixtureManifest: ModuleManifest = {
format: "hypit.module@1",
@@ -338,7 +338,7 @@ test(`the ${selectedRange ? "selected" : "full"} rendered video remains an ordin
surfaces.registerStructured({ module: fixtureModule, declaration: fixtureSurface, handler: ({ element }) => ({
records: [
{ id: "composition", type: compositionTypes.composition, value: stored(composition), range: element.range },
- { id: "semantic", type: timelineTypes.track, value: stored(semantic), range: element.range },
+ { id: "semantic", type: timelineTypes.timeline, value: stored(semantic), range: element.range },
],
components: [],
fragments: [],
diff --git a/packages/screen-overlay-studio/src/index.ts b/packages/screen-overlay-studio/src/index.ts
index 3e19f113..c2ca7703 100644
--- a/packages/screen-overlay-studio/src/index.ts
+++ b/packages/screen-overlay-studio/src/index.ts
@@ -2,7 +2,7 @@ import { screenOverlayModuleRef, screenOverlayTypes } from "@hypit/screen-overla
import type { ScreenOverlayProgram } from "@hypit/screen-overlay";
import { compositionTypes } from "@hypit/composition";
import type { StudioTrackCompanion, StudioTrackCompanionContext, StudioEntityDraft, StudioInspectorFieldDeclaration } from "@hypit/studio-adapter";
-import { childEntities, requiredSurfaceValue, temporalLineageFor, temporalSemanticSource } from "@hypit/studio-adapter";
+import { childEntities, requiredSurfaceValue, temporalLineageFor, temporalDomainSource } from "@hypit/studio-adapter";
function projectOverlays(context: StudioTrackCompanionContext): readonly StudioEntityDraft[] {
const program = requiredSurfaceValue(context, "program") as ScreenOverlayProgram;
@@ -18,7 +18,7 @@ function projectOverlays(context: StudioTrackCompanionContext): readonly StudioE
const item = program.items[index];
if (item === undefined) return entity;
const temporal = temporalLineageFor(context, item.id, "window");
- const semanticSource = temporalSemanticSource(temporal);
+ const semanticSource = temporalDomainSource(temporal);
return {
...entity,
display: { title: item.content.kind.replaceAll("-", " "), layers: [] },
diff --git a/packages/screen-overlay/src/fragment.ts b/packages/screen-overlay/src/fragment.ts
index 0aa90053..cda3f662 100644
--- a/packages/screen-overlay/src/fragment.ts
+++ b/packages/screen-overlay/src/fragment.ts
@@ -32,7 +32,7 @@ export function createScreenOverlayFragment(items: readonly ScreenOverlayFragmen
);
return sealGraphFragment({ inputs: [
{ name: "within", type: spatialTypes.frame }, { name: "header", type: screenOverlayTypes.header },
- { name: "timeline", type: timelineTypes.track }, ...[...types].map(([inputName, type]) => ({ name: inputName, type })),
+ { name: "timeline", type: timelineTypes.timeline }, ...[...types].map(([inputName, type]) => ({ name: inputName, type })),
], operations, exports: [
{ name: "program", type: screenOverlayTypes.program, root: operation("overlay:program") },
{ name: "visual", type: compositionTypes.visualTrack, root: operation("overlay:track") },
diff --git a/packages/screen-overlay/src/manifest.ts b/packages/screen-overlay/src/manifest.ts
index f2dbedc0..f040fc5e 100644
--- a/packages/screen-overlay/src/manifest.ts
+++ b/packages/screen-overlay/src/manifest.ts
@@ -64,7 +64,7 @@ export const screenOverlayHeaderSchema: ValueSchema = object({ id: { schema: str
export const screenOverlayItemSpecSchema: ValueSchema = itemSpec;
export const screenOverlaySetSchema: ValueSchema = object({ items: { schema: { kind: "array", items: item } } });
export const screenOverlayProgramSchema: ValueSchema = object({ id: { schema: string }, items: { schema: { kind: "array", minItems: 1, items: item } } });
-const appendInputs = [{ name: "set", type: screenOverlayTypes.set }, { name: "header", type: screenOverlayTypes.header }, { name: "timeline", type: timelineTypes.track }, { name: "spec", type: screenOverlayTypes.itemSpec }, { name: "window", type: temporalTypes.window }] as const;
+const appendInputs = [{ name: "set", type: screenOverlayTypes.set }, { name: "header", type: screenOverlayTypes.header }, { name: "timeline", type: timelineTypes.timeline }, { name: "spec", type: screenOverlayTypes.itemSpec }, { name: "window", type: temporalTypes.window }] as const;
const itemAttributes = [
{ name: "id", kind: "identifier", required: false,
@@ -297,7 +297,7 @@ export const screenOverlayManifest: ModuleManifest = {
{ name: screenOverlayProducers.createSet.name, inputs: [], outputs: [{ name: "set", type: screenOverlayTypes.set }], needs: [] },
{ name: screenOverlayProducers.appendItem.name, inputs: [...appendInputs], outputs: [{ name: "set", type: screenOverlayTypes.set }], needs: [] },
{ name: screenOverlayProducers.finalize.name, inputs: [{ name: "set", type: screenOverlayTypes.set }, { name: "header", type: screenOverlayTypes.header }], outputs: [{ name: "program", type: screenOverlayTypes.program }], needs: [] },
- { name: screenOverlayProducers.render.name, inputs: [{ name: "within", type: spatialTypes.frame }, { name: "timeline", type: timelineTypes.track }, { name: "program", type: screenOverlayTypes.program }], outputs: [{ name: "track", type: compositionTypes.visualTrack }], needs: [] },
+ { name: screenOverlayProducers.render.name, inputs: [{ name: "within", type: spatialTypes.frame }, { name: "timeline", type: timelineTypes.timeline }, { name: "program", type: screenOverlayTypes.program }], outputs: [{ name: "track", type: compositionTypes.visualTrack }], needs: [] },
],
};
export const screenOverlayDependency = { module: screenOverlayModuleRef } as const;
diff --git a/packages/screen-overlay/test/screen-overlay.test.ts b/packages/screen-overlay/test/screen-overlay.test.ts
index 13fad844..9ff65787 100644
--- a/packages/screen-overlay/test/screen-overlay.test.ts
+++ b/packages/screen-overlay/test/screen-overlay.test.ts
@@ -136,7 +136,7 @@ test("the self-described Screen Surface parses into a finite peer-Track graph",
const fixtureSurfaceDigest = fixtureResource("example.screen-inputs/surface@1");
const fixtureSurface = {
name: "inputs", tag: "Inputs", mode: "structured",
- outputs: [spatialTypes.frame, timelineTypes.track],
+ outputs: [spatialTypes.frame, timelineTypes.timeline],
} as const;
const fixtureManifest: ModuleManifest = {
format: "hypit.module@1",
@@ -167,7 +167,7 @@ test("the self-described Screen Surface parses into a finite peer-Track graph",
registry.registerStructured({ module: fixtureModule, declaration: fixtureSurface, handler: ({ element }) => ({
records: [
{ id: "within", type: spatialTypes.frame, value: { kind: "inline", value: within }, range: element.range },
- { id: "semantic", type: timelineTypes.track, value: { kind: "inline", value: semantic }, range: element.range },
+ { id: "semantic", type: timelineTypes.timeline, value: { kind: "inline", value: semantic }, range: element.range },
],
components: [],
fragments: [],
diff --git a/packages/script-studio/package.json b/packages/script-studio/package.json
index 9372b261..014e916c 100644
--- a/packages/script-studio/package.json
+++ b/packages/script-studio/package.json
@@ -14,6 +14,7 @@
"@hypit/script": "workspace:*",
"@hypit/studio-adapter": "workspace:*",
"@hypit/narrative": "workspace:*",
+ "@hypit/narrative-temporal": "workspace:*",
"@hypit/protocol": "workspace:*"
}
}
diff --git a/packages/script-studio/src/activation.ts b/packages/script-studio/src/activation.ts
index 7089f75c..91ea3fa9 100644
--- a/packages/script-studio/src/activation.ts
+++ b/packages/script-studio/src/activation.ts
@@ -1,8 +1,8 @@
import { createStudioCompanionHostFacet } from "@hypit/studio-adapter";
-import { scriptStudioCompanions } from "./index.js";
+import { scriptStudioTemporalDomains } from "./index.js";
export default {
format: "hypit.node-package@1" as const,
- hostFacets: [createStudioCompanionHostFacet({ scripts: scriptStudioCompanions })],
+ hostFacets: [createStudioCompanionHostFacet({ temporalDomains: scriptStudioTemporalDomains })],
};
diff --git a/packages/script-studio/src/index.ts b/packages/script-studio/src/index.ts
index ab571c98..90443983 100644
--- a/packages/script-studio/src/index.ts
+++ b/packages/script-studio/src/index.ts
@@ -1,14 +1,33 @@
-import { projectScriptTimeline } from "./projection.js";
+import { projectScriptTemporalDomain } from "./projection.js";
import { adjustScriptMoment, adjustScriptSelection, parseScript, scriptModuleRef } from "@hypit/script";
-import type { StudioScriptCompanion } from "@hypit/studio-adapter";
+import { narrativeTypes } from "@hypit/narrative";
+import { narrativeTemporalTypes } from "@hypit/narrative-temporal";
+import { sameType } from "@hypit/protocol";
+import type { StudioTemporalDomainCompanion } from "@hypit/studio-adapter";
-export const scriptStudioCompanions: readonly StudioScriptCompanion[] = [{
+const scriptTemporalSourceTypes = [narrativeTypes.segmentRef, narrativeTypes.selection, narrativeTypes.moment] as const;
+
+export const scriptStudioTemporalDomains: readonly StudioTemporalDomainCompanion[] = [{
id: "script",
match: { module: scriptModuleRef, surface: "script" },
- project: projectScriptTimeline,
+ valueTypes: [narrativeTypes.narrative, narrativeTemporalTypes.narrativeProjection],
+ sourceTypes: scriptTemporalSourceTypes,
+ presentation: { family: "narrative", tone: "teal", label: "Narrative", icon: "brand" },
+ identify({ type, value }) {
+ if (!scriptTemporalSourceTypes.some((candidate) => sameType(candidate, type))) return undefined;
+ const held = value as { readonly narrativeId?: unknown; readonly id?: unknown; readonly kind?: unknown };
+ if (typeof held.narrativeId !== "string" || typeof held.id !== "string") return undefined;
+ const kind = sameType(type, narrativeTypes.segmentRef) ? "segment"
+ : sameType(type, narrativeTypes.selection) ? "selection"
+ : sameType(type, narrativeTypes.moment) ? "moment"
+ : typeof held.kind === "string" ? held.kind : undefined;
+ return kind === undefined ? undefined : { domainId: held.narrativeId, kind, id: held.id };
+ },
+ project: projectScriptTemporalDomain,
observe(input) {
const narrativeId = input.attributes.id ?? "script";
if (typeof narrativeId !== "string" || narrativeId.length === 0) return undefined;
+ if (input.source === undefined || input.contentStart === undefined) return undefined;
const closing = `</${input.tag}>`;
const closeEnd = input.nextOffset;
if (closeEnd === undefined) return undefined;
@@ -16,39 +35,36 @@ export const scriptStudioCompanions: readonly StudioScriptCompanion[] = [{
if (end < input.contentStart || input.source.slice(end, closeEnd) !== closing) return undefined;
const parsed = parseScript(
input.sourceName,
- input.source.slice(input.contentStart, end),
- input.contentStart,
+ input.source.slice(input.contentStart, end), input.contentStart,
);
return {
- narrativeId,
+ domainId: narrativeId,
sourcePath: input.sourceName,
- range: { start: input.openingStart, end: closeEnd },
+ range: { start: input.range.start, end: closeEnd },
content: { start: input.contentStart, end },
- segments: parsed.segments.map((segment) => ({ id: segment.id, range: segment.range })),
- selections: parsed.selections.map((selection) => ({
- id: selection.id,
- startAnchorId: selection.startAnchorId,
- endAnchorId: selection.endAnchorId,
- open: selection.open.range,
- close: selection.close.range,
- })),
- moments: parsed.moments.map((moment) => ({
- id: moment.id,
- anchorId: moment.anchorId,
- range: moment.range,
- })),
- tokens: parsed.tokens.map((token) => ({ id: token.id, range: token.range })),
+ data: {
+ segments: parsed.segments.map((segment) => ({ id: segment.id, range: segment.range })),
+ selections: parsed.selections.map((selection) => ({
+ id: selection.id,
+ startAnchorId: selection.startAnchorId,
+ endAnchorId: selection.endAnchorId,
+ open: selection.open.range,
+ close: selection.close.range,
+ })),
+ moments: parsed.moments.map((moment) => ({ id: moment.id, anchorId: moment.anchorId, range: moment.range })),
+ tokens: parsed.tokens.map((token) => ({ id: token.id, range: token.range })),
+ },
};
},
adjust(input) {
const parsed = parseScript(input.sourceName, input.source);
- return input.adjustment.kind === "selection"
+ return input.adjustment.kind === "span"
? adjustScriptSelection({
sourceName: input.sourceName,
source: input.source,
parsed,
adjustment: {
- id: input.adjustment.id,
+ id: input.adjustment.itemId,
startAnchorId: input.adjustment.startAnchorId,
endAnchorId: input.adjustment.endAnchorId,
},
@@ -57,7 +73,7 @@ export const scriptStudioCompanions: readonly StudioScriptCompanion[] = [{
sourceName: input.sourceName,
source: input.source,
parsed,
- adjustment: { id: input.adjustment.id, anchorId: input.adjustment.anchorId },
+ adjustment: { id: input.adjustment.itemId, anchorId: input.adjustment.anchorId },
});
},
}];
diff --git a/packages/script-studio/src/projection.ts b/packages/script-studio/src/projection.ts
index a395a6e0..4cce4609 100644
--- a/packages/script-studio/src/projection.ts
+++ b/packages/script-studio/src/projection.ts
@@ -1,105 +1,87 @@
import { narrativeTypes } from "@hypit/narrative";
+import { narrativeTemporalTypes } from "@hypit/narrative-temporal";
+import type { NarrativeProjection } from "@hypit/narrative-temporal";
import { sameType } from "@hypit/protocol";
-import type { StudioScriptProjectionInput, StudioScriptProjection } from "@hypit/studio-adapter";
+import type { Range, StudioTemporalDomainProjection, StudioTemporalDomainProjectionInput } from "@hypit/studio-adapter";
type NarrativeValue = {
readonly id?: string;
- readonly segments?: readonly {
- readonly id: string;
- readonly startAnchorId: string;
- readonly endAnchorId: string;
- }[];
- readonly tokens?: readonly {
- readonly id: string;
- readonly segmentId: string;
- readonly startAnchorId: string;
- readonly endAnchorId: string;
- readonly text: string;
- }[];
- readonly selections?: readonly {
- readonly id: string;
- readonly startAnchorId: string;
- readonly endAnchorId: string;
- }[];
- readonly moments?: readonly {
- readonly id: string;
- readonly anchorId: string;
- }[];
- readonly semanticIndex?: {
- readonly anchors?: readonly {
- readonly id: string;
- readonly kind: "segment-start" | "segment-end" | "token-start" | "token-end";
- readonly segmentId?: string;
- readonly tokenId?: string;
- }[];
- };
+ readonly segments?: readonly { readonly id: string; readonly startAnchorId: string; readonly endAnchorId: string }[];
+ readonly tokens?: readonly { readonly id: string; readonly segmentId: string; readonly startAnchorId: string; readonly endAnchorId: string; readonly text: string }[];
+ readonly selections?: readonly { readonly id: string; readonly startAnchorId: string; readonly endAnchorId: string }[];
+ readonly moments?: readonly { readonly id: string; readonly anchorId: string }[];
+ readonly anchors?: readonly { readonly id: string; readonly kind: string; readonly segmentId?: string; readonly tokenId?: string }[];
};
-export function projectScriptTimeline(input: StudioScriptProjectionInput): StudioScriptProjection {
- const records = input.values.filter((item) =>
- sameType(item.type, narrativeTypes.narrative)
- && (item.value as NarrativeValue).id === input.source.narrativeId);
- if (records.length > 1) {
- throw new Error(`Studio Narrative id ${input.source.narrativeId} resolves to more than one authored value.`);
- }
- const record = records[0];
- const narrative = record?.value as NarrativeValue | undefined;
- if (narrative === undefined) throw new Error("Studio Narrative is not an inline authored value.");
+export type ScriptStudioObservation = {
+ readonly segments: readonly { readonly id: string; readonly range: Range }[];
+ readonly selections: readonly { readonly id: string; readonly startAnchorId: string; readonly endAnchorId: string; readonly open: Range; readonly close: Range }[];
+ readonly moments: readonly { readonly id: string; readonly anchorId: string; readonly range: Range }[];
+ readonly tokens: readonly { readonly id: string; readonly range: Range }[];
+};
- const segmentRanges = new Map((input.source.segments ?? []).map((item) => [item.id, item.range]));
- const tokenRanges = new Map((input.source.tokens ?? []).map((item) => [item.id, item.range]));
- const frame = (id: string): number | undefined => input.anchors.get(id);
+function one<T>(values: readonly T[], subject: string): T | undefined {
+ if (values.length > 1) throw new Error(`${subject} resolves to more than one authored value.`);
+ return values[0];
+}
+export function projectScriptTemporalDomain(input: StudioTemporalDomainProjectionInput): StudioTemporalDomainProjection | undefined {
+ const narrative = one(input.values.filter((item) => sameType(item.type, narrativeTypes.narrative)
+ && (item.value as NarrativeValue).id === input.source.domainId), `Studio Narrative id ${input.source.domainId}`)?.value as NarrativeValue | undefined;
+ if (narrative === undefined) return undefined;
+ const projection = one(input.values.filter((item) => sameType(item.type, narrativeTemporalTypes.narrativeProjection)
+ && (item.value as NarrativeProjection).narrativeId === input.source.domainId
+ && (item.value as NarrativeProjection).timelineId === input.timeline.id), `Studio Narrative projection ${input.source.domainId}`)?.value as NarrativeProjection | undefined;
+ if (projection === undefined) return undefined;
+ const source = input.source.data as ScriptStudioObservation;
+ const segmentRanges = new Map(source.segments.map((item) => [item.id, item.range]));
+ const tokenRanges = new Map(source.tokens.map((item) => [item.id, item.range]));
+ const selectionRanges = new Map(source.selections.map((item) => [item.id, { start: item.open.start, end: item.close.end }]));
+ const momentRanges = new Map(source.moments.map((item) => [item.id, item.range]));
+ const frame = new Map(projection.boundaries.map((boundary) => [boundary.id, boundary.frame]));
+ const tokenText = new Map((narrative.tokens ?? []).map((token) => [token.id, token.text]));
+ const anchors = (narrative.anchors ?? []).flatMap((anchor) => {
+ const at = frame.get(anchor.id);
+ if (at === undefined) return [];
+ const detail = [anchor.tokenId === undefined ? undefined : tokenText.get(anchor.tokenId), anchor.segmentId]
+ .filter((part): part is string => part !== undefined).join(" · ");
+ return [{ id: anchor.id, kind: anchor.kind, frame: at,
+ ...(anchor.tokenId === undefined ? {} : { label: tokenText.get(anchor.tokenId) ?? anchor.tokenId }),
+ ...(detail.length === 0 ? {} : { detail }) }];
+ });
const segments = (narrative.segments ?? []).flatMap((segment) => {
- const startFrame = frame(segment.startAnchorId);
- const endFrame = frame(segment.endAnchorId);
+ const startFrame = frame.get(segment.startAnchorId); const endFrame = frame.get(segment.endAnchorId);
if (startFrame === undefined || endFrame === undefined) return [];
- return [{
- id: segment.id,
- startFrame,
- endFrameExclusive: Math.max(startFrame + 1, endFrame),
- ...(segmentRanges.has(segment.id) ? { range: segmentRanges.get(segment.id)! } : {}),
- }];
+ return [{ kind: "span" as const, appearance: "block" as const, id: segment.id, laneId: "segments", label: segment.id,
+ source: { type: narrativeTypes.segmentRef, kind: "segment", id: segment.id }, startAnchorId: segment.startAnchorId,
+ endAnchorId: segment.endAnchorId, startFrame, endFrameExclusive: Math.max(startFrame + 1, endFrame),
+ ...(segmentRanges.has(segment.id) ? { range: segmentRanges.get(segment.id)! } : {}) }];
});
const tokens = (narrative.tokens ?? []).flatMap((token) => {
- const startFrame = frame(token.startAnchorId);
- const endFrame = frame(token.endAnchorId);
+ const startFrame = frame.get(token.startAnchorId); const endFrame = frame.get(token.endAnchorId);
if (startFrame === undefined || endFrame === undefined) return [];
- return [{
- id: token.id,
- segmentId: token.segmentId,
- text: token.text,
- startFrame,
- endFrameExclusive: Math.max(startFrame + 1, endFrame),
- ...(tokenRanges.has(token.id) ? { range: tokenRanges.get(token.id)! } : {}),
- }];
- });
- const anchors = (narrative.semanticIndex?.anchors ?? []).flatMap((anchor) => {
- const at = frame(anchor.id);
- if (at === undefined) return [];
- return [{
- id: anchor.id,
- kind: anchor.kind,
- frame: at,
- ...(anchor.segmentId === undefined ? {} : { segmentId: anchor.segmentId }),
- ...(anchor.tokenId === undefined ? {} : { tokenId: anchor.tokenId }),
- }];
+ return [{ kind: "span" as const, appearance: "compact" as const, id: token.id, laneId: "tokens", label: token.text,
+ startAnchorId: token.startAnchorId, endAnchorId: token.endAnchorId, startFrame,
+ endFrameExclusive: Math.max(startFrame + 1, endFrame), followPlayhead: true,
+ ...(tokenRanges.has(token.id) ? { range: tokenRanges.get(token.id)! } : {}) }];
});
const selections = (narrative.selections ?? []).flatMap((selection) => {
- const startFrame = frame(selection.startAnchorId);
- const endFrameExclusive = frame(selection.endAnchorId);
+ const startFrame = frame.get(selection.startAnchorId); const endFrameExclusive = frame.get(selection.endAnchorId);
if (startFrame === undefined || endFrameExclusive === undefined || endFrameExclusive <= startFrame) return [];
- return [{
- id: selection.id,
- startAnchorId: selection.startAnchorId,
- endAnchorId: selection.endAnchorId,
- startFrame,
- endFrameExclusive,
- }];
+ return [{ kind: "span" as const, appearance: "block" as const, id: selection.id, laneId: "intent", label: selection.id,
+ source: { type: narrativeTypes.selection, kind: "selection", id: selection.id }, editable: true,
+ startAnchorId: selection.startAnchorId, endAnchorId: selection.endAnchorId, startFrame, endFrameExclusive,
+ ...(selectionRanges.has(selection.id) ? { range: selectionRanges.get(selection.id)! } : {}) }];
});
const moments = (narrative.moments ?? []).flatMap((moment) => {
- const at = frame(moment.anchorId);
- return at === undefined ? [] : [{ id: moment.id, anchorId: moment.anchorId, frame: at }];
+ const at = frame.get(moment.anchorId); if (at === undefined) return [];
+ return [{ kind: "point" as const, appearance: "marker" as const, id: moment.id, laneId: "intent", label: moment.id,
+ source: { type: narrativeTypes.moment, kind: "moment", id: moment.id }, editable: true,
+ anchorId: moment.anchorId, frame: at, ...(momentRanges.has(moment.id) ? { range: momentRanges.get(moment.id)! } : {}) }];
});
- return { anchors, segments, tokens, selections, moments };
+ return { id: input.source.domainId, timelineId: input.timeline.id,
+ lanes: [{ id: "segments", label: "Segments", heightPx: 26 },
+ ...(tokens.length === 0 ? [] : [{ id: "tokens", label: "Words", heightPx: 26 }]),
+ ...(selections.length + moments.length === 0 ? [] : [{ id: "intent", label: "Intent", heightPx: 26 }])],
+ anchors, items: [...segments, ...tokens, ...selections, ...moments] };
}
diff --git a/packages/script-studio/test/script.test.ts b/packages/script-studio/test/script.test.ts
index 834a1e83..661c1b20 100644
--- a/packages/script-studio/test/script.test.ts
+++ b/packages/script-studio/test/script.test.ts
@@ -1,35 +1,45 @@
import assert from "node:assert/strict";
import test from "node:test";
import { decodeScriptSurface, parseScript, captionDocument } from "@hypit/script";
-import { scriptStudioCompanions } from "../src/index.js";
+import { narrativeTemporalTypes } from "@hypit/narrative-temporal";
+import { scriptStudioTemporalDomains } from "../src/index.js";
+import type { ScriptStudioObservation } from "../src/projection.js";
test("Studio observes and edits the compiler's Script body without changing its prose", () => {
- const companion = scriptStudioCompanions[0]!;
+ const companion = scriptStudioTemporalDomains[0]!;
const body = '<line><host>是的 就是这样。 <진행자>@{beat!}“안녕”{emphasis} 세계. \\<!-- 설명</line>';
const prefix = '<svml>\r\n<!-- 🎬 -->\r\n<script id="story">';
const source = `${prefix}${body}</script>\r\n</svml>`;
const input = { sourceName: "studio.svml", source, tag: "script", attributes: { id: "story" },
- openingStart: source.indexOf('<script'), contentStart: prefix.length };
+ openingStart: source.indexOf('<script'),
+ range: { start: source.indexOf('<script'), end: source.length - "\r\n</svml>".length }, contentStart: prefix.length };
const decoded = decodeScriptSurface(input);
const observed = companion.observe({ ...input, nextOffset: decoded.nextOffset })!;
assert.equal(source.slice(observed.content.start, observed.content.end), body);
- assert.equal(source.slice(observed.moments[0]!.range.start, observed.moments[0]!.range.end), '@{beat!}');
+ const observation = observed.data as ScriptStudioObservation;
+ assert.equal(source.slice(observation.moments[0]!.range.start, observation.moments[0]!.range.end), '@{beat!}');
const parsed = parseScript("body", body);
const anchorId = parsed.tokens[0]!.startAnchorId;
const changed = companion.adjust({ sourceName: "body", source: body,
- adjustment: { kind: "moment", id: "beat", anchorId } });
+ adjustment: { kind: "point", itemId: "beat", anchorId } });
const after = parseScript("body", changed);
assert.equal(after.moments[0]!.anchorId, anchorId);
assert.equal(changed.replace('@{beat!}', ''), body.replace('@{beat!}', ''));
assert.equal(after.serializations.speech, parsed.serializations.speech);
assert.deepEqual(captionDocument(after, "caption", "story"), captionDocument(parsed, "caption", "story"));
- const projection = companion.project!({ source: { ...observed, companion: companion.id },
- values: decoded.records.flatMap(record => record.value.kind === "inline"
- ? [{ id: record.id, type: record.type, value: record.value.value }] : []),
- anchors: new Map(parsed.semanticIndex.anchors.map((anchor, index) => [anchor.id, index * 3])),
+ const values = decoded.records.flatMap(record => record.value.kind === "inline"
+ ? [{ id: record.id, type: record.type, value: record.value.value }] : []);
+ values.push({ id: "story.projection", type: narrativeTemporalTypes.narrativeProjection, value: {
+ id: "story.projection", narrativeId: "story", timelineId: "film", segments: [], tokens: [],
+ boundaries: parsed.anchors.map((anchor, index) => ({ id: anchor.id, frame: index * 3 })),
+ } });
+ const projection = companion.project({ source: { ...observed, companion: companion.id }, values,
+ timeline: { id: "film", frameCount: 100, frameRate: { numerator: 30, denominator: 1 } },
});
- assert.deepEqual(projection.tokens.map(token => token.text), parsed.tokens.map(token => token.text));
- assert.deepEqual(projection.tokens.map(token => token.range), observed.tokens.map(token => token.range));
+ assert.ok(projection);
+ const tokens = projection.items.filter((item) => item.kind === "span" && item.appearance === "compact");
+ assert.deepEqual(tokens.map(token => token.label), parsed.tokens.map(token => token.text));
+ assert.deepEqual(tokens.map(token => token.range), observation.tokens.map(token => token.range));
});
diff --git a/packages/script/README.md b/packages/script/README.md
index 3db4237a..36c05e2b 100644
--- a/packages/script/README.md
+++ b/packages/script/README.md
@@ -47,7 +47,7 @@ components without importing Script internals.
The Surface exports one full Narrative plus narrow, immutable views:
-- `script.segment.<id>` is a narrow `NarrativeExcerpt` used to align generated or supplied media with one Segment;
+- `script.segment.<id>` is a narrow `NarrativeSegmentRef` used to align generated or supplied media with one Segment;
- `script.segment.<id>.dialogue` is ordinary `Text`: display-independent dialogue, including optional
Role cues and right-side Dual Text pronunciation, for a speech-video model;
- `script.segment.<id>.speech` is ordinary pronunciation-only `Text` for duration estimation or TTS;
diff --git a/packages/script/src/edit.ts b/packages/script/src/edit.ts
index 9aa948b5..a80167f9 100644
--- a/packages/script/src/edit.ts
+++ b/packages/script/src/edit.ts
@@ -31,7 +31,7 @@ type Edit = { readonly range: SourceRange; readonly replacement: string };
export function scriptAnchorEditSites(parsed: ParsedNarrative): readonly ScriptAnchorEditSite[] {
const segments = new Map(parsed.segments.map((segment) => [segment.id, segment] as const));
const tokens = new Map(parsed.tokens.map((token) => [token.id, token] as const));
- return parsed.semanticIndex.anchors.map((anchor): ScriptAnchorEditSite => {
+ return parsed.anchors.map((anchor): ScriptAnchorEditSite => {
const segmentId = anchor.segmentId;
const segment = segments.get(segmentId);
if (segment === undefined) throw new Error(`Semantic Anchor ${anchor.id} names unknown Segment ${segmentId}.`);
@@ -161,7 +161,7 @@ export function adjustScriptSelection(input: AdjustmentInput & { readonly adjust
const { adjustment, parsed } = input;
const selection = parsed.selections.find((item) => item.id === adjustment.id);
if (!selection) throw new Error(`Script Selection ${adjustment.id} does not exist.`);
- const order = parsed.semanticIndex.anchors.map((anchor) => anchor.id);
+ const order = parsed.anchors.map((anchor) => anchor.id);
const start = order.indexOf(adjustment.startAnchorId);
const end = order.indexOf(adjustment.endAnchorId);
if (start < 0 || end < start) throw new Error("Selection endpoints must follow Script anchor order.");
diff --git a/packages/script/src/index.ts b/packages/script/src/index.ts
index 98ee2616..650122d6 100644
--- a/packages/script/src/index.ts
+++ b/packages/script/src/index.ts
@@ -1,7 +1,7 @@
export { ScriptSyntaxError } from "./error.js";
export { adjustScriptMoment, adjustScriptSelection, scriptAnchorEditSites } from "./edit.js";
export { formatScript } from "./format.js";
-export { captionDocumentType, narrativeCaptionBindingType, narrativeExcerptType, narrativeMomentType, narrativeSelectionType, narrativeSchema, narrativeType, scriptManifest, scriptMarkupSurfaces, scriptModuleRef } from "./manifest.js";
+export { captionDocumentType, narrativeCaptionBindingType, narrativeSegmentRefType, narrativeMomentType, narrativeSelectionType, narrativeSchema, narrativeType, scriptManifest, scriptMarkupSurfaces, scriptModuleRef } from "./manifest.js";
export {
captionDocument,
captionDocumentValue,
diff --git a/packages/script/src/manifest.ts b/packages/script/src/manifest.ts
index 8688e942..e9d2e5dd 100644
--- a/packages/script/src/manifest.ts
+++ b/packages/script/src/manifest.ts
@@ -6,7 +6,7 @@ import type { ModuleManifest, TypeRef } from "@hypit/protocol";
export const scriptModuleRef = { name: "@hypit/script", version: "1" } as const;
export const narrativeType: TypeRef = narrativeTypes.narrative;
-export const narrativeExcerptType: TypeRef = narrativeTypes.excerpt;
+export const narrativeSegmentRefType: TypeRef = narrativeTypes.segmentRef;
export const narrativeSelectionType: TypeRef = narrativeTypes.selection;
export const narrativeMomentType: TypeRef = narrativeTypes.moment;
export const captionDocumentType: TypeRef = captionTypes.document;
@@ -20,7 +20,7 @@ export const scriptMarkupSurfaces = [
mode: "raw",
outputs: [
narrativeType,
- narrativeExcerptType,
+ narrativeSegmentRefType,
textTypes.text,
narrativeSelectionType,
narrativeMomentType,
@@ -37,7 +37,7 @@ export const scriptMarkupSurfaces = [
ports: [
{ name: "", type: narrativeType,
summary: "The complete authored Narrative, including speech structure, semantic anchors and its CaptionDocument, addressed by the element's own id." },
- { name: "segment.<id>", type: narrativeExcerptType,
+ { name: "segment.<id>", type: narrativeSegmentRefType,
summary: "One Segment as a narrow Excerpt, used to associate a generated Take with that Segment." },
{ name: "segment.<id>.dialogue", type: textTypes.text,
summary: "One Segment as display-independent dialogue, keeping Role Cue labels and the spoken side of Dual Text." },
diff --git a/packages/script/src/narrative.ts b/packages/script/src/narrative.ts
index a5ee5170..724dd429 100644
--- a/packages/script/src/narrative.ts
+++ b/packages/script/src/narrative.ts
@@ -224,14 +224,12 @@ export function narrativeValue(parsed: ParsedNarrative, id: string): CanonicalVa
endAnchorId: selection.close.boundary.anchorId,
})),
moments: parsed.moments.map((moment) => ({ id: moment.id, anchorId: moment.boundary.anchorId })),
- semanticIndex: {
- anchors: parsed.semanticIndex.anchors.map((anchor) => ({
- id: anchor.id,
- kind: anchor.kind,
- ...("segmentId" in anchor ? { segmentId: anchor.segmentId } : {}),
- ...("tokenId" in anchor && anchor.tokenId !== undefined ? { tokenId: anchor.tokenId } : {}),
- })),
- },
+ anchors: parsed.anchors.map((anchor) => ({
+ id: anchor.id,
+ kind: anchor.kind,
+ ...("segmentId" in anchor ? { segmentId: anchor.segmentId } : {}),
+ ...("tokenId" in anchor && anchor.tokenId !== undefined ? { tokenId: anchor.tokenId } : {}),
+ })),
});
}
diff --git a/packages/script/src/parser.ts b/packages/script/src/parser.ts
index a4ad0822..76ab5bfa 100644
--- a/packages/script/src/parser.ts
+++ b/packages/script/src/parser.ts
@@ -843,10 +843,7 @@ export function parseScript(
regions: captionRegions,
breaks: captionBreaks,
},
- semanticIndex: {
-
- anchors,
- },
+ anchors,
serializations: {
dialogue: dialogueTurns.join("\n"),
speech: speechSegments.join("\n"),
diff --git a/packages/script/src/surface.ts b/packages/script/src/surface.ts
index cb0b2829..12522c8b 100644
--- a/packages/script/src/surface.ts
+++ b/packages/script/src/surface.ts
@@ -12,7 +12,7 @@ import {
import {
captionDocumentType,
narrativeCaptionBindingType,
- narrativeExcerptType,
+ narrativeSegmentRefType,
narrativeMomentType,
narrativeSelectionType,
narrativeType,
@@ -98,7 +98,7 @@ export function decodeScriptSurface(input: ScriptSurfaceInput): ScriptSurfaceOut
},
...parsed.segments.map((segment) => ({
id: `${rawId}.segment.${segment.id}`,
- type: narrativeExcerptType,
+ type: narrativeSegmentRefType,
value: { kind: "inline" as const, value: narrativeSegmentExcerptValue(parsed, segment, rawId) },
range: segment.range,
})),
diff --git a/packages/script/test/edit.test.ts b/packages/script/test/edit.test.ts
index fa80d190..7e2ea286 100644
--- a/packages/script/test/edit.test.ts
+++ b/packages/script/test/edit.test.ts
@@ -24,7 +24,7 @@ for (const source of fixtures) test(`Moment round trips through structural and l
const move = (text: string, anchorId: string) => adjustScriptMoment({
sourceName: "edit", source: text, parsed: parseScript("edit", text), adjustment: { id: "beat", anchorId },
});
- for (const anchor of original.semanticIndex.anchors) {
+ for (const anchor of original.anchors) {
const first = move(source, anchor.id);
const back = move(first, original.moments[0]!.anchorId);
assert.deepEqual(narrativeValue(parseScript("edit", back), "story"), narrativeValue(original, "story"));
@@ -68,7 +68,7 @@ test("an unchanged Selection leaves its source formatting untouched", () => {
test("Selection endpoints sharing a source position are written together in semantic order", () => {
const source = '<one><HOST>@{range} hello @{/range} world.</one><empty/>';
const original = parseScript("edit", source);
- const anchors = original.semanticIndex.anchors;
+ const anchors = original.anchors;
for (let start = 0; start < anchors.length; start++) for (let end = start; end < anchors.length; end++) {
const adjustment = { id: "range", startAnchorId: anchors[start]!.id, endAnchorId: anchors[end]!.id };
const next = adjustScriptSelection({ sourceName: "edit", source, parsed: original, adjustment });
@@ -92,7 +92,7 @@ for (const source of [
adjustment: { id: selection.id, startAnchorId, endAnchorId },
});
const expected = move(source, selection.startAnchorId, selection.endAnchorId);
- const anchors = original.semanticIndex.anchors;
+ const anchors = original.anchors;
for (let start = 0; start < anchors.length; start++) for (let end = start; end < anchors.length; end++) {
const moved = move(expected, anchors[start]!.id, anchors[end]!.id);
const actual = parseScript("edit", moved).selections[0]!;
diff --git a/packages/script/test/markup-integration.test.ts b/packages/script/test/markup-integration.test.ts
index f360de30..5712644b 100644
--- a/packages/script/test/markup-integration.test.ts
+++ b/packages/script/test/markup-integration.test.ts
@@ -1,7 +1,7 @@
import { narrativeManifest } from "@hypit/narrative";
import { captionManifest } from "@hypit/caption";
import { narrativeCaptionManifest } from "@hypit/narrative-caption";
-import type { Narrative, NarrativeExcerpt } from "@hypit/narrative";
+import type { Narrative, NarrativeSegmentRef } from "@hypit/narrative";
import { textManifest } from "@hypit/text";
import assert from "node:assert/strict";
import test from "node:test";
@@ -68,7 +68,7 @@ test("Script teaches Markup <script> only through its imported Manifest", async
assert.equal(result.records[0]?.id, "story");
assert.equal(result.records[0]?.type.name, "Narrative");
assert.equal(result.records.some((record) =>
- record.id === "story.segment.opening" && record.type.name === "NarrativeExcerpt"), true);
+ record.id === "story.segment.opening" && record.type.name === "NarrativeSegmentRef"), true);
assert.equal(result.records.some((record) =>
record.id === "story.segment.opening.dialogue" && record.type.name === "Text"), true);
assert.equal(result.records.some((record) =>
diff --git a/packages/script/test/script.test.ts b/packages/script/test/script.test.ts
index 5e5680b7..7f44f136 100644
--- a/packages/script/test/script.test.ts
+++ b/packages/script/test/script.test.ts
@@ -54,8 +54,8 @@ test("Script outer cuts are the first and last Segment boundaries", () => {
const parsed = parseScript("outer-cuts.svml", source);
const selection = parsed.selections[0]!;
assert.deepEqual([selection.startAnchorId, selection.endAnchorId], ["segment:one:start", "segment:two:end"]);
- assert.equal(parsed.semanticIndex.anchors.length, 2 * parsed.tokens.length + 2 * parsed.segments.length);
- assert.equal(parsed.semanticIndex.anchors.some((anchor) => anchor.id.startsWith("program:")), false);
+ assert.equal(parsed.anchors.length, 2 * parsed.tokens.length + 2 * parsed.segments.length);
+ assert.equal(parsed.anchors.some((anchor) => anchor.id.startsWith("program:")), false);
});
test("Moment source edits relocate one marker to an exact semantic Anchor", () => {
@@ -81,7 +81,7 @@ test("Script keeps speech, dialogue and CaptionDocument as separate projections"
assert.equal(document.units[1]!.wordIds.length, 1);
assert.equal(narrativeCaptionBinding(parsed, "story.caption", "story").units[1]!.sourceTokenIds.length, 4);
assert.deepEqual(document.cueBreaks, []);
- assert.equal((narrativeValue(parsed, "story") as { semanticIndex: { anchors: unknown[] } }).semanticIndex.anchors.length,
+ assert.equal((narrativeValue(parsed, "story") as { anchors: unknown[] }).anchors.length,
2 * parsed.tokens.length + 2 * parsed.segments.length);
});
diff --git a/packages/speech-alignment/src/component.ts b/packages/speech-alignment/src/component.ts
index 37799322..c5f8d764 100644
--- a/packages/speech-alignment/src/component.ts
+++ b/packages/speech-alignment/src/component.ts
@@ -1,5 +1,5 @@
import type { ComponentPackage } from "@hypit/component-kit";
-import type { Narrative, NarrativeExcerpt } from "@hypit/narrative";
+import type { Narrative, NarrativeSegmentRef } from "@hypit/narrative";
import type { StoredValue } from "@hypit/protocol";
import { canonicalize } from "@hypit/protocol";
import type { AlignedTranscriptEvidence } from "@hypit/speech-evidence";
@@ -19,7 +19,7 @@ export const speechAlignmentComponent = {
handler: ({ inputs }) => {
const result = alignNarrative(
inline<Narrative>(inputs.narrative?.value, "Narrative"),
- inline<NarrativeExcerpt>(inputs.segment?.value, "NarrativeExcerpt"),
+ inline<NarrativeSegmentRef>(inputs.segment?.value, "NarrativeSegmentRef"),
inline<LocalTemporalDomain>(inputs.domain?.value, "LocalTemporalDomain"),
inline<AlignedTranscriptEvidence>(inputs.evidence?.value, "AlignedTranscriptEvidence"),
);
diff --git a/packages/speech-alignment/src/local.ts b/packages/speech-alignment/src/local.ts
index e291bbe6..2f6e60a2 100644
--- a/packages/speech-alignment/src/local.ts
+++ b/packages/speech-alignment/src/local.ts
@@ -1,4 +1,4 @@
-import type { Narrative, NarrativeExcerpt } from "@hypit/narrative";
+import type { Narrative, NarrativeSegmentRef } from "@hypit/narrative";
import type { NarrativeAlignment } from "@hypit/narrative-temporal";
import type { AlignedTranscriptEvidence } from "@hypit/speech-evidence";
import type { LocalTemporalDomain } from "@hypit/temporal";
@@ -7,12 +7,12 @@ import { locateAlignedSegmentTiming } from "./locate.js";
import { materializeNarrativeAlignment } from "./materialize.js";
import type { AlignmentBasis } from "./locate.js";
-function segmentNarrative(narrative: Narrative, excerpt: NarrativeExcerpt): Narrative {
+function segmentNarrative(narrative: Narrative, excerpt: NarrativeSegmentRef): Narrative {
if (excerpt.kind !== "segment") throw new Error("Narrative alignment requires a Segment excerpt.");
const segment = narrative.segments.find((candidate) => candidate.id === excerpt.id);
if (segment === undefined) throw new Error(`Narrative does not contain Segment ${excerpt.id}.`);
if (excerpt.tokenStart !== segment.tokenStart || excerpt.tokenEndExclusive !== segment.tokenEndExclusive) {
- throw new Error(`NarrativeExcerpt ${excerpt.id} does not describe its authored Segment.`);
+ throw new Error(`NarrativeSegmentRef ${excerpt.id} does not describe its authored Segment.`);
}
const tokens = narrative.tokens.slice(segment.tokenStart, segment.tokenEndExclusive);
return {
@@ -22,14 +22,14 @@ function segmentNarrative(narrative: Narrative, excerpt: NarrativeExcerpt): Narr
turns: narrative.turns.filter((turn) => turn.segmentId === segment.id).map((turn) => ({ ...turn,
tokenStart: turn.tokenStart - segment.tokenStart, tokenEndExclusive: turn.tokenEndExclusive - segment.tokenStart })),
selections: [], moments: [],
- semanticIndex: { anchors: narrative.semanticIndex.anchors.filter((anchor) => anchor.segmentId === segment.id) },
+ anchors: narrative.anchors.filter((anchor) => anchor.segmentId === segment.id),
};
}
/** Align one normalized source locally without turning media into a semantic aggregate. */
export function alignNarrative(
narrative: Narrative,
- excerpt: NarrativeExcerpt,
+ excerpt: NarrativeSegmentRef,
domain: LocalTemporalDomain,
evidence: AlignedTranscriptEvidence,
): NarrativeAlignment {
diff --git a/packages/speech-alignment/src/locate.ts b/packages/speech-alignment/src/locate.ts
index 39fc5b1b..5b1ef73b 100644
--- a/packages/speech-alignment/src/locate.ts
+++ b/packages/speech-alignment/src/locate.ts
@@ -463,7 +463,7 @@ export function locateAlignedSegmentTiming(
const tokensById = new Map(timedTokens.map((token) => [token.tokenId, token]));
const segmentsById = new Map(timedSegments.map((segment) => [segment.segmentId, segment]));
- const boundaries: LocalSemanticTimePoint[] = narrative.semanticIndex.anchors.flatMap((anchor): LocalSemanticTimePoint[] => {
+ const boundaries: LocalSemanticTimePoint[] = narrative.anchors.flatMap((anchor): LocalSemanticTimePoint[] => {
if (anchor.kind === "segment-start" || anchor.kind === "segment-end") {
const segment = segmentsById.get(anchor.segmentId)!;
return [anchor.kind === "segment-start"
diff --git a/packages/speech-alignment/src/manifest.ts b/packages/speech-alignment/src/manifest.ts
index b2a0d982..b847078f 100644
--- a/packages/speech-alignment/src/manifest.ts
+++ b/packages/speech-alignment/src/manifest.ts
@@ -14,7 +14,7 @@ export const speechAlignmentManifest: ModuleManifest = {
dependencies: [narrativeDependency, narrativeTemporalDependency, speechEvidenceDependency, temporalDependency],
types: [], capabilities: [], producers: [{
name: speechAlignmentProducers.alignNarrative.name,
- inputs: [{ name: "narrative", type: narrativeTypes.narrative }, { name: "segment", type: narrativeTypes.excerpt },
+ inputs: [{ name: "narrative", type: narrativeTypes.narrative }, { name: "segment", type: narrativeTypes.segmentRef },
{ name: "domain", type: temporalTypes.localDomain },
{ name: "evidence", type: speechEvidenceTypes.alignedTranscript }],
outputs: [{ name: "alignment", type: narrativeTemporalTypes.narrativeAlignment }],
diff --git a/packages/speech-alignment/src/materialize.ts b/packages/speech-alignment/src/materialize.ts
index d2f52513..e2f3aab1 100644
--- a/packages/speech-alignment/src/materialize.ts
+++ b/packages/speech-alignment/src/materialize.ts
@@ -1,4 +1,4 @@
-import type { Narrative, NarrativeExcerpt } from "@hypit/narrative";
+import type { Narrative, NarrativeSegmentRef } from "@hypit/narrative";
import { sealNarrativeAlignment } from "@hypit/narrative-temporal";
import type { NarrativeAlignment } from "@hypit/narrative-temporal";
import { assertLocalTemporalDomain } from "@hypit/temporal";
@@ -6,13 +6,13 @@ import type { LocalTemporalDomain } from "@hypit/temporal";
import type { NarrativeAlignmentTiming } from "./types.js";
-function authoredSegment(narrative: Narrative, excerpt: NarrativeExcerpt): Narrative["segments"][number] {
- if (narrative.id !== excerpt.narrativeId) throw new Error(`NarrativeExcerpt ${excerpt.id} belongs to another Narrative.`);
+function authoredSegment(narrative: Narrative, excerpt: NarrativeSegmentRef): Narrative["segments"][number] {
+ if (narrative.id !== excerpt.narrativeId) throw new Error(`NarrativeSegmentRef ${excerpt.id} belongs to another Narrative.`);
if (excerpt.kind !== "segment") throw new Error("NarrativeAlignment materialization requires a Segment excerpt.");
const segment = narrative.segments.find((candidate) => candidate.id === excerpt.id);
if (segment === undefined) throw new Error(`Narrative does not contain Segment ${excerpt.id}.`);
if (excerpt.tokenStart !== segment.tokenStart || excerpt.tokenEndExclusive !== segment.tokenEndExclusive) {
- throw new Error(`NarrativeExcerpt ${excerpt.id} does not describe its authored Segment.`);
+ throw new Error(`NarrativeSegmentRef ${excerpt.id} does not describe its authored Segment.`);
}
return segment;
}
@@ -24,7 +24,7 @@ function localFrame(frame: number, domain: LocalTemporalDomain, label: string):
return frame;
}
-export function materializeNarrativeAlignment(narrative: Narrative, excerpt: NarrativeExcerpt,
+export function materializeNarrativeAlignment(narrative: Narrative, excerpt: NarrativeSegmentRef,
domain: LocalTemporalDomain, timing: NarrativeAlignmentTiming): NarrativeAlignment {
assertLocalTemporalDomain(domain);
const segment = authoredSegment(narrative, excerpt);
@@ -39,7 +39,7 @@ export function materializeNarrativeAlignment(narrative: Narrative, excerpt: Nar
startBoundaryId: token.startAnchorId, endBoundaryId: token.endAnchorId };
});
const measuredById = new Map(timing.boundaries.map((boundary) => [boundary.id, boundary]));
- const boundaries = narrative.semanticIndex.anchors.filter((anchor) => anchor.segmentId === segment.id).map((anchor) => {
+ const boundaries = narrative.anchors.filter((anchor) => anchor.segmentId === segment.id).map((anchor) => {
const measured = measuredById.get(anchor.id);
if (measured === undefined) throw new Error(`Semantic timing does not locate Boundary ${anchor.id}.`);
return { id: anchor.id, frame: localFrame(measured.frame, domain, `Boundary ${anchor.id}`) };
diff --git a/packages/studio-adapter/README.md b/packages/studio-adapter/README.md
index 412af339..82c94ef4 100644
--- a/packages/studio-adapter/README.md
+++ b/packages/studio-adapter/README.md
@@ -138,7 +138,7 @@ fallback tries only the terminal object's exact `subjectId`/`authoredId`; render
are not alternate guesses.
Track Companions match terminal outputs by complete `TypeRef` and their authoring origin by complete
-`ModuleRef + Surface`; Film and Script companions use the same versioned origin match. Short Type
+`ModuleRef + Surface`; Film and temporal-domain Companions use the same versioned origin match. Short Type
and module names remain available for UI text and diagnostics but never decide which Companion is
allowed to interpret a value.
@@ -154,17 +154,19 @@ physical package identity, so executable package code cannot impersonate an
official Companion. The Source closure selects project packages; Studio does not
scan `node_modules` for plugins or use Runtime Profiles to select Companions.
-The same host facet can contribute Film, Script and parameter Companions. A Film Companion
-identifies its Timeline and terminal Tracks. The Timeline supplies the program range; semantic
-rows are populated when it carries Script anchors. A Script Companion owns source observation,
-projection of its values into Studio's segment/word/marker rows, and marker adjustment. Studio
-consumes that projection without reading the Script package's Narrative representation.
+The same host facet can contribute Film, temporal-domain and parameter Companions. A Film Companion
+identifies its Timeline and terminal Tracks. The Timeline supplies only the program range. A
+temporal-domain Companion owns source observation, requests the domain values it needs, projects
+generic anchors plus point/span items onto that Timeline, and receives inverse point/span edits.
+Script Studio uses this protocol for Narrative, but common Studio neither imports Narrative nor
+reserves segment, word, Selection or Moment slots. Another package can contribute beat, shot or
+motion-event domains through the same protocol.
For a domain item whose Spec is consumed beside a Window or Instant, call
`temporalLineageFor(context, item.id, "window")` using the actual projection input name. Attach the
returned lineage to that entity; the input may instead be `activation`, `outer` or another declared
port. Studio derives common timeline gestures from endpoint authority. No matching lineage means
-no inferred semantic edit; several matching edges require resolving the ambiguity in the component
+no inferred domain edit; several matching edges require resolving the ambiguity in the component
projection. Visible frame coincidence is not a source relationship.
## Expose authored parameters deliberately
@@ -206,7 +208,7 @@ an entity-specific `parameterReferences` override must identify the actual autho
Verify the integration in an ordinary Run: the intended Module/Surface matches, the expected entity
is selected, its field reaches the correct Source or Recipe, and changing it recomputes the preview.
-For semantic handles, verify the exact marker and its other consumers too. Read-only derived timing
+For domain handles, verify the exact point/span identity and its other consumers too. Read-only derived timing
is preferable to an invented inverse. The Companion explains the component; its Producers remain
responsible for identical video behavior in Studio, seeking and encoded rendering.
diff --git a/packages/studio-adapter/src/index.ts b/packages/studio-adapter/src/index.ts
index 846301c5..cdf7f8d5 100644
--- a/packages/studio-adapter/src/index.ts
+++ b/packages/studio-adapter/src/index.ts
@@ -40,11 +40,12 @@ export type StudioTimelinePresentation = {
export type StudioTemporalSource = {
readonly timelineId: string;
- readonly narrativeId?: string;
/** Domain-owned Type and role; Studio does not enumerate future time domains. */
readonly type: TypeRef;
readonly kind: string;
readonly id: string;
+ /** Present only when a package Companion recognizes the domain-owned value. */
+ readonly domain?: { readonly companion: string; readonly id: string };
};
export type StudioTemporalAuthority =
@@ -270,12 +271,12 @@ export type StudioTimelineGesture =
export type StudioEditCoordinate =
| "program-frame"
- | "semantic-anchor"
+ | "domain-anchor"
| "source-frame"
| "canvas-pixel"
| "normalized-progress";
-export type StudioSnapTarget = "frame" | "semantic-anchor" | "item-edge";
+export type StudioSnapTarget = "frame" | "domain-anchor" | "item-edge";
export type StudioEditSourceRole = "start" | "end" | "duration" | "frame" | "x" | "y";
@@ -284,18 +285,20 @@ export type StudioEditSource = {
readonly source: StudioSourceBinding["source"];
};
-export type StudioSemanticEditTarget =
+export type StudioTemporalDomainEditTarget =
| {
- readonly kind: "selection";
- readonly narrativeId: string;
- readonly id: string;
+ readonly kind: "span";
+ readonly companion: string;
+ readonly domainId: string;
+ readonly itemId: string;
readonly startAnchorId: string;
readonly endAnchorId: string;
}
| {
- readonly kind: "moment";
- readonly narrativeId: string;
- readonly id: string;
+ readonly kind: "point";
+ readonly companion: string;
+ readonly domainId: string;
+ readonly itemId: string;
readonly anchorId: string;
};
@@ -307,13 +310,13 @@ 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. */
+ /** How moving a domain 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[];
- /** Shared Script identity adjusted by this rectangle; every consumer follows it. */
- readonly semantic?: StudioSemanticEditTarget;
+ /** Package-owned temporal-domain identity adjusted by this rectangle. */
+ readonly domain?: StudioTemporalDomainEditTarget;
/** Exact endpoint authority used to validate and execute this inverse. */
readonly temporal?: StudioTemporalProjection;
readonly disabledReason?: string;
@@ -372,56 +375,68 @@ export type StudioCandidateProvenance = {
readonly errors: readonly string[];
};
-export type StudioSemanticAnchor = {
+export type StudioTemporalDomainAnchor = {
readonly id: string;
- readonly kind: "segment-start" | "segment-end" | "token-start" | "token-end";
readonly frame: number;
- readonly segmentId?: string;
- readonly tokenId?: string;
+ /** Domain-owned classification used only for display and stable coincident-point ordering. */
+ readonly kind: string;
+ readonly label?: string;
+ readonly detail?: string;
+ readonly range?: Range;
};
-export type StudioSemanticSegment = {
+export type StudioTemporalDomainLane = {
readonly id: string;
- readonly startFrame: number;
- readonly endFrameExclusive: number;
- readonly range?: Range;
+ readonly label?: string;
+ readonly heightPx: number;
};
-export type StudioSemanticToken = {
+export type StudioTemporalDomainItem = {
readonly id: string;
- readonly segmentId: string;
- readonly text: string;
+ readonly laneId: string;
+ readonly label: string;
+ readonly range?: Range;
+ /** Matches the domain-owned value carried by Temporal lineage. */
+ readonly source?: { readonly type: TypeRef; readonly kind: string; readonly id: string };
+ /** Allows the package Companion to receive an inverse edit for this item. */
+ readonly editable?: boolean;
+ /** Let the code pane follow this item's source range while the playhead crosses it. */
+ readonly followPlayhead?: boolean;
+} & ({
+ readonly kind: "span";
+ readonly appearance: "block" | "compact";
+ readonly startAnchorId: string;
+ readonly endAnchorId: string;
readonly startFrame: number;
readonly endFrameExclusive: number;
- readonly range?: Range;
-};
+} | {
+ readonly kind: "point";
+ readonly appearance: "marker";
+ readonly anchorId: string;
+ readonly frame: number;
+});
-export type StudioSemanticTimeline = {
+export type StudioTemporalDomainView = {
+ /** Domain identity supplied by its package, such as one Narrative id. */
+ readonly id: string;
+ /** Qualified Companion identity; together with id this is globally unambiguous. */
+ readonly companion: string;
readonly timelineId: string;
- readonly narrativeId: string;
readonly presentation: {
readonly family: StudioTrackFamily;
readonly tone: StudioTimelineTone;
readonly label?: string;
readonly icon: StudioIcon;
- readonly lane: StudioLaneDescription;
};
- readonly anchors: readonly StudioSemanticAnchor[];
- readonly segments: readonly StudioSemanticSegment[];
- readonly tokens: readonly StudioSemanticToken[];
- readonly selections: readonly {
- readonly id: string;
- readonly startAnchorId: string;
- readonly endAnchorId: string;
- readonly startFrame: number;
- readonly endFrameExclusive: number;
- }[];
- readonly moments: readonly {
- readonly id: string;
- readonly anchorId: string;
- readonly frame: number;
- }[];
+ readonly lanes: readonly StudioTemporalDomainLane[];
+ readonly anchors: readonly StudioTemporalDomainAnchor[];
+ readonly items: readonly StudioTemporalDomainItem[];
readonly provenance: StudioCandidateProvenance;
+ /** Exact package-owned author source used only for inverse dispatch. */
+ readonly source: {
+ readonly path: string;
+ readonly content: Range;
+ };
};
export type StudioObservedValue = {
@@ -561,7 +576,7 @@ export type StudioTrackCompanionContext = {
readonly values: ReadonlyMap<string, unknown>;
/** Temporal values in this Track's actual executed dependency closure. */
readonly temporalBindings: readonly StudioTemporalBinding[];
- readonly semantic: StudioSemanticTimeline | undefined;
+ readonly temporalDomains: readonly StudioTemporalDomainView[];
readonly generic: () => readonly StudioEntityDraft[];
};
@@ -606,7 +621,7 @@ export type StudioCompanionContribution = {
readonly format: "hypit.studio-companions@1";
readonly tracks: readonly StudioTrackCompanion[];
readonly films?: readonly StudioFilmCompanion[];
- readonly scripts?: readonly StudioScriptCompanion[];
+ readonly temporalDomains?: readonly StudioTemporalDomainCompanion[];
readonly parameters?: readonly StudioParameterCompanion[];
};
@@ -626,54 +641,68 @@ export type StudioFilmCompanion = {
};
};
-export type StudioScriptSourceMap = {
+export type StudioTemporalDomainSourceMap = {
readonly companion: string;
- readonly narrativeId: string;
+ readonly domainId: string;
readonly sourcePath: string;
readonly range: Range;
readonly content: Range;
- readonly segments: readonly { readonly id: string; readonly range: Range }[];
- readonly selections: readonly {
- readonly id: string;
- readonly startAnchorId: string;
- readonly endAnchorId: string;
- readonly open: Range;
- readonly close: Range;
- }[];
- readonly moments: readonly { readonly id: string; readonly anchorId: string; readonly range: Range }[];
- readonly tokens: readonly { readonly id: string; readonly range: Range }[];
+ /** Opaque package-owned observation; common Studio never interprets its fields. */
+ readonly data: unknown;
};
-export type StudioScriptAdjustment =
- | { readonly kind: "selection"; readonly id: string; readonly startAnchorId: string; readonly endAnchorId: string }
- | { readonly kind: "moment"; readonly id: string; readonly anchorId: string };
+export type StudioTemporalDomainAdjustment =
+ | { readonly kind: "span"; readonly itemId: string; readonly startAnchorId: string; readonly endAnchorId: string }
+ | { readonly kind: "point"; readonly itemId: string; readonly anchorId: string };
-export type StudioScriptProjection = Pick<StudioSemanticTimeline, "anchors" | "segments" | "tokens" | "selections" | "moments">;
-export type StudioScriptProjectionInput = {
- readonly source: StudioScriptSourceMap;
+export type StudioTemporalDomainProjection = Pick<StudioTemporalDomainView, "id" | "timelineId" | "lanes" | "anchors" | "items">;
+export type StudioTemporalDomainProjectionInput = {
+ readonly source: StudioTemporalDomainSourceMap;
readonly values: readonly StudioObservedValue[];
- readonly anchors: ReadonlyMap<string, number>;
+ readonly timeline: {
+ readonly id: string;
+ readonly frameRate: { readonly numerator: number; readonly denominator: number };
+ readonly frameCount: number;
+ };
};
-/** Script grammar companion. It owns source observation and semantic inverse edits. */
-export type StudioScriptCompanion = {
+/** A package projects its own temporal facts and receives its own inverse edits. */
+export type StudioTemporalDomainCompanion = {
readonly id: string;
readonly match: { readonly module: ModuleRef; readonly surface: string };
+ /** Inline values required to build the domain view after execution. */
+ readonly valueTypes: readonly TypeRef[];
+ /** Domain reference Types that may appear in executed Temporal lineage. */
+ readonly sourceTypes: readonly TypeRef[];
+ readonly presentation: {
+ readonly family: StudioTrackFamily;
+ readonly tone: StudioTimelineTone;
+ readonly label?: string;
+ readonly icon: StudioIcon;
+ };
+ readonly identify: (input: { readonly type: TypeRef; readonly value: unknown }) => {
+ readonly domainId: string;
+ readonly kind: string;
+ readonly id: string;
+ } | undefined;
readonly observe: (input: {
readonly sourceName: string;
- readonly source: string;
+ /** Raw Surfaces receive Source text; structured Surfaces can rely on their decoded attributes/range. */
+ readonly source?: string;
readonly tag: string;
- readonly openingStart: number;
- readonly contentStart: number;
+ /** Exact whole element range for raw and structured Surfaces alike. */
+ readonly range: Range;
+ /** Raw grammars may expose their body boundaries for package-owned parsing. */
+ readonly contentStart?: number;
/** Authoritative end returned by the raw Surface after it parsed its own grammar. */
readonly nextOffset?: number;
readonly attributes: Readonly<Record<string, unknown>>;
- }) => Omit<StudioScriptSourceMap, "companion"> | undefined;
- readonly project?: (input: StudioScriptProjectionInput) => StudioScriptProjection;
+ }) => Omit<StudioTemporalDomainSourceMap, "companion"> | undefined;
+ readonly project: (input: StudioTemporalDomainProjectionInput) => StudioTemporalDomainProjection | undefined;
readonly adjust: (input: {
readonly sourceName: string;
readonly source: string;
- readonly adjustment: StudioScriptAdjustment;
+ readonly adjustment: StudioTemporalDomainAdjustment;
}) => string;
};
@@ -692,7 +721,7 @@ export function createStudioTrackCompanionHostFacet(tracks: readonly StudioTrack
export function createStudioCompanionHostFacet(input: {
readonly tracks?: readonly StudioTrackCompanion[];
readonly films?: readonly StudioFilmCompanion[];
- readonly scripts?: readonly StudioScriptCompanion[];
+ readonly temporalDomains?: readonly StudioTemporalDomainCompanion[];
readonly parameters?: readonly StudioParameterCompanion[];
}): StudioCompanionHostFacet {
return {
@@ -701,7 +730,7 @@ export function createStudioCompanionHostFacet(input: {
format: "hypit.studio-companions@1",
tracks: input.tracks ?? [],
...(input.films === undefined ? {} : { films: input.films }),
- ...(input.scripts === undefined ? {} : { scripts: input.scripts }),
+ ...(input.temporalDomains === undefined ? {} : { temporalDomains: input.temporalDomains }),
...(input.parameters === undefined ? {} : { parameters: input.parameters }),
},
};
@@ -710,7 +739,7 @@ export function createStudioCompanionHostFacet(input: {
export type StudioPackageContribution = {
readonly tracks: readonly StudioTrackCompanion[];
readonly films: readonly StudioFilmCompanion[];
- readonly scripts: readonly StudioScriptCompanion[];
+ readonly temporalDomains: readonly StudioTemporalDomainCompanion[];
readonly parameters: readonly StudioParameterCompanion[];
};
@@ -728,7 +757,7 @@ export function studioContributionFromPackage(
if (owner.length === 0 || owner.includes("#")) throw new Error(`Invalid Studio companion package identity: ${owner}`);
const tracks: StudioTrackCompanion[] = [];
const films: StudioFilmCompanion[] = [];
- const scripts: StudioScriptCompanion[] = [];
+ const temporalDomains: StudioTemporalDomainCompanion[] = [];
const parameters: StudioParameterCompanion[] = [];
for (const facet of facets) {
if (facet.abi !== studioCompanionHostAbi) continue;
@@ -747,12 +776,12 @@ export function studioContributionFromPackage(
parameters.push(...(contribution.parameters ?? []).map((parameter) => ({
...parameter, id: qualify(owner, parameter.id, "Studio Parameter companion"),
})));
- scripts.push(...(contribution.scripts ?? []).map((script) => ({
- ...script,
- id: qualify(owner, script.id, "Studio Script companion"),
+ temporalDomains.push(...(contribution.temporalDomains ?? []).map((domain) => ({
+ ...domain,
+ id: qualify(owner, domain.id, "Studio Temporal Domain companion"),
})));
}
- return { tracks, films, scripts, parameters };
+ return { tracks, films, temporalDomains, parameters };
}
/**
@@ -930,20 +959,21 @@ export function temporalLineageFor(
};
}
-/** Unique semantic author identity carried by one projection, when there is one. */
-export function temporalSemanticSource(lineage: StudioTemporalLineage | undefined): StudioTemporalSource | undefined {
+/** Unique domain-owned author identity carried by one projection, when there is one. */
+export function temporalDomainSource(lineage: StudioTemporalLineage | undefined): StudioTemporalSource | undefined {
if (lineage === undefined) return undefined;
const projection = lineage.projection;
const endpoints = projection.kind === "instant" ? [projection] : [projection.start, projection.end];
- const semantic = endpoints.flatMap((endpoint) => endpoint.authority.kind === "domain"
+ const domain = endpoints.flatMap((endpoint) => endpoint.authority.kind === "domain"
? [endpoint.authority.source]
: []);
- const first = semantic[0];
+ const first = domain[0];
if (first === undefined) return undefined;
- return semantic.every((candidate) => candidate.kind === first.kind
+ return domain.every((candidate) => candidate.kind === first.kind
&& candidate.id === first.id
&& candidate.timelineId === first.timelineId
- && candidate.narrativeId === first.narrativeId)
+ && candidate.domain?.companion === first.domain?.companion
+ && candidate.domain?.id === first.domain?.id)
? first
: undefined;
}
diff --git a/packages/studio/INSPECTOR.md b/packages/studio/INSPECTOR.md
index 5e81ae12..efd600a4 100644
--- a/packages/studio/INSPECTOR.md
+++ b/packages/studio/INSPECTOR.md
@@ -75,7 +75,7 @@ also inform the input when no presentation override is provided. Empty input is
SVML strings escape attribute delimiters and entity characters. SVS values use `formatSvsValue`.
Neither the UI nor a Companion writes source text through an arbitrary callback. Timeline temporal
gestures are separate from Inspector field conversion; see the temporal author forms for their
-semantic-anchor and local-offset editing behavior.
+domain-anchor and local-offset editing behavior.
## Choices retain their actual value
diff --git a/packages/studio/README.md b/packages/studio/README.md
index bbecca54..91645ba4 100644
--- a/packages/studio/README.md
+++ b/packages/studio/README.md
@@ -141,14 +141,15 @@ a separate, planned connection; **Send comment** currently saves the note only.
### Composition editing
The selected targets must reach one Film and its resolved time source. Studio rejects several
-distinct Films in one view; use separate Runs/sessions for those. A Timeline supplies the
-placed material and semantic timing, including wordless Segments. The ruler always shows program
-time. When placed Segments are present, its left Timeline header spans the time ticks and the
-Segment, Word and Selection/Moment bands. Empty Word or marker bands are omitted based on the
-whole work, not the visible window or playhead. With no Segments, only the ordinary time ruler remains.
-The complete ruler area stays pinned while component tracks scroll.
-
-Semantic objects retain declaration-order drawing within each band. Their fine borders distinguish
+distinct Films in one view; use separate Runs/sessions for those. A Timeline supplies the complete
+program range and the ruler always shows program time. Independently installed temporal-domain
+Companions may add labelled lanes of anchors, points and spans. Script Studio projects Narrative
+Segments, words, Selections and Moments this way; common Studio has no Narrative slot or
+Narrative-shaped fallback. A beat or shot package can use the same surface without changing Studio.
+Empty domain lanes are omitted based on the whole work, not the visible window or playhead. The
+complete ruler area stays pinned while component tracks scroll.
+
+Domain items retain Companion projection order within each lane. Their fine borders distinguish
adjacent and overlapping intervals without inventing time gaps. Selection raises an object above
its peers; playback highlighting changes color without changing that order. Right-click an overlap
to choose a covered object. These are editor presentation rules, independent of Film paint order.
@@ -167,9 +168,9 @@ the selected entity. A reference can resolve to a shared Frame or Recipe, so one
may affect several consumers. Structured fields save together when editing ends and the value is complete; missing required values stay in the editor with a completion hint.
Check save status; source conflicts reject stale edits rather than overwrite newer files.
-Script source ranges come from its raw Surface and Companion. Marker edits use Script's parsed
-anchors and preserve unrelated prose, whitespace and word attributes; the displayed timeline words
-are not a replacement text source. Recipe parameter reads use the same Source Header preparation
+Temporal-domain source ranges come from their package Companion. For Script, marker edits use its
+parsed anchors and preserve unrelated prose, whitespace and word attributes; the displayed timeline
+words are not a replacement text source. Recipe parameter reads use the same Source Header preparation
as compilation, preserving UTF-16 offsets for the exact property being edited.
The Timeline owns the editor's complete range; displayed objects do not extend it. Take placement
@@ -180,14 +181,14 @@ Moment edits Script and moves its consumers after recompilation. A parameter-bas
handle edits its exact authored parameter. Fixed or derived values with no supported
inverse remain read-only. Seeing an entity does not promise every drag gesture.
-A direct `during={selection}` move advances both endpoints by the same number of semantic
+A direct `during={selection}` move advances both endpoints by the same number of domain
stops (distinct frame positions), so its duration may change. `at/for` moves its event and
offers a trailing duration trim; `until/for` offers the corresponding leading trim.
An Instant reference expression edits only its offset; a bare reference has an implicit zero offset.
`start/end` trims edit the corresponding expression; moving the window shifts both by the same
frame delta. Edited clock values and offsets are written in frames at the current Timeline rate.
-The semantic marker Inspector exposes exact anchor identities and, where a
-declared handle supports it, offers choices among coincident anchors.
+The domain-item Inspector exposes exact anchor identities and, where a declared handle supports it,
+offers choices among coincident anchors. Their meaning and writeback remain package-owned.
See [temporal author forms](../temporal-markup/EDITING.md) for the complete behavior.
Tasks and Artifacts are inspection surfaces; selecting an Artifact does not write a
diff --git a/packages/studio/locales/en.json b/packages/studio/locales/en.json
index 1a7b49cf..249a91e9 100644
--- a/packages/studio/locales/en.json
+++ b/packages/studio/locales/en.json
@@ -53,10 +53,6 @@
"common.waiting": "Waiting",
"inspector.add-color": "Add color",
"inspector.add-item": "Add item",
- "inspector.anchor.segment-end": "Segment end{detail}",
- "inspector.anchor.segment-start": "Segment start{detail}",
- "inspector.anchor.token-end": "Word end{detail}",
- "inspector.anchor.token-start": "Word start{detail}",
"inspector.aspect-ratio": "Aspect ratio",
"inspector.author": "Author",
"inspector.build": "Build",
@@ -65,7 +61,6 @@
"inspector.duration": "Duration",
"inspector.empty": "No details for this selection",
"inspector.end": "End",
- "inspector.end-anchor": "End semantic anchor",
"inspector.frame-rate": "Frame rate",
"inspector.frames": "Frames",
"inspector.how": "How",
@@ -75,7 +70,6 @@
"other": "{count} items"
},
"inspector.moment": "Moment",
- "inspector.moment-anchor": "Moment semantic anchor",
"inspector.move-down": "Move down",
"inspector.move-up": "Move up",
"inspector.project": "Project",
@@ -83,10 +77,8 @@
"inspector.remove-item": "Remove item",
"inspector.resolution": "Resolution",
"inspector.run": "Run",
- "inspector.semantic-anchors": "Semantic anchors",
"inspector.sources": "Sources",
"inspector.start": "Start",
- "inspector.start-anchor": "Start semantic anchor",
"inspector.structured-value": "Structured value",
"inspector.targets": "Targets",
"inspector.timeline": "Timeline",
@@ -176,22 +168,12 @@
"tasks.refresh-hint": "Refresh to read the latest task status.",
"tasks.saved-only": "Saved project Results · no Runtime selected",
"timeline.fit-timeline": "Fit timeline",
- "timeline.moment-name": "Moment {name}",
"timeline.overlapping-timeline-objects": "Overlapping timeline objects",
"timeline.resize-timeline-track-labels": "Resize timeline track labels",
"timeline.resize-track-labels": "Resize track labels",
- "timeline.segment-name": "Segment {name}",
- "timeline.segments": "Segments",
"timeline.select": "Select",
- "timeline.selection-name": "Selection {name}",
- "timeline.selections-and-moments": "Selections and Moments",
- "timeline.words": "Words",
"timeline.zoom-in": "Zoom in",
"timeline.zoom-out": "Zoom out",
- "inspector.color-picker": "{label} picker",
- "timeline.segment-count": {
- "one": "{count} segment",
- "other": "{count} segments"
- }
+ "inspector.color-picker": "{label} picker"
}
}
diff --git a/packages/studio/locales/zh-CN.json b/packages/studio/locales/zh-CN.json
index 6a1f42d3..87f1f092 100644
--- a/packages/studio/locales/zh-CN.json
+++ b/packages/studio/locales/zh-CN.json
@@ -53,10 +53,6 @@
"common.waiting": "等待中",
"inspector.add-color": "添加颜色",
"inspector.add-item": "添加条目",
- "inspector.anchor.segment-end": "段尾{detail}",
- "inspector.anchor.segment-start": "段头{detail}",
- "inspector.anchor.token-end": "词尾{detail}",
- "inspector.anchor.token-start": "词头{detail}",
"inspector.aspect-ratio": "画幅比例",
"inspector.author": "源文件",
"inspector.build": "构建",
@@ -65,14 +61,12 @@
"inspector.duration": "时长",
"inspector.empty": "当前选中项没有详细信息",
"inspector.end": "终点",
- "inspector.end-anchor": "终点语义锚点",
"inspector.frame-rate": "帧率",
"inspector.frames": "帧数",
"inspector.how": "样式",
"inspector.invalid-fields": "请正确填写必填项后保存。",
"inspector.item-count": "{count} 项",
"inspector.moment": "时刻",
- "inspector.moment-anchor": "时刻语义锚点",
"inspector.move-down": "下移",
"inspector.move-up": "上移",
"inspector.project": "项目",
@@ -80,10 +74,8 @@
"inspector.remove-item": "移除条目",
"inspector.resolution": "分辨率",
"inspector.run": "运行方案",
- "inspector.semantic-anchors": "语义锚点",
"inspector.sources": "引用文件",
"inspector.start": "起点",
- "inspector.start-anchor": "起点语义锚点",
"inspector.structured-value": "结构化值",
"inspector.targets": "目标产物",
"inspector.timeline": "时间线",
@@ -173,19 +165,12 @@
"tasks.refresh-hint": "点击刷新,查看最新任务状态。",
"tasks.saved-only": "项目中保存的结果 · 未选择运行环境",
"timeline.fit-timeline": "适配时间线",
- "timeline.moment-name": "时刻 {name}",
"timeline.overlapping-timeline-objects": "重叠的时间线对象",
"timeline.resize-timeline-track-labels": "调整轨道名称区宽度",
"timeline.resize-track-labels": "调整轨道名称区宽度",
- "timeline.segment-name": "片段 {name}",
- "timeline.segments": "片段",
"timeline.select": "选择",
- "timeline.selection-name": "区间 {name}",
- "timeline.selections-and-moments": "区间与时刻",
- "timeline.words": "词语",
"timeline.zoom-in": "放大",
"timeline.zoom-out": "缩小",
- "inspector.color-picker": "{label}取色器",
- "timeline.segment-count": "{count} 个片段"
+ "inspector.color-picker": "{label}取色器"
}
}
diff --git a/packages/studio/package.json b/packages/studio/package.json
index dfc72793..c872be42 100644
--- a/packages/studio/package.json
+++ b/packages/studio/package.json
@@ -35,7 +35,6 @@
"@hypit/screen-overlay-studio": "workspace:*",
"@hypit/script-studio": "workspace:*",
"@hypit/speech": "workspace:*",
- "@hypit/narrative-temporal": "workspace:*",
"@hypit/studio-adapter": "workspace:*",
"@hypit/svs": "workspace:*",
"@hypit/temporal": "workspace:*",
diff --git a/packages/studio/src/companion-assembly.ts b/packages/studio/src/companion-assembly.ts
index cd52bf6e..41eaaef6 100644
--- a/packages/studio/src/companion-assembly.ts
+++ b/packages/studio/src/companion-assembly.ts
@@ -33,7 +33,7 @@ export async function loadStudioCompanionRegistry(input: {
[...fallbackStudioTrackCompanions, ...contributions.flatMap((item) => item.tracks)],
{
films: contributions.flatMap((item) => item.films),
- scripts: contributions.flatMap((item) => item.scripts),
+ temporalDomains: contributions.flatMap((item) => item.temporalDomains),
parameters: contributions.flatMap((item) => item.parameters),
},
);
diff --git a/packages/studio/src/compile.ts b/packages/studio/src/compile.ts
index b4532be9..899adc52 100644
--- a/packages/studio/src/compile.ts
+++ b/packages/studio/src/compile.ts
@@ -145,7 +145,7 @@ function normalizeObservations(
}),
};
});
- return { placements, sourceMaps: observations.sourceMaps };
+ return { placements, temporalDomains: observations.temporalDomains };
}
async function bytesOf(attachment: ArtifactAttachment): Promise<Uint8Array> {
diff --git a/packages/studio/src/fallback-companions.ts b/packages/studio/src/fallback-companions.ts
index 7d789f1b..eeed636b 100644
--- a/packages/studio/src/fallback-companions.ts
+++ b/packages/studio/src/fallback-companions.ts
@@ -1,5 +1,5 @@
import type { StudioTrackCompanion, StudioTrackCompanionContext, StudioEntityDraft } from "@hypit/studio-adapter";
-import { artifactPreview, previewLayer, temporalLineageFor, temporalSemanticSource } from "@hypit/studio-adapter";
+import { artifactPreview, previewLayer, temporalLineageFor, temporalDomainSource } from "@hypit/studio-adapter";
import { compositionTypes } from "@hypit/composition";
import { timelineTypes } from "@hypit/timeline";
@@ -28,12 +28,12 @@ function withTemporalLineage(
): StudioEntityDraft {
const temporal = temporalLineageFor(context, entity.authoredId);
if (temporal === undefined) return entity;
- const semanticSource = temporalSemanticSource(temporal);
+ const domainSource = temporalDomainSource(temporal);
return {
...entity,
- ...(semanticSource?.id === undefined
+ ...(domainSource?.id === undefined
? {}
- : { markerId: semanticSource.id }),
+ : { markerId: domainSource.id }),
temporal,
};
}
@@ -79,8 +79,8 @@ function projectTerminalAudio(context: StudioTrackCompanionContext): readonly St
/** Cross-domain terminal protocols understood even when no Companion is installed. */
export const fallbackStudioTrackCompanions: readonly StudioTrackCompanion[] = [
{
- id: "@hypit/studio#timeline", role: "timeline", output: { type: timelineTypes.track },
- family: "semantic", tone: "teal", label: "Timeline", icon: "brand",
+ id: "@hypit/studio#timeline", role: "timeline", output: { type: timelineTypes.timeline },
+ family: "timeline", tone: "teal", label: "Timeline", icon: "brand",
lane: { heightPx: 45 },
},
{
diff --git a/packages/studio/src/observe.ts b/packages/studio/src/observe.ts
index 56130ec6..eb21d401 100644
--- a/packages/studio/src/observe.ts
+++ b/packages/studio/src/observe.ts
@@ -11,7 +11,7 @@ import type {
MarkupSurfaceRegistryLike, RegisteredSurface, StructuredElement, StructuredSurfaceInput, SurfaceDecodeOutput,
} from "@hypit/markup";
import type { ModuleRef } from "@hypit/protocol";
-import type { StudioObservedValue, StudioPlacement, StudioScriptSourceMap } from "@hypit/studio-adapter";
+import type { StudioObservedValue, StudioPlacement, StudioTemporalDomainSourceMap } from "@hypit/studio-adapter";
import type { Range } from "./shared.js";
import type { StudioCompanionRegistry } from "./studio-registry.js";
@@ -24,7 +24,7 @@ export type Placement = StudioPlacement;
export type Observations = {
readonly placements: readonly Placement[];
/** Whatever the Surfaces mapped back onto the Source, such as a Script's markers. */
- readonly sourceMaps: readonly StudioScriptSourceMap[];
+ readonly temporalDomains: readonly StudioTemporalDomainSourceMap[];
};
export type Observer = {
@@ -71,7 +71,7 @@ export function createObserver(
registry: StudioCompanionRegistry,
): Observer {
const placements: Placement[] = [];
- const sourceMaps: StudioScriptSourceMap[] = [];
+ const temporalDomains: StudioTemporalDomainSourceMap[] = [];
// A Frontend may reach a Surface by name or by walking a module's whole list,
// so both ways in are wrapped: an unwatched Surface decodes silently and the
@@ -90,11 +90,12 @@ export function createObserver(
&& Number.isInteger((output as { readonly nextOffset?: unknown }).nextOffset)
? (output as { readonly nextOffset: number }).nextOffset
: undefined;
- const sourceMap = registry.observeScript(module, found.surface, {
+ const sourceMap = registry.observeTemporalDomain(module, found.surface, {
...input,
+ range: { start: input.openingStart, end: nextOffset ?? input.contentStart },
...(nextOffset === undefined ? {} : { nextOffset }),
});
- if (sourceMap !== undefined) sourceMaps.push(sourceMap);
+ if (sourceMap !== undefined) temporalDomains.push(sourceMap);
return output;
},
} as RegisteredSurface;
@@ -159,6 +160,13 @@ export function createObserver(
};
}),
});
+ const sourceMap = registry.observeTemporalDomain(module, found.surface, {
+ sourceName: input.sourceName,
+ tag: input.element.name,
+ range: { start: input.element.range.start, end: input.element.range.end },
+ attributes: input.element.attributes,
+ });
+ if (sourceMap !== undefined) temporalDomains.push(sourceMap);
return output;
},
} as RegisteredSurface;
@@ -174,7 +182,7 @@ export function createObserver(
return {
surfaces: watchedSurfaces,
frontend<T extends { readonly id: string }>(frontend: T): T { return frontend; },
- observations: () => ({ placements, sourceMaps }),
+ observations: () => ({ placements, temporalDomains }),
};
}
diff --git a/packages/studio/src/parameters.ts b/packages/studio/src/parameters.ts
index f3830230..b7c260e7 100644
--- a/packages/studio/src/parameters.ts
+++ b/packages/studio/src/parameters.ts
@@ -10,7 +10,7 @@ import type {
StudioEditSource,
StudioPlacement,
StudioEditHandle,
- StudioSemanticTimeline,
+ StudioTemporalDomainView,
StudioTemporalInstantProjection,
StudioTemporalLineage,
StudioTimelineGesture,
@@ -19,6 +19,7 @@ import { parseSvs } from "@hypit/svs";
import { parseOpeningTag } from "@hypit/markup";
import { prepareAuthorSource } from "@hypit/elaborator";
import { parameterControlForSchema, parameterRecordSchema } from "./parameter-values.js";
+import { sameType } from "@hypit/protocol";
import type { CanonicalValue } from "@hypit/protocol";
import type { StudioCompanionRegistry } from "./studio-registry.js";
@@ -517,7 +518,7 @@ export function temporalBindingDeclarations(
export function resolveTimelineEditHandles(
bindings: readonly StudioSourceBinding[],
temporal?: StudioTemporalLineage,
- semantic?: StudioSemanticTimeline,
+ domains: readonly StudioTemporalDomainView[] = [],
): readonly StudioEditHandle[] {
const byName = new Map<string, StudioSourceBinding>();
for (const binding of bindings) {
@@ -538,38 +539,31 @@ export function resolveTimelineEditHandles(
if (temporal === undefined) return [];
const projection = temporal.projection;
- const semanticTarget = (endpoints: readonly StudioTemporalInstantProjection[]) => {
+ const domainTarget = (endpoints: readonly StudioTemporalInstantProjection[]) => {
const sources = endpoints.flatMap((endpoint) => endpoint.authority.kind === "domain"
? [endpoint.authority.source]
: []);
const first = sources[0];
- if (first === undefined || first.narrativeId === undefined
- || first.timelineId !== semantic?.timelineId
- || first.narrativeId !== semantic.narrativeId
+ if (first === undefined || first.domain === undefined
|| !sources.every((candidate) => candidate.kind === first.kind
&& candidate.id === first.id
&& candidate.timelineId === first.timelineId
- && candidate.narrativeId === first.narrativeId)) return undefined;
- if (first.kind === "selection") {
- const selection = semantic?.selections.find((candidate) => candidate.id === first.id);
- return selection === undefined ? undefined : {
- kind: "selection" as const,
- narrativeId: first.narrativeId,
- id: selection.id,
- startAnchorId: selection.startAnchorId,
- endAnchorId: selection.endAnchorId,
- };
- }
- if (first.kind === "moment") {
- const moment = semantic?.moments.find((candidate) => candidate.id === first.id);
- return moment === undefined ? undefined : {
- kind: "moment" as const,
- narrativeId: first.narrativeId,
- id: moment.id,
- anchorId: moment.anchorId,
- };
- }
- return undefined;
+ && candidate.domain?.companion === first.domain?.companion
+ && candidate.domain?.id === first.domain?.id)) return undefined;
+ const view = domains.find((candidate) => candidate.timelineId === first.timelineId
+ && candidate.companion === first.domain!.companion && candidate.id === first.domain!.id);
+ const item = view?.items.find((candidate) => candidate.editable === true
+ && candidate.source !== undefined
+ && sameType(candidate.source.type, first.type)
+ && candidate.source.kind === first.kind && candidate.source.id === first.id);
+ if (view === undefined || item === undefined) return undefined;
+ return item.kind === "span" ? {
+ kind: "span" as const, companion: view.companion, domainId: view.id, itemId: item.id,
+ startAnchorId: item.startAnchorId, endAnchorId: item.endAnchorId,
+ } : {
+ kind: "point" as const, companion: view.companion, domainId: view.id, itemId: item.id,
+ anchorId: item.anchorId,
+ };
};
const handle = (
@@ -596,10 +590,10 @@ export function resolveTimelineEditHandles(
if (missing !== undefined && "missing" in missing) {
return disabled(gesture, `投影参数 ${missing.missing} 在当前作者源码中不可写。`);
}
- const semanticEndpoints = affected.filter(({ endpoint }) => endpoint.authority.kind === "domain").map(({ endpoint }) => endpoint);
- const target = semanticTarget(semanticEndpoints);
- if (semanticEndpoints.length > 0 && target === undefined) {
- return disabled(gesture, "语义端点在当前 Candidate 中没有可写的作者身份。");
+ const domainEndpoints = affected.filter(({ endpoint }) => endpoint.authority.kind === "domain").map(({ endpoint }) => endpoint);
+ const target = domainTarget(domainEndpoints);
+ if (domainEndpoints.length > 0 && target === undefined) {
+ return disabled(gesture, "时间域端点在当前 Candidate 中没有可写的作者身份。");
}
const sources = projected.filter((item): item is StudioEditSource => "source" in item);
return {
@@ -607,11 +601,11 @@ export function resolveTimelineEditHandles(
operation: "timeline.adjust",
gesture,
enabled: true,
- coordinate: target === undefined ? "program-frame" : "semantic-anchor",
+ coordinate: target === undefined ? "program-frame" : "domain-anchor",
...(moveEffect === undefined ? {} : { moveEffect }),
- snapTo: target === undefined ? ["frame", "semantic-anchor", "item-edge"] : ["semantic-anchor"],
+ snapTo: target === undefined ? ["frame", "domain-anchor", "item-edge"] : ["domain-anchor"],
...(sources.length === 0 ? {} : { sources }),
- ...(target === undefined ? {} : { semantic: target }),
+ ...(target === undefined ? {} : { domain: target }),
temporal: projection,
};
};
diff --git a/packages/studio/src/programme.ts b/packages/studio/src/programme.ts
index 21b646c1..c2d8608c 100644
--- a/packages/studio/src/programme.ts
+++ b/packages/studio/src/programme.ts
@@ -5,9 +5,7 @@ import type { Composition } from "@hypit/composition";
import { compositionTypes } from "@hypit/composition";
import { timelineTypes, assertTimelineIdentity } from "@hypit/timeline";
import type { Timeline } from "@hypit/timeline";
-import { narrativeTemporalTypes } from "@hypit/narrative-temporal";
-import type { NarrativeProjection } from "@hypit/narrative-temporal";
-import type { StudioResolvedTrack, StudioTemporalBinding } from "@hypit/studio-adapter";
+import type { StudioObservedValue, StudioResolvedTrack, StudioTemporalBinding } from "@hypit/studio-adapter";
import type { RuntimeHostTransientExecution } from "@hypit/runtime-host-node";
import type { CompiledSource, ServedFile } from "./compile.js";
@@ -17,6 +15,7 @@ import type { RunPlan } from "./run.js";
import type { StudioViewRequirement } from "./studio-preflight.js";
import { studioSurfacePreview } from "./surface-preview.js";
import { executedTemporalBindings } from "./temporal-graph.js";
+import type { StudioCompanionRegistry } from "./studio-registry.js";
function playable(type: import("@hypit/protocol").TypeRef): boolean {
return sameType(type, compositionTypes.visualTrack) || sameType(type, compositionTypes.audioTrack);
@@ -29,9 +28,9 @@ export type Preview = {
readonly tracks: readonly BuiltTrack[];
/** Resolved Companion realizations keyed by exact graph output ref. */
readonly values: ReadonlyMap<string, unknown>;
+ readonly temporalDomainValues: readonly StudioObservedValue[];
readonly temporalBindings: ReadonlyMap<string, readonly StudioTemporalBinding[]>;
readonly composition: Composition;
- readonly narrativeId?: string;
readonly timingOutput?: { readonly name: string; readonly ref: string };
readonly timingCandidateId?: string;
readonly timingCandidateOrigin: "run" | "source" | "none";
@@ -39,12 +38,6 @@ export type Preview = {
readonly canvas: { readonly width: number; readonly height: number; readonly clearColor: string };
readonly frameRate: { readonly numerator: number; readonly denominator: number };
readonly timeline: Timeline;
- readonly anchors: ReadonlyMap<string, number>;
- readonly tokens: readonly {
- readonly id: string;
- readonly startAnchorId: string;
- readonly endAnchorId: string;
- }[];
};
async function bytesOf(attachment: ArtifactAttachment): Promise<Uint8Array> {
@@ -101,6 +94,7 @@ function compositionArtifacts(composition: Composition): readonly BlobRef[] {
/** Build only the Studio-approved deterministic projection of one explicit Run. */
export async function preview(input: {
readonly source: CompiledSource;
+ readonly registry: StudioCompanionRegistry;
readonly run: RunPlan;
readonly domain: StudioDomain;
readonly outputRefs: readonly string[];
@@ -167,7 +161,7 @@ export async function preview(input: {
const timingType = timingOutput?.typeRef ?? timingRecord?.type;
const timingValue = selectedValue(executed.state, input.timeRef);
if (timingValue?.kind !== "inline" || timingType === undefined) throw new Error("Studio requires a resolved film time source.");
- if (!sameType(timingType, timelineTypes.track)) throw new Error("Studio requires the declared Timeline.");
+ if (!sameType(timingType, timelineTypes.timeline)) throw new Error("Studio requires the declared Timeline.");
const timeline = timingValue.value as unknown as Timeline;
assertTimelineIdentity(timeline);
const rate = timeline.frameRate;
@@ -211,7 +205,7 @@ export async function preview(input: {
});
const temporalBindings = new Map(tracks.map((track) => [
track.outputRef,
- executedTemporalBindings(executed.state, track.outputRef),
+ executedTemporalBindings(executed.state, track.outputRef, (type, value) => input.registry.identifyTemporalSource(type, value)),
] as const));
const values = new Map<string, unknown>();
for (const target of targets) {
@@ -227,33 +221,23 @@ export async function preview(input: {
values.set(record.id, record.value.value);
}
}
- const narrativeProjections = input.projections.flatMap((view) => view.trace.references
- .filter((reference) => sameType(reference.typeRef, narrativeTemporalTypes.narrativeProjection))
- .flatMap((reference) => {
- const stored = selectedValue(executed.state, reference.ref);
- return stored?.kind === "inline" ? [stored.value as unknown as NarrativeProjection] : [];
- }));
- const anchors = new Map<string, number>();
- const tokens: Preview["tokens"][number][] = [];
- const narrativeIds = new Set<string>();
- for (const projection of narrativeProjections) {
- if (projection.timelineId !== timeline.id) continue;
- narrativeIds.add(projection.narrativeId);
- for (const boundary of projection.boundaries) anchors.set(boundary.id, boundary.frame);
- tokens.push(...projection.tokens.map((token) => ({
- id: token.tokenId,
- startAnchorId: token.startBoundaryId,
- endAnchorId: token.endBoundaryId,
- })));
+ const temporalValueTypes = input.registry.temporalDomainValueTypes();
+ const temporalDomainValues: StudioObservedValue[] = [];
+ for (const record of [...executed.state.program.records, ...executed.state.records]) {
+ if (!temporalValueTypes.some((type) => sameType(type, record.type)) || record.value.kind !== "inline") continue;
+ values.set(record.id, record.value.value);
+ if (!temporalDomainValues.some((item) => item.id === record.id)) {
+ temporalDomainValues.push({ id: record.id, type: record.type, value: record.value.value });
+ }
}
const timingCandidateId = satisfactions.get(input.timeRef);
return {
source: input.source,
tracks,
values,
+ temporalDomainValues,
temporalBindings,
composition,
- ...(narrativeIds.size === 1 ? { narrativeId: [...narrativeIds][0] } : {}),
timingOutput: { name: timingOutput?.name ?? timeline.id, ref: input.timeRef },
...(timingCandidateId === undefined ? {} : { timingCandidateId }),
timingCandidateOrigin: timingCandidateId === undefined ? "source" : "run",
@@ -261,7 +245,5 @@ export async function preview(input: {
canvas: composition.canvas,
frameRate: rate,
timeline,
- anchors,
- tokens,
};
}
diff --git a/packages/studio/src/server.ts b/packages/studio/src/server.ts
index ac8e48db..ab850187 100644
--- a/packages/studio/src/server.ts
+++ b/packages/studio/src/server.ts
@@ -9,6 +9,7 @@ import { pipeline } from "node:stream/promises";
import type { Plugin, ViteDevServer } from "vite";
import type { BuildResultFileRange } from "@hypit/build-result";
import type { StudioTemporalInstantProjection } from "@hypit/studio-adapter";
+import { sameType } from "@hypit/protocol";
import type { StudioBuildLibrary } from "./build-library.js";
import type { ServedFile } from "./compile.js";
@@ -22,7 +23,7 @@ import type { Range, StudioFailure, StudioLibraryRequest, StudioLibraryView, Stu
import { createStudioStoryboard } from "./storyboard.js";
import type { StudioStoryboard } from "./storyboard.js";
import { findSurfacePreview } from "./surface-preview.js";
-import { formatTemporalPointEdit, semanticGestureSpan } from "./temporal-edit.js";
+import { formatTemporalPointEdit, domainGestureSpan } from "./temporal-edit.js";
import { replaceSourceFiles } from "./source-transaction.js";
export type StudioPluginOptions = {
@@ -278,7 +279,7 @@ export function studioPlugin(options: StudioPluginOptions): Plugin {
throw new Error("A timeline target must use valid whole frames.");
}
if (temporal.kind === "window") {
- if (mutation.gesture === "move" && handle.semantic?.kind !== "selection"
+ if (mutation.gesture === "move" && handle.domain?.kind !== "span"
&& endFrameExclusive - startFrame !== clip.endFrameExclusive - clip.startFrame) {
throw new Error("Move must preserve the Window duration.");
}
@@ -293,62 +294,62 @@ export function studioPlugin(options: StudioPluginOptions): Plugin {
}
const patches: Patch[] = [];
- const semanticTarget = mutation.target.semantic;
- if (handle.semantic !== undefined && semanticTarget === undefined) throw new Error("A semantic edit requires explicit target anchors.");
- if (semanticTarget !== undefined) {
- if (handle.semantic?.kind !== semanticTarget.kind) {
- throw new Error(`Entity ${mutation.entityId} is not bound to a writable ${semanticTarget.kind}.`);
+ const domainTarget = mutation.target.domain;
+ if (handle.domain !== undefined && domainTarget === undefined) throw new Error("A temporal-domain edit requires explicit target anchors.");
+ if (domainTarget !== undefined) {
+ if (handle.domain?.kind !== domainTarget.kind
+ || handle.domain.companion !== domainTarget.companion
+ || handle.domain.domainId !== domainTarget.domainId
+ || handle.domain.itemId !== domainTarget.itemId) {
+ throw new Error(`Entity ${mutation.entityId} is not bound to the requested temporal-domain item.`);
}
const current = snapshot;
- const script = current?.script;
- if (current === undefined || script === undefined || current.semantic === undefined) throw new Error("Studio has no writable Script source map.");
- if (handle.semantic.narrativeId !== current.semantic.narrativeId
- || script.narrativeId !== current.semantic.narrativeId) {
- throw new Error("The timeline entity and writable Script do not belong to the selected Narrative.");
- }
- const projected = semanticGestureSpan(current.semantic.anchors, handle, semanticTarget);
+ const domain = current?.temporalDomains.find((candidate) => candidate.companion === domainTarget.companion
+ && candidate.id === domainTarget.domainId);
+ if (current === undefined || domain === undefined) throw new Error("Studio has no writable temporal-domain source.");
+ const projected = domainGestureSpan(domain.anchors, handle, domainTarget);
if (projected === undefined || projected.startFrame !== startFrame || projected.endFrameExclusive !== endFrameExclusive) {
- throw new Error("The semantic edit does not produce the requested timeline projection.");
+ throw new Error("The temporal-domain edit does not produce the requested timeline projection.");
}
- const absolute = resolve(options.workspaceRoot, script.sourcePath);
+ const absolute = resolve(options.workspaceRoot, domain.source.path);
const source = await readFile(absolute, "utf8");
- if (script.content.start < 0 || script.content.end < script.content.start || script.content.end > source.length) {
- throw new Error("The current Script source range is invalid.");
+ if (domain.source.content.start < 0 || domain.source.content.end < domain.source.content.start || domain.source.content.end > source.length) {
+ throw new Error("The current temporal-domain source range is invalid.");
}
- const body = source.slice(script.content.start, script.content.end);
- const replacement = options.registry.adjustScript({
- companion: script.companion,
- sourceName: script.sourcePath,
+ const body = source.slice(domain.source.content.start, domain.source.content.end);
+ const replacement = options.registry.adjustTemporalDomain({
+ companion: domain.companion,
+ sourceName: domain.source.path,
source: body,
- adjustment: semanticTarget.kind === "selection"
+ adjustment: domainTarget.kind === "span"
? {
- kind: "selection",
- id: handle.semantic.id,
- startAnchorId: semanticTarget.startAnchorId,
- endAnchorId: semanticTarget.endAnchorId,
+ kind: "span",
+ itemId: domainTarget.itemId,
+ startAnchorId: domainTarget.startAnchorId,
+ endAnchorId: domainTarget.endAnchorId,
}
- : { kind: "moment", id: handle.semantic.id, anchorId: semanticTarget.anchorId },
+ : { kind: "point", itemId: domainTarget.itemId, anchorId: domainTarget.anchorId },
});
if (replacement !== body) patches.push({
- path: relative(options.workspaceRoot, absolute), range: script.content, replacement, preimage: body,
+ path: relative(options.workspaceRoot, absolute), range: domain.source.content, replacement, preimage: body,
});
}
const source = (role: "start" | "end" | "duration") =>
handle.sources?.find((candidate) => candidate.role === role)?.source;
const frame = (value: number): string => `${value}f`;
- const semanticFrame = (endpoint: StudioTemporalInstantProjection): number | undefined => {
- if (endpoint.authority.kind !== "domain" || semanticTarget === undefined || handle.semantic === undefined) return undefined;
- if (endpoint.source.kind === "selection" && semanticTarget.kind === "selection"
- && endpoint.source.id === handle.semantic.id) {
+ const domainFrame = (endpoint: StudioTemporalInstantProjection): number | undefined => {
+ if (endpoint.authority.kind !== "domain" || domainTarget === undefined || handle.domain === undefined) return undefined;
+ const domain = snapshot?.temporalDomains.find((candidate) => candidate.companion === domainTarget.companion
+ && candidate.id === domainTarget.domainId);
+ if (domainTarget.kind === "span" && handle.domain.kind === "span") {
const anchorId = endpoint.authority.boundary === "start"
- ? semanticTarget.startAnchorId
- : semanticTarget.endAnchorId;
- return snapshot?.semantic?.anchors.find((anchor) => anchor.id === anchorId)?.frame;
+ ? domainTarget.startAnchorId
+ : domainTarget.endAnchorId;
+ return domain?.anchors.find((anchor) => anchor.id === anchorId)?.frame;
}
- if (endpoint.source.kind === "moment" && semanticTarget.kind === "moment"
- && endpoint.source.id === handle.semantic.id) {
- return snapshot?.semantic?.anchors.find((anchor) => anchor.id === semanticTarget.anchorId)?.frame;
+ if (domainTarget.kind === "point" && handle.domain.kind === "point") {
+ return domain?.anchors.find((anchor) => anchor.id === domainTarget.anchorId)?.frame;
}
return undefined;
};
@@ -356,17 +357,16 @@ export function studioPlugin(options: StudioPluginOptions): Plugin {
if (endpoint.reference === "absolute") return undefined;
if (endpoint.reference === "timeline.start") return 0;
if (endpoint.reference === "timeline.end") return snapshot?.timeline.frameCount;
- const id = endpoint.source.id;
- if (id === undefined) return undefined;
- if (endpoint.reference === "selection.start" || endpoint.reference === "selection.end") {
- const selection = snapshot?.semantic?.selections.find((candidate) => candidate.id === id);
- return endpoint.reference === "selection.start" ? selection?.startFrame : selection?.endFrameExclusive;
- }
- if (endpoint.reference === "segment.start" || endpoint.reference === "segment.end") {
- const segment = snapshot?.semantic?.segments.find((candidate) => candidate.id === id);
- return endpoint.reference === "segment.start" ? segment?.startFrame : segment?.endFrameExclusive;
- }
- return snapshot?.semantic?.moments.find((candidate) => candidate.id === id)?.frame;
+ const domain = endpoint.source.domain;
+ const view = domain === undefined ? undefined : snapshot?.temporalDomains.find((candidate) =>
+ candidate.companion === domain.companion && candidate.id === domain.id);
+ const item = view?.items.find((candidate) => candidate.source !== undefined
+ && sameType(candidate.source.type, endpoint.source.type)
+ && candidate.source.kind === endpoint.source.kind && candidate.source.id === endpoint.source.id);
+ if (item === undefined) return undefined;
+ if (item.kind === "point") return item.frame;
+ return endpoint.authority.kind === "domain" && endpoint.authority.boundary === "start"
+ ? item.startFrame : item.endFrameExclusive;
};
const projectedPointValue = (endpoint: StudioTemporalInstantProjection, desired: number): string =>
formatTemporalPointEdit(endpoint.reference, desired, projectionBaseFrame(endpoint));
@@ -378,7 +378,7 @@ export function studioPlugin(options: StudioPluginOptions): Plugin {
if (desired === endpoint.frame) return;
if (endpoint.authority.kind === "fixed") throw new Error(`The ${role} endpoint has no timeline write target.`);
if (endpoint.authority.kind === "domain") {
- if (semanticFrame(endpoint) !== desired) throw new Error(`The ${role} endpoint does not match its semantic Anchor.`);
+ if (domainFrame(endpoint) !== desired) throw new Error(`The ${role} endpoint does not match its temporal-domain Anchor.`);
return;
}
if (endpoint.authority.relation !== "direct") return;
diff --git a/packages/studio/src/session.ts b/packages/studio/src/session.ts
index 690ebe02..cb8286e6 100644
--- a/packages/studio/src/session.ts
+++ b/packages/studio/src/session.ts
@@ -71,6 +71,7 @@ export async function readStudioSession(input: {
];
const built = await preview({
source,
+ registry: input.registry,
run: input.run,
domain: input.domain,
outputRefs,
diff --git a/packages/studio/src/shared.ts b/packages/studio/src/shared.ts
index 66389be1..041f34b2 100644
--- a/packages/studio/src/shared.ts
+++ b/packages/studio/src/shared.ts
@@ -13,10 +13,9 @@ import type {
StudioMaterialPreview,
StudioInspectorField,
StudioInspectorDomain,
- StudioSemanticAnchor,
- StudioSemanticSegment,
- StudioSemanticTimeline,
- StudioSemanticToken,
+ StudioTemporalDomainAnchor,
+ StudioTemporalDomainItem,
+ StudioTemporalDomainView,
StudioTemporalLineage,
StudioTemporalPhase,
StudioTemporalProjection,
@@ -128,56 +127,9 @@ export type Track = {
readonly provenance: CandidateProvenance;
};
-export type ScriptMap = {
- readonly companion: string;
- readonly narrativeId: string;
- readonly sourcePath: string;
- readonly range: Range;
- readonly content: Range;
- readonly selections: readonly {
- readonly id: string;
- readonly startAnchorId: string;
- readonly endAnchorId: string;
- /** How many Selections enclose this one. Nesting is what depth means. */
- readonly depth: number;
- readonly open: Range;
- readonly close: Range;
- }[];
- readonly segments: readonly {
- readonly id: string;
- /** Always 0: a Segment is the outermost range the Script declares. */
- readonly depth: number;
- readonly range: Range;
- }[];
- readonly moments: readonly {
- readonly id: string;
- readonly anchorId: string;
- readonly range: Range;
- }[];
- /** Spoken words placed on the timeline by the selected semantic Candidate. */
- readonly tokens: readonly {
- readonly id: string;
- readonly range: Range;
- readonly startFrame: number;
- readonly endFrame: number;
- }[];
-};
-
-/** A semantic boundary that can be addressed by the timeline without guessing. */
-export type SemanticAnchorKind =
- | "segment-start"
- | "segment-end"
- | "token-start"
- | "token-end";
-
-export type SemanticAnchor = StudioSemanticAnchor;
-
-export type SemanticSegment = StudioSemanticSegment;
-
-export type SemanticToken = StudioSemanticToken;
-
-/** The semantic timebase projected from the compiled Narrative and its anchors. */
-export type SemanticTimeline = StudioSemanticTimeline;
+export type TemporalDomainAnchor = StudioTemporalDomainAnchor;
+export type TemporalDomainItem = StudioTemporalDomainItem;
+export type TemporalDomainView = StudioTemporalDomainView;
export type StudioSourceView = {
/** Workspace-relative path. It is also the exact source write target. */
@@ -267,7 +219,6 @@ export type StudioSnapshot = {
readonly targets: readonly string[];
readonly satisfactions: readonly { readonly output: string; readonly candidate: string }[];
};
- readonly script?: ScriptMap;
/** The resolved picture plane. It is a preview snapshot, not another authored Canvas. */
readonly canvas: {
readonly width: number;
@@ -281,11 +232,8 @@ export type StudioSnapshot = {
readonly durationSec: number;
};
readonly tracks: readonly Track[];
- /**
- * The special Studio lane. This is not another VisualTrack: it is the
- * Narrative's segment/word geometry projected onto the same frame domain.
- */
- readonly semantic?: SemanticTimeline;
+ /** Package-contributed temporal views projected onto the same absolute ruler. */
+ readonly temporalDomains: readonly TemporalDomainView[];
/** The Tracks, compiled into the document the renderer photographs. */
readonly preview: { readonly kind: "hyperframes"; readonly srcdoc: string };
readonly provenance: {
@@ -306,17 +254,13 @@ export type StudioMutation =
| {
readonly kind: "instant";
readonly frame: number;
- readonly semantic?:
- | { readonly kind: "selection"; readonly startAnchorId: string; readonly endAnchorId: string }
- | { readonly kind: "moment"; readonly anchorId: string };
+ readonly domain?: import("@hypit/studio-adapter").StudioTemporalDomainEditTarget;
}
| {
readonly kind: "window";
readonly startFrame: number;
readonly endFrameExclusive: number;
- readonly semantic?:
- | { readonly kind: "selection"; readonly startAnchorId: string; readonly endAnchorId: string }
- | { readonly kind: "moment"; readonly anchorId: string };
+ readonly domain?: import("@hypit/studio-adapter").StudioTemporalDomainEditTarget;
};
}
| {
diff --git a/packages/studio/src/snapshot.ts b/packages/studio/src/snapshot.ts
index 5054efe2..05e8f0a5 100644
--- a/packages/studio/src/snapshot.ts
+++ b/packages/studio/src/snapshot.ts
@@ -17,8 +17,7 @@ import type {
Clip,
StudioSnapshot,
Range,
- ScriptMap,
- SemanticTimeline,
+ TemporalDomainView,
Track,
} from "./shared.js";
import type { Placement } from "./observe.js";
@@ -94,65 +93,11 @@ function authored(placements: readonly Placement[]): readonly Located[] {
return found;
}
-function scriptMap(
- maps: Preview["source"]["observations"]["sourceMaps"],
- built: Preview,
- narrativeId: string,
-): ScriptMap | undefined {
- const candidates = maps.filter((map, index) => map.narrativeId === narrativeId
- && maps.findIndex((other) => other.narrativeId === map.narrativeId
- && other.sourcePath === map.sourcePath
- && other.range.start === map.range.start
- && other.range.end === map.range.end) === index);
- if (candidates.length > 1) {
- throw new Error(`Studio Narrative id ${narrativeId} is declared by more than one Script in the Source closure.`);
- }
- const found = candidates[0];
- if (found === undefined) return undefined;
- const selections = found.selections;
- const segments = found.segments;
- const moments = found.moments;
- return {
- companion: found.companion,
- narrativeId: found.narrativeId,
- sourcePath: found.sourcePath,
- range: found.range,
- content: found.content,
- // A Segment is the outermost range a Script declares; a Selection written
- // inside one is a level down, and one inside that another.
- segments: segments.map((segment) => ({ ...segment, depth: 0 })),
- selections: selections.map((selection) => ({
- ...selection,
- depth: depthOf(selection, selections),
- })),
- moments,
- // A Script says where a word is written; the timings say when it is said.
- tokens: found.tokens.flatMap((token) => {
- const placed = built.tokens.find((item) => item.id === token.id);
- const startFrame = placed === undefined ? undefined : built.anchors.get(placed.startAnchorId);
- const endFrame = placed === undefined ? undefined : built.anchors.get(placed.endAnchorId);
- if (startFrame === undefined || endFrame === undefined) return [];
- return [{ id: token.id, range: token.range, startFrame, endFrame }];
- }),
- };
-}
-
-/**
- * Project the compiled Narrative into the frame domain that the preview is
- * already using. No frontend timing is invented here: if an anchor is absent
- * from the built Timeline, the corresponding item is simply not drawable yet.
- */
-function semanticTimeline(
+/** Package Companions project their own temporal facts onto Studio's absolute ruler. */
+function temporalDomains(
registry: StudioCompanionRegistry,
built: Preview,
- script: ScriptMap | undefined,
-): SemanticTimeline | undefined {
- if (built.narrativeId === undefined) return undefined;
- if (script === undefined) throw new Error("Timeline's Script has no Studio source mapping.");
- const projected = registry.projectScript({ source: script, anchors: built.anchors,
- values: built.source.compiled.program.records.flatMap(record => record.value.kind === "inline"
- ? [{ id: record.id, type: record.type, value: record.value.value }] : []),
- });
+): readonly TemporalDomainView[] {
const provenance: CandidateProvenance = {
output: built.timingOutput?.name ?? "Timeline",
...(built.timingOutput?.ref === undefined ? {} : { outputRef: built.timingOutput.ref }),
@@ -161,28 +106,13 @@ function semanticTimeline(
status: "resolved",
errors: [],
};
- return {
- timelineId: built.timeline.id,
- narrativeId: built.narrativeId,
- // The generic ruler presentation is independent of the authored Timeline id.
- presentation: registry.semanticTimelinePresentation(),
- // Preserve the Companion's ordered anchors, including coincident boundaries.
- ...projected,
- provenance,
- };
-}
-
-/** The element an output belongs to: `take-opening.video` is `take-opening`. */
-function depthOf(
- selection: Omit<ScriptMap["selections"][number], "depth">,
- all: readonly Omit<ScriptMap["selections"][number], "depth">[],
-): number {
- let depth = 1;
- for (const other of all) {
- if (other.id === selection.id) continue;
- if (other.open.start < selection.open.start && other.close.end > selection.close.end) depth += 1;
- }
- return depth;
+ return built.source.observations.temporalDomains.flatMap((source) => {
+ const projected = registry.projectTemporalDomain({ source, values: built.temporalDomainValues, timeline: built.timeline });
+ if (projected === undefined || projected.timelineId !== built.timeline.id) return [];
+ return [{ ...projected, companion: source.companion,
+ presentation: registry.temporalDomainPresentation(source.companion), provenance,
+ source: { path: source.sourcePath, content: source.content } }];
+ });
}
export function snapshot(registry: StudioCompanionRegistry, built: Preview, input: {
@@ -198,8 +128,7 @@ export function snapshot(registry: StudioCompanionRegistry, built: Preview, inpu
readonly surfaces: MarkupSurfaceRegistryLike;
}): StudioSnapshot {
const located = authored(built.source.observations.placements);
- const script = built.narrativeId === undefined ? undefined : scriptMap(built.source.observations.sourceMaps, built, built.narrativeId);
- const semantic = semanticTimeline(registry, built, script);
+ const domains = temporalDomains(registry, built);
const tracks: Track[] = [];
for (const item of built.tracks) {
const projectedSpans = spans(item.value, input.frameRate);
@@ -230,7 +159,7 @@ export function snapshot(registry: StudioCompanionRegistry, built: Preview, inpu
spans: projectedSpans,
values: built.values,
temporalBindings: built.temporalBindings.get(item.outputRef) ?? [],
- semantic,
+ temporalDomains: domains,
generic,
}).map((draft) => {
const declarations = composeParameterDeclarations({
@@ -257,7 +186,7 @@ export function snapshot(registry: StudioCompanionRegistry, built: Preview, inpu
const editHandles = resolveTimelineEditHandles(
bindings,
draft.temporal,
- semantic,
+ domains,
);
return {
draft,
@@ -319,7 +248,6 @@ export function snapshot(registry: StudioCompanionRegistry, built: Preview, inpu
})),
},
run: input.run,
- ...(script === undefined ? {} : { script }),
canvas: {
width: input.canvas.width,
height: input.canvas.height,
@@ -331,7 +259,7 @@ export function snapshot(registry: StudioCompanionRegistry, built: Preview, inpu
durationSec: frameCount * input.frameRate.denominator / input.frameRate.numerator,
},
tracks: rows,
- ...(semantic === undefined ? {} : { semantic }),
+ temporalDomains: domains,
preview: input.preview,
provenance: {
picture: "resolved",
diff --git a/packages/studio/src/studio-preflight.ts b/packages/studio/src/studio-preflight.ts
index 81220650..80c53413 100644
--- a/packages/studio/src/studio-preflight.ts
+++ b/packages/studio/src/studio-preflight.ts
@@ -137,7 +137,7 @@ export function inspectStudioRun(
});
const timeOutput = times[0];
if (times.length !== 1) issues.push("Film requires one traceable time source.");
- const semanticOutput = timeOutput !== undefined && sameType(timeOutput.typeRef, timelineTypes.track) ? timeOutput : undefined;
+ const semanticOutput = timeOutput !== undefined && sameType(timeOutput.typeRef, timelineTypes.timeline) ? timeOutput : undefined;
let companionValueRefs: readonly string[] = [];
try {
companionValueRefs = unique(filmTrackRefs.flatMap((ref) =>
@@ -149,7 +149,7 @@ export function inspectStudioRun(
const projectionRefs = unique([
...filmTrackRefs,
- ...(semanticOutput !== undefined && sameType(semanticOutput.typeRef, timelineTypes.track) ? [semanticOutput.ref] : []),
+ ...(semanticOutput !== undefined && sameType(semanticOutput.typeRef, timelineTypes.timeline) ? [semanticOutput.ref] : []),
...companionValueRefs,
]);
const projections: StudioViewRequirement[] = [];
diff --git a/packages/studio/src/studio-registry.ts b/packages/studio/src/studio-registry.ts
index d554a85b..54ab8e79 100644
--- a/packages/studio/src/studio-registry.ts
+++ b/packages/studio/src/studio-registry.ts
@@ -8,10 +8,10 @@ import type {
StudioLaneAttachment,
StudioViewRole,
StudioResolvedTrack,
- StudioScriptAdjustment,
- StudioScriptProjectionInput,
- StudioScriptCompanion,
- StudioScriptSourceMap,
+ StudioTemporalDomainAdjustment,
+ StudioTemporalDomainProjectionInput,
+ StudioTemporalDomainCompanion,
+ StudioTemporalDomainSourceMap,
StudioSourceBindingDeclaration,
StudioSpan,
} from "@hypit/studio-adapter";
@@ -20,7 +20,6 @@ import { parameterOption } from "./parameter-values.js";
import { compositionTypes } from "@hypit/composition";
import { sameModule, sameType } from "@hypit/protocol";
import type { ModuleRef, TypeRef } from "@hypit/protocol";
-import { timelineTypes } from "@hypit/timeline";
import type { Placement } from "./observe.js";
import type { Clip, StudioTrackBinding } from "./shared.js";
@@ -188,13 +187,13 @@ export class StudioCompanionRegistry {
readonly #parameters: readonly StudioParameterCompanion[];
readonly #tracks: readonly StudioTrackCompanion[];
readonly #films: readonly StudioFilmCompanion[];
- readonly #scripts: readonly StudioScriptCompanion[];
+ readonly #temporalDomains: readonly StudioTemporalDomainCompanion[];
constructor(
tracks: readonly StudioTrackCompanion[],
options: {
readonly films?: readonly StudioFilmCompanion[];
- readonly scripts?: readonly StudioScriptCompanion[];
+ readonly temporalDomains?: readonly StudioTemporalDomainCompanion[];
readonly parameters?: readonly StudioParameterCompanion[];
} = {},
) {
@@ -205,8 +204,8 @@ export class StudioCompanionRegistry {
validateCompanionVocabulary(companion);
}
const films = [...(options.films ?? [])];
- const scripts = [...(options.scripts ?? [])];
- for (const [label, companions] of [["Film", films], ["Script", scripts]] as const) {
+ const temporalDomains = [...(options.temporalDomains ?? [])];
+ for (const [label, companions] of [["Film", films], ["Temporal Domain", temporalDomains]] as const) {
const companionIds = new Set<string>();
for (const companion of companions) {
if (companionIds.has(companion.id) || ids.has(companion.id)) {
@@ -224,7 +223,7 @@ export class StudioCompanionRegistry {
}
this.#tracks = Object.freeze([...tracks]);
this.#films = Object.freeze(films);
- this.#scripts = Object.freeze(scripts);
+ this.#temporalDomains = Object.freeze(temporalDomains);
}
parameterCompanionFor(module: ModuleRef, surface: string): StudioParameterCompanion | undefined {
@@ -246,42 +245,62 @@ export class StudioCompanionRegistry {
return found[0];
}
- scriptCompanionFor(module: ModuleRef, surface: string): StudioScriptCompanion | undefined {
- const found = this.#scripts.filter((companion) =>
+ temporalDomainCompanionFor(module: ModuleRef, surface: string): StudioTemporalDomainCompanion | undefined {
+ const found = this.#temporalDomains.filter((companion) =>
sameModule(companion.match.module, module) && companion.match.surface === surface);
- if (found.length > 1) throw new Error(`Studio Script companions are ambiguous for ${module.name}@${module.version}#${surface}.`);
+ if (found.length > 1) throw new Error(`Studio Temporal Domain companions are ambiguous for ${module.name}@${module.version}#${surface}.`);
return found[0];
}
- observeScript(
+ observeTemporalDomain(
module: ModuleRef,
surface: string,
- input: Parameters<StudioScriptCompanion["observe"]>[0],
- ): StudioScriptSourceMap | undefined {
- const companion = this.scriptCompanionFor(module, surface);
+ input: Parameters<StudioTemporalDomainCompanion["observe"]>[0],
+ ): StudioTemporalDomainSourceMap | undefined {
+ const companion = this.temporalDomainCompanionFor(module, surface);
const found = companion?.observe(input);
return companion === undefined || found === undefined
? undefined
: { ...found, companion: companion.id };
}
- projectScript(input: StudioScriptProjectionInput) {
- const companion = this.#scripts.find(item => item.id === input.source.companion);
- if (companion?.project === undefined) throw new Error(`Script Companion ${input.source.companion} does not provide a timeline projection.`);
+ projectTemporalDomain(input: StudioTemporalDomainProjectionInput) {
+ const companion = this.#temporalDomains.find(item => item.id === input.source.companion);
+ if (companion === undefined) throw new Error(`Temporal Domain Companion ${input.source.companion} is unavailable.`);
return companion.project(input);
}
- adjustScript(input: {
+ adjustTemporalDomain(input: {
readonly companion: string;
readonly sourceName: string;
readonly source: string;
- readonly adjustment: StudioScriptAdjustment;
+ readonly adjustment: StudioTemporalDomainAdjustment;
}): string {
- const companion = this.#scripts.find((candidate) => candidate.id === input.companion);
- if (companion === undefined) throw new Error(`Studio Script companion ${input.companion} is unavailable.`);
+ const companion = this.#temporalDomains.find((candidate) => candidate.id === input.companion);
+ if (companion === undefined) throw new Error(`Studio Temporal Domain companion ${input.companion} is unavailable.`);
return companion.adjust({ sourceName: input.sourceName, source: input.source, adjustment: input.adjustment });
}
+ temporalDomainValueTypes(): readonly TypeRef[] {
+ return this.#temporalDomains.flatMap((companion) => companion.valueTypes);
+ }
+
+ identifyTemporalSource(type: TypeRef, value: unknown): { readonly companion: string; readonly id: string; readonly kind: string; readonly itemId: string } | undefined {
+ const candidates = this.#temporalDomains.filter((companion) => companion.sourceTypes.some((sourceType) => sameType(sourceType, type)))
+ .flatMap((companion) => {
+ const found = companion.identify({ type, value });
+ return found === undefined ? [] : [{ companion: companion.id, id: found.domainId, kind: found.kind, itemId: found.id }];
+ });
+ if (candidates.length > 1) throw new Error(`Studio Temporal Domain source is ambiguous for ${type.module.name}@${type.module.version}#${type.name}.`);
+ return candidates[0];
+ }
+
+ temporalDomainPresentation(companionId: string) {
+ const companion = this.#temporalDomains.find((candidate) => candidate.id === companionId);
+ if (companion === undefined) throw new Error(`Studio Temporal Domain companion ${companionId} is unavailable.`);
+ return companion.presentation;
+ }
+
trackCompanionFor(
type: TypeRef,
placement: Pick<Placement, "surface" | "module"> | undefined,
@@ -316,25 +335,6 @@ export class StudioCompanionRegistry {
return this.trackCompanionFor(type, placement, siblingTypes)?.requiredValues ?? [];
}
- semanticTimelinePresentation(authoredLabel?: string): {
- readonly family: StudioTrackBinding["family"];
- readonly tone: StudioTrackBinding["tone"];
- readonly label?: string;
- readonly icon: StudioTrackBinding["icon"];
- readonly lane: StudioTrackBinding["lane"];
- } {
- const companion = this.trackCompanionFor(timelineTypes.track, undefined, []);
- return {
- family: companion?.family ?? "semantic",
- tone: companion?.tone ?? "teal",
- ...(authoredLabel === undefined
- ? (companion?.label === undefined ? {} : { label: companion.label })
- : { label: authoredLabel }),
- icon: companion?.icon ?? "brand",
- lane: companion?.lane ?? flatLane,
- };
- }
-
#trackCompanion(track: StudioResolvedTrack): StudioTrackCompanion & { readonly family: StudioTrackBinding["family"] } {
const placement = track.trace.surface === undefined || track.trace.module === undefined
? undefined
diff --git a/packages/studio/src/style.css b/packages/studio/src/style.css
index b834fbc3..435b3d9c 100644
--- a/packages/studio/src/style.css
+++ b/packages/studio/src/style.css
@@ -38,15 +38,15 @@
--tone-teal: #008889;
--tone-teal-rail: #00d4d5;
/* Semantic ruler: brightness separates content from its own band; hue marks state. */
- --semantic-segment: light-dark(#9cc5c1, #417370);
- --semantic-word: light-dark(#b5d4d0, #005551);
- --semantic-ink: light-dark(#1d4744, #eef0f3);
+ --temporal-domain-segment: light-dark(#9cc5c1, #417370);
+ --temporal-domain-compact: light-dark(#b5d4d0, #005551);
+ --temporal-domain-ink: light-dark(#1d4744, #eef0f3);
/* Author intent uses a gold annotation hue; brand pink stays in the chrome. */
- --semantic-intent: light-dark(#dcc570, #a28b2b);
- --semantic-intent-ink: light-dark(#5a4700, #fff);
- --semantic-moment: var(--brand-500);
- /* Same perceived active level as a selected/covered semantic cell. */
- --semantic-current: #009f98;
+ --temporal-domain-intent: light-dark(#dcc570, #a28b2b);
+ --temporal-domain-intent-ink: light-dark(#5a4700, #fff);
+ --temporal-domain-point: var(--brand-500);
+ /* Same perceived active level as a selected/covered temporal-domain item. */
+ --temporal-domain-current: #009f98;
/* Ordered marker depth: one hue, decreasing contrast with the background. */
--intent-depth-0: light-dark(#6e5800, #dfca7d);
--intent-depth-1: light-dark(#846d00, #c0aa54);
@@ -1171,29 +1171,29 @@ button:focus-visible, textarea:focus-visible {
.tick-last { padding-right: 4px; padding-left: 0; border-right: 1px solid light-dark(#c4c0b9, #45484e); border-left: 0; transform: translateX(-100%); }
.lanes { min-height: 0; cursor: default; }
.lane { position: relative; isolation: isolate; min-height: 0; overflow: hidden; border-bottom: 1px solid light-dark(#ebe8e4, #191b1f); background: var(--lane); }
-.semantic-lane { position: sticky; top: var(--timeline-ruler-height); z-index: 8; min-height: 0; border-bottom: 1px solid var(--line); background: var(--lane); }
-.semantic-band {
+.temporal-domain-lane { position: sticky; top: var(--timeline-ruler-height); z-index: 8; min-height: 0; border-bottom: 1px solid var(--line); background: var(--lane); }
+.temporal-domain-band {
position: absolute;
right: 0;
left: 0;
- height: var(--semantic-band-height);
+ height: var(--temporal-domain-band-height);
overflow: hidden;
background: var(--lane);
box-shadow: inset 0 -1px var(--line);
isolation: isolate;
}
-.semantic-band:last-child { box-shadow: none; }
+.temporal-domain-band:last-child { box-shadow: none; }
.lane-attached {
border-left: 0;
background: var(--lane);
}
.timeline-labels > .track-label:last-child,
.lanes > .lane:last-child { border-bottom: 0; }
-.semantic-cell {
- --semantic-cell: color-mix(in srgb, var(--speech) 54%, var(--lane));
+.temporal-domain-cell {
+ --temporal-domain-cell: color-mix(in srgb, var(--speech) 54%, var(--lane));
position: absolute;
top: 0;
- height: var(--semantic-band-height);
+ height: var(--temporal-domain-band-height);
min-width: 2px;
overflow: hidden;
display: flex;
@@ -1201,58 +1201,58 @@ button:focus-visible, textarea:focus-visible {
padding: 0;
border: 0;
border-radius: 0;
- background: var(--semantic-cell);
+ background: var(--temporal-domain-cell);
box-shadow: inset 0 0 0 1px light-dark(#ffffffb3, #ffffff12);
color: var(--text);
text-align: left;
cursor: default;
}
-.semantic-cell:focus-visible { outline: 0; box-shadow: inset 0 0 0 1px light-dark(#00000059, #ffffff60); }
-.semantic-segment {
- --semantic-cell: var(--semantic-segment);
+.temporal-domain-cell:focus-visible { outline: 0; box-shadow: inset 0 0 0 1px light-dark(#00000059, #ffffff60); }
+.temporal-domain-block {
+ --temporal-domain-cell: var(--temporal-domain-segment);
}
-.semantic-word {
- --semantic-cell: var(--semantic-word);
- color: light-dark(var(--semantic-ink), #e7e8eb);
+.temporal-domain-compact {
+ --temporal-domain-cell: var(--temporal-domain-compact);
+ color: light-dark(var(--temporal-domain-ink), #e7e8eb);
}
-.semantic-selection {
- --semantic-cell: var(--semantic-intent);
- color: var(--semantic-intent-ink);
+.temporal-domain-span {
+ --temporal-domain-cell: var(--temporal-domain-intent);
+ color: var(--temporal-domain-intent-ink);
}
-.semantic-cell.live { filter: brightness(1.12); }
-.semantic-cell.selected { z-index: 4; filter: brightness(1.16); box-shadow: inset 0 0 0 1px light-dark(#00000059, #ffffff60); }
-.semantic-moment.selected { z-index: 5; filter: brightness(1.16); box-shadow: inset 0 0 0 1px light-dark(#00000059, #ffffff60); }
-:root[data-theme="light"] .semantic-cell.live { filter: brightness(.94); }
-:root[data-theme="light"] :is(.semantic-cell, .semantic-moment).selected { filter: brightness(.9); }
-.semantic-segment-label {
+.temporal-domain-cell.live { filter: brightness(1.12); }
+.temporal-domain-cell.selected { z-index: 4; filter: brightness(1.16); box-shadow: inset 0 0 0 1px light-dark(#00000059, #ffffff60); }
+.temporal-domain-point.selected { z-index: 5; filter: brightness(1.16); box-shadow: inset 0 0 0 1px light-dark(#00000059, #ffffff60); }
+:root[data-theme="light"] .temporal-domain-cell.live { filter: brightness(.94); }
+:root[data-theme="light"] :is(.temporal-domain-cell, .temporal-domain-point).selected { filter: brightness(.9); }
+.temporal-domain-span-label {
flex: 1 1 auto;
min-width: 0;
overflow: hidden;
text-overflow: clip;
- color: var(--semantic-ink);
+ color: var(--temporal-domain-ink);
font-size: 11px;
font-weight: 500;
white-space: nowrap;
}
-.semantic-selection-label {
+.temporal-domain-span-label {
display: block;
overflow: hidden;
text-overflow: clip;
- color: var(--semantic-intent-ink);
+ color: var(--temporal-domain-intent-ink);
font-size: 11px;
font-weight: 500;
white-space: nowrap;
}
-.semantic-word.current { background: var(--semantic-current); color: #fff; }
-.semantic-word-label {
+.temporal-domain-compact.current { background: var(--temporal-domain-current); color: #fff; }
+.temporal-domain-compact-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 {
+.temporal-domain-compact.word-label-visible .temporal-domain-compact-label { display: block; }
+.temporal-domain-cell-content {
position: absolute;
top: 0;
bottom: 0;
@@ -1266,10 +1266,10 @@ button:focus-visible, textarea:focus-visible {
overflow: hidden;
padding: 0 0 0 5px;
}
-.semantic-word .semantic-cell-content { padding: 0 5px; }
-.semantic-moment {
+.temporal-domain-compact .temporal-domain-cell-content { padding: 0 5px; }
+.temporal-domain-point {
position: absolute;
- top: calc((var(--semantic-band-height) - 9px) / 2);
+ top: calc((var(--temporal-domain-band-height) - 9px) / 2);
z-index: 1;
width: 9px;
height: 9px;
@@ -1277,11 +1277,11 @@ button:focus-visible, textarea:focus-visible {
border-radius: 0;
padding: 0;
border: 1px solid var(--lane);
- background: var(--semantic-moment);
+ background: var(--temporal-domain-point);
}
-.semantic-moment:focus-visible { outline: 0; }
-.track-label-semantic { position: sticky; top: 0; z-index: 8; border-bottom: 1px solid var(--line); background: light-dark(#faf9f7, #111216); }
-.track-label-semantic::before { display: none; }
+.temporal-domain-point:focus-visible { outline: 0; }
+.track-label-temporal-domain { position: sticky; top: 0; z-index: 8; border-bottom: 1px solid var(--line); background: light-dark(#faf9f7, #111216); }
+.track-label-temporal-domain::before { display: none; }
.track-label-attached {
/* The branch marker occupies the same 18px prefix as a root icon;
attached and root labels therefore share one exact text column. */
diff --git a/packages/studio/src/temporal-edit.ts b/packages/studio/src/temporal-edit.ts
index f75c593d..db861a45 100644
--- a/packages/studio/src/temporal-edit.ts
+++ b/packages/studio/src/temporal-edit.ts
@@ -1,45 +1,45 @@
-import type { StudioEditHandle, StudioSemanticAnchor, StudioTemporalInstantProjection } from "@hypit/studio-adapter";
+import type { StudioEditHandle, StudioTemporalDomainAnchor, StudioTemporalDomainEditTarget, StudioTemporalInstantProjection } from "@hypit/studio-adapter";
-export type SemanticTarget =
- | { readonly kind: "selection"; readonly startAnchorId: string; readonly endAnchorId: string }
- | { readonly kind: "moment"; readonly anchorId: string };
+export type DomainTarget = StudioTemporalDomainEditTarget;
type Span = { readonly startFrame: number; readonly endFrameExclusive: number };
-/** Project only the semantic write exposed by the handle. This does not invert expressions. */
-export function semanticGestureSpan(
- anchors: readonly StudioSemanticAnchor[], handle: StudioEditHandle, target: SemanticTarget,
+/** Project only the domain write exposed by the handle. This does not invert expressions. */
+export function domainGestureSpan(
+ anchors: readonly StudioTemporalDomainAnchor[], handle: StudioEditHandle, target: DomainTarget,
): Span | undefined {
- const semantic = handle.semantic;
+ const domain = handle.domain;
const temporal = handle.temporal;
- if (!semantic || !temporal || target.kind !== semantic.kind) return undefined;
+ if (!domain || !temporal || target.kind !== domain.kind
+ || target.companion !== domain.companion || target.domainId !== domain.domainId
+ || target.itemId !== domain.itemId) return undefined;
const byId = new Map(anchors.map((anchor, order) => [anchor.id, { ...anchor, order }]));
let span: Span;
- if (semantic.kind === "moment" && target.kind === "moment") {
- const previous = byId.get(semantic.anchorId);
+ if (domain.kind === "point" && target.kind === "point") {
+ const previous = byId.get(domain.anchorId);
const next = byId.get(target.anchorId);
if (!previous || !next) return undefined;
const delta = next.frame - previous.frame;
span = temporal.kind === "instant"
? { startFrame: temporal.frame + delta, endFrameExclusive: temporal.frame + delta + 1 }
: { startFrame: temporal.startFrame + delta, endFrameExclusive: temporal.endFrameExclusive + delta };
- } else if (semantic.kind === "selection" && target.kind === "selection") {
+ } else if (domain.kind === "span" && target.kind === "span") {
const start = byId.get(target.startAnchorId);
const end = byId.get(target.endAnchorId);
if (!start || !end || start.order > end.order) return undefined;
if (temporal.kind === "instant") {
if (temporal.authority.kind !== "domain") return undefined;
- if (temporal.authority.boundary === "start" && target.endAnchorId !== semantic.endAnchorId
- || temporal.authority.boundary === "end" && target.startAnchorId !== semantic.startAnchorId) return undefined;
+ if (temporal.authority.boundary === "start" && target.endAnchorId !== domain.endAnchorId
+ || temporal.authority.boundary === "end" && target.startAnchorId !== domain.startAnchorId) return undefined;
const frame = temporal.authority.boundary === "start" ? start.frame : end.frame;
span = { startFrame: frame, endFrameExclusive: frame + 1 };
} else {
- if (handle.gesture === "trim-start" && target.endAnchorId !== semantic.endAnchorId
- || handle.gesture === "trim-end" && target.startAnchorId !== semantic.startAnchorId) return undefined;
+ if (handle.gesture === "trim-start" && target.endAnchorId !== domain.endAnchorId
+ || handle.gesture === "trim-end" && target.startAnchorId !== domain.startAnchorId) return undefined;
if (handle.gesture === "move") {
const stops = [...new Set(anchors.map((anchor) => anchor.frame))].sort((a, b) => a - b);
- const previousStart = byId.get(semantic.startAnchorId);
- const previousEnd = byId.get(semantic.endAnchorId);
+ const previousStart = byId.get(domain.startAnchorId);
+ const previousEnd = byId.get(domain.endAnchorId);
if (!previousStart || !previousEnd
|| stops.indexOf(start.frame) - stops.indexOf(previousStart.frame)
!== stops.indexOf(end.frame) - stops.indexOf(previousEnd.frame)) return undefined;
@@ -56,43 +56,45 @@ export function semanticGestureSpan(
}
/** A stop is a frame position; coincident anchors remain distinct choices at that stop. */
-export function chooseSemanticGesture(input: {
- readonly anchors: readonly StudioSemanticAnchor[];
+export function chooseDomainGesture(input: {
+ readonly anchors: readonly StudioTemporalDomainAnchor[];
readonly handle: StudioEditHandle;
readonly pointerStart: number;
readonly pointerNow: number;
readonly frameCount: number;
-}): SemanticTarget | undefined {
+}): DomainTarget | undefined {
const { anchors, handle } = input;
- const semantic = handle.semantic;
+ const domain = handle.domain;
const temporal = handle.temporal;
- if (!semantic || !temporal) return undefined;
+ if (!domain || !temporal) return undefined;
const order = new Map(anchors.map((anchor, index) => [anchor.id, index]));
const byId = new Map(anchors.map((anchor) => [anchor.id, anchor]));
- const at = new Map<number, StudioSemanticAnchor[]>();
+ const at = new Map<number, StudioTemporalDomainAnchor[]>();
for (const anchor of anchors) at.set(anchor.frame, [...at.get(anchor.frame) ?? [], anchor]);
const stops = [...at.keys()].sort((a, b) => a - b);
- const ranked = (choices: readonly StudioSemanticAnchor[], preferred: StudioSemanticAnchor) => [...choices].sort((a, b) =>
+ const ranked = (choices: readonly StudioTemporalDomainAnchor[], preferred: StudioTemporalDomainAnchor) => [...choices].sort((a, b) =>
Number(a.id !== preferred.id) - Number(b.id !== preferred.id)
|| Number(a.kind !== preferred.kind) - Number(b.kind !== preferred.kind)
|| order.get(a.id)! - order.get(b.id)!);
- const valid = (target: SemanticTarget) => {
- const span = semanticGestureSpan(anchors, handle, target);
+ const valid = (target: DomainTarget) => {
+ const span = domainGestureSpan(anchors, handle, target);
return span !== undefined && (temporal.kind === "instant" ? span.startFrame : span.endFrameExclusive) <= input.frameCount;
};
const delta = input.pointerNow - input.pointerStart;
- if (semantic.kind === "moment") {
- const current = byId.get(semantic.anchorId);
+ if (domain.kind === "point") {
+ const current = byId.get(domain.anchorId);
if (!current) return undefined;
const candidates = ranked(anchors, current).sort((a, b) =>
Math.abs(a.frame - current.frame - delta) - Math.abs(b.frame - current.frame - delta));
- return candidates.map((anchor): SemanticTarget => ({ kind: "moment", anchorId: anchor.id })).find(valid);
+ return candidates.map((anchor): DomainTarget => ({ kind: "point", companion: domain.companion,
+ domainId: domain.domainId, itemId: domain.itemId, anchorId: anchor.id })).find(valid);
}
- const start = byId.get(semantic.startAnchorId);
- const end = byId.get(semantic.endAnchorId);
+ const start = byId.get(domain.startAnchorId);
+ const end = byId.get(domain.endAnchorId);
if (!start || !end) return undefined;
- const target = (a: StudioSemanticAnchor, b: StudioSemanticAnchor): SemanticTarget => ({
- kind: "selection", startAnchorId: a.id, endAnchorId: b.id,
+ const target = (a: StudioTemporalDomainAnchor, b: StudioTemporalDomainAnchor): DomainTarget => ({
+ kind: "span", companion: domain.companion, domainId: domain.domainId, itemId: domain.itemId,
+ startAnchorId: a.id, endAnchorId: b.id,
});
if (handle.gesture === "move" && temporal.kind === "window") {
const first = stops.indexOf(start.frame);
diff --git a/packages/studio/src/temporal-graph.ts b/packages/studio/src/temporal-graph.ts
index d52cb0ba..6b2baf2a 100644
--- a/packages/studio/src/temporal-graph.ts
+++ b/packages/studio/src/temporal-graph.ts
@@ -1,5 +1,5 @@
import { sameType } from "@hypit/protocol";
-import type { BuildState, ProducerStep, StoredValue, TypedRecord } from "@hypit/protocol";
+import type { BuildState, ProducerStep, StoredValue, TypeRef, TypedRecord } from "@hypit/protocol";
import { temporalModuleRef, temporalTypes } from "@hypit/temporal";
import type {
StudioTemporalBinding,
@@ -13,6 +13,13 @@ type PointExpression = {
readonly at?: unknown;
};
+type IdentifyTemporalSource = (type: TypeRef, value: unknown) => {
+ readonly companion: string;
+ readonly id: string;
+ readonly kind: string;
+ readonly itemId: string;
+} | undefined;
+
function inline(value: StoredValue): unknown | undefined {
return value.kind === "inline" ? value.value : undefined;
}
@@ -53,6 +60,7 @@ function instant(
record: TypedRecord | undefined,
records: ReadonlyMap<string, TypedRecord>,
producers: ReadonlyMap<string, ProducerStep>,
+ identify?: IdentifyTemporalSource,
fallback?: unknown,
): StudioTemporalInstantProjection | undefined {
const value = record === undefined ? fallback : inline(record.value);
@@ -94,25 +102,26 @@ function instant(
if (domainInput !== undefined) {
const [kind, sourceId] = domainInput;
const sourceRecord = records.get(sourceId);
- const sourceValue = sourceRecord === undefined ? undefined : inline(sourceRecord.value) as {
- readonly id?: unknown; readonly narrativeId?: unknown;
- } | undefined;
+ const sourceValue = sourceRecord === undefined ? undefined : inline(sourceRecord.value) as { readonly id?: unknown } | undefined;
const boundary = typeof spec?.boundary === "string" ? spec.boundary : "point";
const reference = typeof spec?.reference === "string"
? spec.reference
: `${kind}.${boundary === "cue" ? "cue" : boundary}`;
const point = { ref: reference, ...(spec?.offset === undefined ? {} : { offset: spec.offset }) };
- if (sourceRecord !== undefined && typeof sourceValue?.id === "string") return {
+ if (sourceRecord !== undefined && typeof sourceValue?.id === "string") {
+ const identified = identify?.(sourceRecord.type, sourceValue);
+ const source = { timelineId: held.timelineId, type: sourceRecord.type,
+ kind: identified?.kind ?? kind, id: identified?.itemId ?? sourceValue.id,
+ ...(identified === undefined ? {} : { domain: { companion: identified.companion, id: identified.id } }) };
+ return {
kind: "instant",
expression: expression(point),
reference,
frame: held.frame as number,
- source: { timelineId: held.timelineId, type: sourceRecord.type, kind, id: sourceValue.id,
- ...(typeof sourceValue.narrativeId === "string" ? { narrativeId: sourceValue.narrativeId } : {}) },
- authority: { kind: "domain", source: { timelineId: held.timelineId, type: sourceRecord.type,
- kind, id: sourceValue.id,
- ...(typeof sourceValue.narrativeId === "string" ? { narrativeId: sourceValue.narrativeId } : {}) }, boundary },
+ source,
+ authority: { kind: "domain", source, boundary },
};
+ }
}
}
const type = record?.type ?? temporalTypes.instant;
@@ -130,6 +139,7 @@ function projection(
record: TypedRecord,
records: ReadonlyMap<string, TypedRecord>,
producers: ReadonlyMap<string, ProducerStep>,
+ identify?: IdentifyTemporalSource,
): {
readonly id: string;
readonly subjectId: string;
@@ -144,14 +154,14 @@ function projection(
} | undefined;
if (typeof held?.id !== "string" || typeof held.subjectId !== "string") return undefined;
if (sameType(record.type, temporalTypes.instant)) {
- const projected = instant(record, records, producers);
+ const projected = instant(record, records, producers, identify);
return projected === undefined ? undefined : { id: held.id, subjectId: held.subjectId, projection: projected };
}
const step = producers.get(record.id);
const startRecord = step?.inputs.start === undefined ? undefined : records.get(step.inputs.start);
const endRecord = step?.inputs.end === undefined ? undefined : records.get(step.inputs.end);
- const start = instant(startRecord, records, producers, held.start);
- const end = instant(endRecord, records, producers, held.end);
+ const start = instant(startRecord, records, producers, identify, held.start);
+ const end = instant(endRecord, records, producers, identify, held.end);
if (start === undefined || end === undefined) return undefined;
if (!Number.isSafeInteger(held.span?.startFrame) || !Number.isSafeInteger(held.span?.endFrameExclusive)) return undefined;
return {
@@ -202,6 +212,7 @@ function closure(state: BuildState, output: string): ReadonlySet<string> {
export function executedTemporalBindings(
state: BuildState,
output: string,
+ identify?: IdentifyTemporalSource,
): readonly StudioTemporalBinding[] {
const records = recordIndex(state);
const producers = producingSteps(state);
@@ -210,7 +221,7 @@ export function executedTemporalBindings(
return [...records.values()]
.filter((record) => sameType(record.type, temporalTypes.instant) || sameType(record.type, temporalTypes.window))
.flatMap((record): readonly StudioTemporalBinding[] => {
- const projected = projection(record, records, producers);
+ const projected = projection(record, records, producers, identify);
if (projected === undefined) return [];
const consumers = steps.flatMap((step) => Object.entries(step.inputs)
.filter(([, input]) => input === record.id)
diff --git a/packages/studio/src/ui/main.ts b/packages/studio/src/ui/main.ts
index f78b4e3b..207cea44 100644
--- a/packages/studio/src/ui/main.ts
+++ b/packages/studio/src/ui/main.ts
@@ -8,11 +8,11 @@ import { icon } from "./icons.js";
import { createLibraryPane } from "./library.js";
import { createHandle } from "./resize.js";
import type { Highlight } from "./code.js";
-import { intentAtOffset, spanAtOffset } from "./markers.js";
+import { domainItemAtOffset, spanAtOffset } from "./markers.js";
import { clipAtOffset, createStore } from "./selection.js";
import { createStage } from "./stage.js";
-import { semanticGestureSpan } from "../temporal-edit.js";
-import type { SemanticTarget } from "../temporal-edit.js";
+import { domainGestureSpan } from "../temporal-edit.js";
+import type { DomainTarget } from "../temporal-edit.js";
import { applyStudioMutation } from "./writeback.js";
import { createTimeline } from "./timeline.js";
import { createComments } from "./comments.js";
@@ -854,98 +854,86 @@ function renderInspector(snapshot: StudioSnapshot, clipId: string | undefined):
inspector.replaceChildren(...(pageIds.length > 1 ? [subtabs] : []), ...parameterGroups(clip.id, [...commonFields, ...(page?.fields ?? [])]));
}
-function renderSemanticInspector(snapshot: StudioSnapshot, segmentId: string): void {
- const segment = snapshot.semantic?.segments.find((item) => item.id === segmentId);
- if (segment === undefined) { inspector.replaceChildren(); return; }
+/** Exact identity choice for coincident anchors, through package-declared domain handles. */
+function renderTemporalDomainInspector(snapshot: StudioSnapshot, companion: string, domainId: string, itemId: string): void {
+ const domain = snapshot.temporalDomains.find((candidate) => candidate.companion === companion && candidate.id === domainId);
+ const item = domain?.items.find((candidate) => candidate.id === itemId);
+ if (domain === undefined || item === undefined) { inspector.replaceChildren(); return; }
defaultWorkspaceHeading();
- const empty = document.createElement("div");
- empty.className = "inspector-empty";
- uiText(empty, "inspector.empty");
- inspector.replaceChildren(empty);
-}
-
-/** Exact identity choice for coincident anchors, through the same Companion-declared handles. */
-function semanticAnchorInspector(snapshot: StudioSnapshot, kind: "selection" | "moment", id: string): HTMLElement {
- const semantic = snapshot.semantic;
const consumers = snapshot.tracks.flatMap((track) => track.clips).flatMap((clip) => clip.editHandles
- .filter((handle) => handle.enabled && handle.semantic?.kind === kind && handle.semantic.id === id)
+ .filter((handle) => handle.enabled && handle.domain?.companion === companion
+ && handle.domain.domainId === domainId && handle.domain.itemId === itemId)
.map((handle) => ({ clip, handle })));
- const current = kind === "selection" ? semantic?.selections.find((item) => item.id === id)
- : semantic?.moments.find((item) => item.id === id);
- if (!semantic || !current) return uiGroup("inspector.timing", []);
- const endpoints: readonly (readonly [Message, string])[] = "anchorId" in current ? [["inspector.moment", current.anchorId]]
- : [["inspector.start", current.startAnchorId], ["inspector.end", current.endAnchorId]];
- return uiGroup("inspector.semantic-anchors", endpoints.map(([label, anchorId]) => {
- const anchor = semantic.anchors.find((item) => item.id === anchorId)!;
- const describe = (node: Element, item: typeof anchor) => {
- const word = semantic.tokens.find((token) => token.id === item.tokenId)?.text;
- uiText(node, `inspector.anchor.${item.kind}`, { detail: `${word ? ` · ${word}` : ""}${item.segmentId ? ` · ${item.segmentId}` : ""}` });
+ if (item.editable !== true || consumers.length === 0) {
+ const empty = document.createElement("div");
+ empty.className = "inspector-empty";
+ uiText(empty, "inspector.empty");
+ inspector.replaceChildren(empty);
+ return;
+ }
+ const endpoints: readonly (readonly [Message, string])[] = item.kind === "point"
+ ? [["inspector.moment", item.anchorId]]
+ : [["inspector.start", item.startAnchorId], ["inspector.end", item.endAnchorId]];
+ const rows = endpoints.map(([label, anchorId]) => {
+ const anchor = domain.anchors.find((candidate) => candidate.id === anchorId)!;
+ const describe = (node: Element, candidate: typeof anchor): void => {
+ node.textContent = candidate.label ?? candidate.detail ?? `${candidate.kind} · ${candidate.id}`;
};
- const candidates = semantic.anchors.filter((item) => item.frame === anchor.frame).flatMap((item) => {
- const target: SemanticTarget = "anchorId" in current ? { kind: "moment", anchorId: item.id }
- : { kind: "selection", startAnchorId: label === "inspector.start" ? item.id : current.startAnchorId,
- endAnchorId: label === "inspector.end" ? item.id : current.endAnchorId };
- const owner = consumers.find(({ handle }) => semanticGestureSpan(semantic.anchors, handle, target) !== undefined);
- return owner ? [{ item, target, ...owner }] : [];
+ const candidates = domain.anchors.filter((candidate) => candidate.frame === anchor.frame).flatMap((candidate) => {
+ const target: DomainTarget = item.kind === "point"
+ ? { kind: "point", companion, domainId, itemId, anchorId: candidate.id }
+ : { kind: "span", companion, domainId, itemId,
+ startAnchorId: label === "inspector.start" ? candidate.id : item.startAnchorId,
+ endAnchorId: label === "inspector.end" ? candidate.id : item.endAnchorId };
+ const owner = consumers.find(({ handle }) => domainGestureSpan(domain.anchors, handle, target) !== undefined);
+ return owner === undefined ? [] : [{ item: candidate, target, ...owner }];
});
if (candidates.length < 2) {
- const row = property(label!, "");
+ const row = property(label, "");
describe(row.querySelector("strong")!, anchor);
return row;
}
const row = document.createElement("label");
row.className = "property";
const name = document.createElement("span");
- uiText(name, label!);
+ uiText(name, label);
const control = document.createElement("select");
control.className = "parameter-value";
- uiAttr(control, "aria-label", label === "inspector.start" ? "inspector.start-anchor" : label === "inspector.end" ? "inspector.end-anchor" : "inspector.moment-anchor");
- for (const { item } of candidates) {
- const option = document.createElement("option"); option.value = item.id; describe(option, item);
+ control.setAttribute("aria-label", `${item.label} ${label}`);
+ for (const { item: candidate } of candidates) {
+ const option = document.createElement("option"); option.value = candidate.id; describe(option, candidate);
control.append(option);
}
- control.value = anchorId!;
+ control.value = anchorId;
control.addEventListener("change", () => {
- const choice = candidates.find(({ item }) => item.id === control.value)!;
- const span = semanticGestureSpan(semantic.anchors, choice.handle, choice.target)!;
+ const choice = candidates.find(({ item: candidate }) => candidate.id === control.value)!;
+ const span = domainGestureSpan(domain.anchors, choice.handle, choice.target)!;
const temporal = choice.handle.temporal!;
control.disabled = true;
uiText(status, "common.saving"); status.className = "status saving";
void applyStudioMutation({ type: "timeline.adjust", revision: snapshot.revision,
entityId: choice.clip.id, gesture: choice.handle.gesture,
- target: temporal.kind === "instant" ? { kind: "instant", frame: span.startFrame, semantic: choice.target }
- : { kind: "window", ...span, semantic: choice.target },
+ target: temporal.kind === "instant" ? { kind: "instant", frame: span.startFrame, domain: choice.target }
+ : { kind: "window", ...span, domain: choice.target },
}).then(() => { uiText(status, "common.saved"); status.className = "status saved"; })
.catch((error: unknown) => {
- control.value = anchorId!; uiText(status, "common.save-failed"); status.className = "status error";
+ control.value = anchorId; uiText(status, "common.save-failed"); status.className = "status error";
status.title = error instanceof Error ? error.message : String(error);
}).finally(() => { control.disabled = false; });
});
row.append(name, control);
return row;
- }));
-}
-
-function renderSemanticSelectionInspector(snapshot: StudioSnapshot, selectionId: string): void {
- const selection = snapshot.semantic?.selections.find((item) => item.id === selectionId);
- if (selection === undefined) { inspector.replaceChildren(); return; }
- defaultWorkspaceHeading();
- inspector.replaceChildren(semanticAnchorInspector(snapshot, "selection", selectionId));
-}
-
-function renderSemanticMomentInspector(snapshot: StudioSnapshot, momentId: string): void {
- const moment = snapshot.semantic?.moments.find((item) => item.id === momentId);
- if (moment === undefined) { inspector.replaceChildren(); return; }
- defaultWorkspaceHeading();
- inspector.replaceChildren(semanticAnchorInspector(snapshot, "moment", momentId));
+ });
+ inspector.replaceChildren(group(domain.presentation.label ?? item.label, rows));
}
// The word being spoken at the playhead, which is the point of carrying token
// timings at all: it ties the Script text to the frame on screen.
store.subscribe(({ snapshot, playhead }) => {
- const token = snapshot.script?.tokens.find((item) =>
- playhead.frame >= item.startFrame && playhead.frame < item.endFrame);
- code.speak(token?.range);
+ const spoken = snapshot.temporalDomains.flatMap((domain) => domain.items)
+ .find((item) => item.kind === "span" && item.followPlayhead === true
+ && playhead.frame >= item.startFrame && playhead.frame < item.endFrameExclusive);
+ code.speak(spoken?.range);
});
let described = "";
@@ -954,22 +942,17 @@ let scrolledTo = "";
store.subscribe(({ snapshot, selection, playhead }) => {
const origin = selection.kind === "none" ? undefined : selection.origin;
const chosen = selection.kind === "clip" ? store.clip(selection.clipId) : undefined;
- const chosenSegment = selection.kind === "semantic-segment"
- ? snapshot.semantic?.segments.find((item) => item.id === selection.segmentId)
- : undefined;
- const chosenSelection = selection.kind === "semantic-selection"
- ? snapshot.semantic?.selections.find((item) => item.id === selection.selectionId)
- : undefined;
- const chosenMoment = selection.kind === "semantic-moment"
- ? snapshot.semantic?.moments.find((item) => item.id === selection.momentId)
+ const chosenDomain = selection.kind === "temporal-domain"
+ ? snapshot.temporalDomains.find((domain) => domain.companion === selection.companion
+ && domain.id === selection.domainId)?.items.find((item) => item.id === selection.itemId)
: undefined;
// Rebuilding this every frame of playback would be DOM churn for no change.
- const describes = `${snapshot.revision}:${selection.kind}:${chosen?.id ?? chosenSegment?.id ?? chosenSelection?.id ?? chosenMoment?.id ?? ""}`;
+ const describes = `${snapshot.revision}:${selection.kind}:${chosen?.id ?? chosenDomain?.id ?? ""}`;
if (describes !== described) {
described = describes;
- if (chosenSegment !== undefined) renderSemanticInspector(snapshot, chosenSegment.id);
- else if (chosenSelection !== undefined) renderSemanticSelectionInspector(snapshot, chosenSelection.id);
- else if (chosenMoment !== undefined) renderSemanticMomentInspector(snapshot, chosenMoment.id);
+ if (selection.kind === "temporal-domain") {
+ renderTemporalDomainInspector(snapshot, selection.companion, selection.domainId, selection.itemId);
+ }
else renderInspector(snapshot, chosen?.id);
}
@@ -985,27 +968,14 @@ store.subscribe(({ snapshot, selection, playhead }) => {
if (chosen?.elementRange !== undefined) {
highlights.push({ range: chosen.elementRange, tone: "element" });
}
- if (chosenSegment?.range !== undefined) {
- highlights.push({ range: chosenSegment.range, tone: "element" });
- }
- const sourceSelection = chosenSelection === undefined
- ? undefined
- : snapshot.script?.selections.find((item) => item.id === chosenSelection.id);
- const sourceMoment = chosenMoment === undefined
- ? undefined
- : snapshot.script?.moments.find((item) => item.id === chosenMoment.id);
- const chosenIntentRange = sourceSelection === undefined
- ? sourceMoment?.range
- : { start: sourceSelection.open.start, end: sourceSelection.close.end };
- if (chosenIntentRange !== undefined) highlights.push({ range: chosenIntentRange, tone: "binding" });
+ if (chosenDomain?.range !== undefined) highlights.push({ range: chosenDomain.range, tone: "binding" });
// Scroll only when the selection actually moved, and never toward the pane
// the author is pointing at: following the playhead every frame would drag
// the source out from under whoever is reading it.
- const focused = chosen === undefined && chosenSegment === undefined
- && chosenSelection === undefined && chosenMoment === undefined
+ const focused = chosen === undefined && chosenDomain === undefined
? ""
- : `${snapshot.revision}:${selection.kind}:${chosen?.id ?? chosenSegment?.id ?? chosenSelection?.id ?? chosenMoment?.id}`;
+ : `${snapshot.revision}:${selection.kind}:${chosen?.id ?? chosenDomain?.id}`;
const moved = focused.length > 0 && focused !== scrolledTo;
scrolledTo = focused;
code.highlight(highlights, moved && origin !== "code");
@@ -1025,13 +995,9 @@ code.element.addEventListener("click", (event) => {
store.clearSelection();
return;
}
- const intent = intentAtOffset(state.snapshot, offset);
- if (intent?.kind === "selection") {
- store.selectSemanticSelection(intent.id, "code");
- return;
- }
- if (intent?.kind === "moment") {
- store.selectSemanticMoment(intent.id, "code");
+ const domainItem = domainItemAtOffset(state.snapshot, offset);
+ if (domainItem !== undefined) {
+ store.selectTemporalDomainItem(domainItem.companion, domainItem.domainId, domainItem.itemId, "code");
return;
}
const clip = clipAtOffset(state.snapshot, offset);
@@ -1050,11 +1016,14 @@ code.element.addEventListener("click", (event) => {
// finds the clips it put there through the second, not the first.
const bound = state.snapshot.tracks
.flatMap((track) => track.clips)
- .find((item) => item.markerId === span.id || item.authoredId === span.id);
+ .find((item) => item.markerId === span.itemId || item.authoredId === span.itemId);
// A marker that places nothing still sits inside one that does, so the
// enclosing clip stays selected rather than leaving the inspector blank.
const target = bound?.id ?? clip?.id;
- if (target === undefined) store.seek(span.startFrame, "code");
+ if (target === undefined) {
+ store.selectTemporalDomainItem(span.companion, span.domainId, span.itemId, "code");
+ store.seek(span.startFrame, "code");
+ }
else store.focus(span.startFrame, target, "code");
return;
}
@@ -1122,9 +1091,8 @@ function applyFailure(failure: StudioFailure): void {
const current = store.current();
if (current === undefined) return;
if (current.selection.kind === "clip") renderInspector(current.snapshot, current.selection.clipId);
- else if (current.selection.kind === "semantic-segment") renderSemanticInspector(current.snapshot, current.selection.segmentId);
- else if (current.selection.kind === "semantic-selection") renderSemanticSelectionInspector(current.snapshot, current.selection.selectionId);
- else if (current.selection.kind === "semantic-moment") renderSemanticMomentInspector(current.snapshot, current.selection.momentId);
+ else if (current.selection.kind === "temporal-domain") renderTemporalDomainInspector(current.snapshot,
+ current.selection.companion, current.selection.domainId, current.selection.itemId);
}
const response = await fetch("/__studio/session");
diff --git a/packages/studio/src/ui/markers.ts b/packages/studio/src/ui/markers.ts
index bed4ef4c..c20cf932 100644
--- a/packages/studio/src/ui/markers.ts
+++ b/packages/studio/src/ui/markers.ts
@@ -3,34 +3,19 @@ import type { Range, StudioSnapshot } from "../shared.js";
/** How many distinct depth tones the stylesheet defines. */
export const INTENT_TONES = 4;
-/**
- * A tone per authored intent, shared by the code pane, the timeline and the box
- * drawn over the picture.
- *
- * Author intents are coloured by **nesting depth**, not by identity. Depth is the only
- * difference between two Selections that means anything — an inner one is a
- * narrower claim about the same speech — so two intents at the same depth read
- * the same, and an inner pair reads as sitting inside its outer pair rather than
- * as an unrelated thing.
- *
- * The three panes have to agree, or the colour would carry no meaning: an intent
- * pair in the prose and the clip it binds are the same fact seen twice.
- */
+function depthOf(range: Range, all: readonly Range[]): number {
+ return 1 + all.filter((other) => other.start < range.start && other.end > range.end).length;
+}
+
+/** Stable tones derived from package-contributed source nesting, then reused by clips. */
export function intentTones(snapshot: StudioSnapshot): ReadonlyMap<string, number> {
const tones = new Map<string, number>();
- for (const segment of snapshot.script?.segments ?? []) {
- tones.set(segment.id, segment.depth % INTENT_TONES);
- }
- for (const selection of snapshot.script?.selections ?? []) {
- tones.set(selection.id, selection.depth % INTENT_TONES);
+ for (const domain of snapshot.temporalDomains) {
+ const ranges = domain.items.flatMap((item) => item.range === undefined ? [] : [item.range]);
+ for (const item of domain.items) {
+ if (item.range !== undefined) tones.set(item.id, depthOf(item.range, ranges) % INTENT_TONES);
+ }
}
- // A Moment marks an instant, so it sits at whatever level it was written in
- // rather than enclosing anything. One level in from its Segment is honest.
- for (const moment of snapshot.script?.moments ?? []) tones.set(moment.id, 1 % INTENT_TONES);
- // A clip is coloured by what placed it, so a cutaway and the words that call
- // for it read as one thing. But several clips can share one intent - the rows
- // of a board do - and colouring them alike would say they are the same clip.
- // Siblings therefore step through the tones from their intent's own.
const seen = new Map<string, number>();
let spare = 0;
for (const track of snapshot.tracks) {
@@ -38,7 +23,6 @@ export function intentTones(snapshot: StudioSnapshot): ReadonlyMap<string, numbe
if (tones.has(clip.authoredId)) continue;
const intent = clip.markerId === undefined ? undefined : tones.get(clip.markerId);
if (intent === undefined) {
- // Nothing said to put this here, so it takes the next tone along.
tones.set(clip.authoredId, spare % INTENT_TONES);
spare += 1;
continue;
@@ -51,102 +35,51 @@ export function intentTones(snapshot: StudioSnapshot): ReadonlyMap<string, numbe
return tones;
}
-/**
- * The Script ranges whose speech the playhead is inside, outermost first.
- *
- * Segments and Selections alike, because a Segment is a level too: `<price>`
- * encloses `@{bags}`, so drawing only the Selection would show a nesting with its
- * outermost level missing.
- *
- * Derived from the Script tokens each range encloses rather than from the clips
- * bound to it, because a range is a claim about speech whether or not anything
- * was placed on it. `@{amount}` inside `@{fee}` is still inside `@{fee}` even when
- * only the outer one drives a Media Item.
- */
-export type ScriptSpan = {
- readonly id: string;
+export type DomainSpan = {
+ readonly companion: string;
+ readonly domainId: string;
+ readonly itemId: string;
readonly depth: number;
readonly range: Range;
readonly startFrame: number;
readonly endFrame: number;
};
-/** Every Segment and Selection, placed on the timeline by the tokens it holds. */
-export function scriptSpans(snapshot: StudioSnapshot): readonly ScriptSpan[] {
- const tokens = snapshot.script?.tokens ?? [];
- const placed: ScriptSpan[] = [];
- const spans = [
- ...(snapshot.script?.segments ?? []).map((segment) => ({
- id: segment.id, depth: segment.depth, range: segment.range,
- })),
- ...(snapshot.script?.selections ?? []).map((selection) => ({
- id: selection.id,
- depth: selection.depth,
- range: { start: selection.open.start, end: selection.close.end },
- })),
- ];
- for (const { id, depth, range } of spans) {
- const within = tokens.filter((token) =>
- token.range.start >= range.start && token.range.end <= range.end);
- if (within.length === 0) continue;
- placed.push({
- id, depth, range,
- startFrame: Math.min(...within.map((token) => token.startFrame)),
- endFrame: Math.max(...within.map((token) => token.endFrame)),
- });
- }
- return placed;
+/** Every package-contributed source span that is located on the Timeline. */
+export function domainSpans(snapshot: StudioSnapshot): readonly DomainSpan[] {
+ return snapshot.temporalDomains.flatMap((domain) => {
+ const spans = domain.items.flatMap((item) => item.kind === "span" && item.range !== undefined
+ ? [{ item, range: item.range }] : []);
+ const ranges = spans.map(({ range }) => range);
+ return spans.map(({ item, range }) => ({
+ companion: domain.companion,
+ domainId: domain.id,
+ itemId: item.id,
+ depth: depthOf(range, ranges),
+ range,
+ startFrame: item.startFrame,
+ endFrame: item.endFrameExclusive,
+ }));
+ });
}
-export function liveRanges(snapshot: StudioSnapshot, frame: number): readonly ScriptSpan[] {
- // Outermost first: an inner outline is drawn last and sits inside its parent.
- return scriptSpans(snapshot)
- .filter((span) => frame >= span.startFrame && frame < span.endFrame)
- .sort((left, right) => left.depth - right.depth);
-}
-
-/**
- * The tightest Script range written around a source offset.
- *
- * Clicking marked prose should land inside the thing that was clicked, and the
- * innermost intent is the most specific claim there. Resolving to a clip alone
- * would send a click on `@{amount}` to whatever encloses it, because a marker that
- * places nothing still means something.
- */
-export function spanAtOffset(snapshot: StudioSnapshot, offset: number): ScriptSpan | undefined {
- return scriptSpans(snapshot)
+export function spanAtOffset(snapshot: StudioSnapshot, offset: number): DomainSpan | undefined {
+ return domainSpans(snapshot)
.filter((span) => offset >= span.range.start && offset <= span.range.end)
- .sort((left, right) =>
- (left.range.end - left.range.start) - (right.range.end - right.range.start))[0];
+ .sort((left, right) => (left.range.end - left.range.start) - (right.range.end - right.range.start))[0];
}
-/**
- * The authored intent under a source cursor. Unlike a rendered clip, this is
- * an author entity in its own right: clicking a Selection or Moment in prose
- * must select that marker, even when it has no consumer and therefore no clip.
- */
-export type SourceIntent =
- | { readonly kind: "selection"; readonly id: string; readonly range: Range }
- | { readonly kind: "moment"; readonly id: string; readonly range: Range };
+export type SourceDomainItem = {
+ readonly companion: string;
+ readonly domainId: string;
+ readonly itemId: string;
+ readonly range: Range;
+};
-export function intentAtOffset(snapshot: StudioSnapshot, offset: number): SourceIntent | undefined {
- const intents: SourceIntent[] = [
- ...(snapshot.script?.selections ?? []).map((selection) => ({
- kind: "selection" as const,
- id: selection.id,
- range: { start: selection.open.start, end: selection.close.end },
- })),
- ...(snapshot.script?.moments ?? []).map((moment) => ({
- kind: "moment" as const,
- id: moment.id,
- range: moment.range,
- })),
- ];
- return intents
- .filter((intent) => offset >= intent.range.start && offset <= intent.range.end)
- .sort((left, right) => {
- const span = (item: SourceIntent): number => item.range.end - item.range.start;
- const width = span(left) - span(right);
- return width !== 0 ? width : left.kind === "moment" ? -1 : 1;
- })[0];
+/** The tightest package-contributed temporal item under a source cursor. */
+export function domainItemAtOffset(snapshot: StudioSnapshot, offset: number): SourceDomainItem | undefined {
+ return snapshot.temporalDomains.flatMap((domain) => domain.items.flatMap((item) => item.range === undefined ? [] : [{
+ companion: domain.companion, domainId: domain.id, itemId: item.id, range: item.range,
+ }])).filter((item) => offset >= item.range.start && offset <= item.range.end)
+ .sort((left, right) => (left.range.end - left.range.start) - (right.range.end - right.range.start))[0];
}
diff --git a/packages/studio/src/ui/selection.ts b/packages/studio/src/ui/selection.ts
index 7016ab75..a18ab53d 100644
--- a/packages/studio/src/ui/selection.ts
+++ b/packages/studio/src/ui/selection.ts
@@ -10,9 +10,7 @@ export type Origin = "timeline" | "code" | "video";
export type Selection =
| { readonly kind: "none" }
| { readonly kind: "clip"; readonly clipId: string; readonly origin: Origin }
- | { readonly kind: "semantic-segment"; readonly segmentId: string; readonly origin: Origin }
- | { readonly kind: "semantic-selection"; readonly selectionId: string; readonly origin: Origin }
- | { readonly kind: "semantic-moment"; readonly momentId: string; readonly origin: Origin };
+ | { readonly kind: "temporal-domain"; readonly companion: string; readonly domainId: string; readonly itemId: string; readonly origin: Origin };
export type Playhead = { readonly frame: number; readonly origin: Origin | "play" };
@@ -31,12 +29,8 @@ export type Store = {
load(snapshot: StudioSnapshot): void;
/** Select without moving the playhead; timeline inspection must not destroy position. */
select(clipId: string, origin: Origin): void;
- /** Select one authored semantic relation without moving the playhead. */
- selectSemanticSegment(segmentId: string, origin: Origin): void;
- /** Select one authored Selection marker without moving the playhead. */
- selectSemanticSelection(selectionId: string, origin: Origin): void;
- /** Select one authored Moment marker without moving the playhead. */
- selectSemanticMoment(momentId: string, origin: Origin): void;
+ /** Select one package-contributed temporal-domain item without moving the playhead. */
+ selectTemporalDomainItem(companion: string, domainId: string, itemId: string, origin: Origin): void;
/** Select and seek to the clip start, used by source navigation. */
selectClip(clipId: string, origin: Origin): void;
/**
@@ -110,16 +104,9 @@ export function createStore(): Store {
if (held.kind === "clip" && !clips().some((clip) => clip.id === held.clipId)) {
selection = { kind: "none" };
}
- if (held.kind === "semantic-segment"
- && !snapshot.semantic?.segments.some((segment) => segment.id === held.segmentId)) {
- selection = { kind: "none" };
- }
- if (held.kind === "semantic-selection"
- && !snapshot.semantic?.selections.some((item) => item.id === held.selectionId)) {
- selection = { kind: "none" };
- }
- if (held.kind === "semantic-moment"
- && !snapshot.semantic?.moments.some((item) => item.id === held.momentId)) {
+ if (held.kind === "temporal-domain"
+ && !snapshot.temporalDomains.some((domain) => domain.companion === held.companion
+ && domain.id === held.domainId && domain.items.some((item) => item.id === held.itemId))) {
selection = { kind: "none" };
}
playhead = { frame: clamp(playhead.frame), origin: playhead.origin };
@@ -131,19 +118,10 @@ export function createStore(): Store {
selection = { kind: "clip", clipId, origin };
emit();
},
- selectSemanticSegment(segmentId, origin) {
- if (snapshot?.semantic?.segments.some((segment) => segment.id === segmentId) !== true) return;
- selection = { kind: "semantic-segment", segmentId, origin };
- emit();
- },
- selectSemanticSelection(selectionId, origin) {
- if (snapshot?.semantic?.selections.some((item) => item.id === selectionId) !== true) return;
- selection = { kind: "semantic-selection", selectionId, origin };
- emit();
- },
- selectSemanticMoment(momentId, origin) {
- if (snapshot?.semantic?.moments.some((item) => item.id === momentId) !== true) return;
- selection = { kind: "semantic-moment", momentId, origin };
+ selectTemporalDomainItem(companion, domainId, itemId, origin) {
+ if (snapshot?.temporalDomains.some((domain) => domain.companion === companion
+ && domain.id === domainId && domain.items.some((item) => item.id === itemId)) !== true) return;
+ selection = { kind: "temporal-domain", companion, domainId, itemId, origin };
emit();
},
selectClip(clipId, origin) {
diff --git a/packages/studio/src/ui/timeline.ts b/packages/studio/src/ui/timeline.ts
index e709ad44..c809fa71 100644
--- a/packages/studio/src/ui/timeline.ts
+++ b/packages/studio/src/ui/timeline.ts
@@ -1,15 +1,12 @@
import { userText, uiAttribute, uiText, uiAttr } from "./i18n.js";
-import type {
- SemanticToken,
- StudioSnapshot,
-} from "../shared.js";
+import type { StudioSnapshot } from "../shared.js";
import type { StudioEditHandle } from "@hypit/studio-adapter";
import { icon, setIcon } from "./icons.js";
import { mountMaterialPreview } from "./material-preview.js";
import type { State, Store } from "./selection.js";
import { createHandle } from "./resize.js";
import { createZoom } from "./zoom.js";
-import { chooseSemanticGesture, semanticGestureSpan } from "../temporal-edit.js";
+import { chooseDomainGesture, domainGestureSpan } from "../temporal-edit.js";
import { applyStudioMutation } from "./writeback.js";
export type Timeline = {
@@ -20,7 +17,7 @@ export type Timeline = {
};
const itemMetrics = {
- // Ordinary items fill their rows. Only the semantic lane owns compact word cells.
+ // Ordinary items fill their rows. Temporal-domain lanes may own compact cells.
insetYPx: 1,
headerPx: 15,
contentCellPx: 18,
@@ -31,7 +28,6 @@ const labelFont = '500 11px -apple-system, BlinkMacSystemFont, "SF Pro Text", "H
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}`;
@@ -147,7 +143,6 @@ export function createTimeline(store: Store): Timeline {
let built = -1;
let paintFrame = 0;
let rebuildFrame = 0;
- const readableWordLabels = new Set<string>();
let selectedWord: string | undefined;
let overlapMenu: HTMLElement | undefined;
const closeOverlapMenu = () => { overlapMenu?.remove(); overlapMenu = undefined; };
@@ -163,12 +158,15 @@ export function createTimeline(store: Store): Timeline {
readonly id: string;
readonly selectionGroup?: string;
}[] = [];
- let semanticNodes: readonly {
+ let domainNodes: readonly {
readonly node: HTMLElement;
+ readonly companion: string;
+ readonly domainId: string;
readonly id: string;
readonly start: number;
readonly end: number;
- readonly kind: "segment" | "word" | "selection" | "moment";
+ readonly kind: "span" | "point";
+ readonly appearance: "block" | "compact" | "marker";
}[] = [];
const playheadFraction = (): number => {
@@ -199,7 +197,7 @@ export function createTimeline(store: Store): Timeline {
const next = Math.abs(candidate - frame);
if (next < distance) { nearest = candidate; distance = next; }
};
- for (const anchor of state.snapshot.semantic?.anchors ?? []) consider(anchor.frame);
+ for (const anchor of state.snapshot.temporalDomains.flatMap((domain) => domain.anchors)) consider(anchor.frame);
for (const clip of state.snapshot.tracks.flatMap((track) => track.clips)) {
consider(clip.startFrame);
consider(clip.endFrameExclusive);
@@ -237,9 +235,14 @@ export function createTimeline(store: Store): Timeline {
readonly originalWidth: string;
} | undefined;
- const semanticTarget = (edit: NonNullable<typeof activeEdit>, nextFrame: number) =>
- state === undefined ? undefined : chooseSemanticGesture({
- anchors: state.snapshot.semantic?.anchors ?? [], handle: edit.handle,
+ const editDomain = (snapshot: StudioSnapshot, handle: StudioEditHandle) => handle.domain === undefined
+ ? undefined
+ : snapshot.temporalDomains.find((domain) => domain.companion === handle.domain!.companion
+ && domain.id === handle.domain!.domainId);
+
+ const domainTarget = (edit: NonNullable<typeof activeEdit>, nextFrame: number) =>
+ state === undefined ? undefined : chooseDomainGesture({
+ anchors: editDomain(state.snapshot, edit.handle)?.anchors ?? [], handle: edit.handle,
pointerStart: edit.startFrame, pointerNow: nextFrame, frameCount: state.snapshot.timeline.frameCount,
});
@@ -273,18 +276,18 @@ export function createTimeline(store: Store): Timeline {
nextFrame: number,
): { readonly startFrame: number; readonly endFrameExclusive: number } | undefined => {
if (state === undefined) return undefined;
- const target = semanticTarget(edit, nextFrame);
- if (target !== undefined) return semanticGestureSpan(state.snapshot.semantic?.anchors ?? [], edit.handle, target);
- if (edit.handle.semantic !== undefined) return undefined;
+ const target = domainTarget(edit, nextFrame);
+ if (target !== undefined) return domainGestureSpan(editDomain(state.snapshot, edit.handle)?.anchors ?? [], edit.handle, target);
+ if (edit.handle.domain !== undefined) return undefined;
return edit.handle.temporal === undefined ? undefined : absoluteWindowTarget(edit, nextFrame);
};
lanes.addEventListener("pointerdown", (event) => {
pointerDownOnItem = (event.target as HTMLElement).closest(
- ".clip, .semantic-segment, .semantic-word, .semantic-selection, .semantic-moment",
+ ".clip, .temporal-domain-block, .temporal-domain-compact, .temporal-domain-span, .temporal-domain-point",
) !== null;
pointerDownX = event.clientX;
pointerArmed = true;
- // Let semantic children receive their native click. Capturing every
+ // Let temporal-domain children receive their native click. Capturing every
// pointer here retargets the later click to `.lanes`, which made segment
// and selection buttons appear to be dead zones. Blank-space scrubbing
// still uses capture so it can continue outside the lane.
@@ -303,7 +306,7 @@ export function createTimeline(store: Store): Timeline {
hoverTime.textContent = state === undefined ? "" : frameTimecode(state.snapshot, frame);
hover.classList.add("visible");
if (activeEdit !== undefined && state !== undefined) {
- const nextFrame = activeEdit.handle.coordinate === "semantic-anchor"
+ const nextFrame = activeEdit.handle.coordinate === "domain-anchor"
? rawFrameAt(event.clientX)
: frameAt(event.clientX);
const preview = previewWindow(activeEdit, nextFrame);
@@ -330,37 +333,37 @@ export function createTimeline(store: Store): Timeline {
pointerArmed = false;
try { lanes.releasePointerCapture(event.pointerId); } catch { /* already released */ }
if (edit === undefined || state === undefined || event.type === "pointercancel") return;
- const nextFrame = edit.handle.coordinate === "semantic-anchor"
+ const nextFrame = edit.handle.coordinate === "domain-anchor"
? rawFrameAt(event.clientX)
: frameAt(event.clientX);
- const resolvedSemanticTarget = semanticTarget(edit, nextFrame);
+ const resolvedDomainTarget = domainTarget(edit, nextFrame);
const resolvedWindow = previewWindow(edit, nextFrame);
if (resolvedWindow === undefined || edit.handle.temporal === undefined) return;
const target = edit.handle.temporal.kind === "instant"
? {
kind: "instant" as const,
frame: resolvedWindow.startFrame,
- ...(resolvedSemanticTarget === undefined ? {} : { semantic: resolvedSemanticTarget }),
+ ...(resolvedDomainTarget === undefined ? {} : { domain: resolvedDomainTarget }),
}
: {
kind: "window" as const,
...resolvedWindow,
- ...(resolvedSemanticTarget === undefined ? {} : { semantic: resolvedSemanticTarget }),
+ ...(resolvedDomainTarget === undefined ? {} : { domain: resolvedDomainTarget }),
};
- if (resolvedSemanticTarget?.kind === "selection"
- && edit.handle.semantic?.kind === "selection"
- && resolvedSemanticTarget.startAnchorId === edit.handle.semantic.startAnchorId
- && resolvedSemanticTarget.endAnchorId === edit.handle.semantic.endAnchorId
+ if (resolvedDomainTarget?.kind === "span"
+ && edit.handle.domain?.kind === "span"
+ && resolvedDomainTarget.startAnchorId === edit.handle.domain.startAnchorId
+ && resolvedDomainTarget.endAnchorId === edit.handle.domain.endAnchorId
&& (target.kind === "instant"
? target.frame === edit.clip.startFrame
: target.startFrame === edit.clip.startFrame && target.endFrameExclusive === edit.clip.endFrameExclusive)) return;
- if (resolvedSemanticTarget?.kind === "moment"
- && edit.handle.semantic?.kind === "moment"
- && resolvedSemanticTarget.anchorId === edit.handle.semantic.anchorId
+ if (resolvedDomainTarget?.kind === "point"
+ && edit.handle.domain?.kind === "point"
+ && resolvedDomainTarget.anchorId === edit.handle.domain.anchorId
&& (target.kind === "instant"
? target.frame === edit.clip.startFrame
: target.startFrame === edit.clip.startFrame && target.endFrameExclusive === edit.clip.endFrameExclusive)) return;
- if (resolvedSemanticTarget === undefined
+ if (resolvedDomainTarget === undefined
&& (target.kind === "instant"
? target.frame === edit.clip.startFrame
: target.startFrame === edit.clip.startFrame && target.endFrameExclusive === edit.clip.endFrameExclusive)) return;
@@ -488,185 +491,87 @@ export function createTimeline(store: Store): Timeline {
&& (groupId === undefined || track.binding.groupId === groupId))
.sort((left, right) => (left.binding.lane.order ?? 0) - (right.binding.lane.order ?? 0));
- const buildSemanticLane = (snapshot: StudioSnapshot): void => {
- if (snapshot.semantic === undefined || snapshot.semantic.segments.length === 0) {
- return;
- }
- const presentation = snapshot.semantic.presentation;
- const bandHeight = Math.max(1, (presentation.lane.heightPx - itemMetrics.insetYPx * 2) / 3);
- const bands = [
- { kind: "segment", height: bandHeight },
- ...(snapshot.semantic.tokens.length > 0 ? [{ kind: "word", height: bandHeight }] : []),
- ...(snapshot.semantic.selections.length + snapshot.semantic.moments.length > 0
- ? [{ kind: "intent", height: bandHeight }] : []),
- ];
- const laneHeight = bands.reduce((height, band) => height + band.height, itemMetrics.insetYPx * 2);
- const label = createTrackLabel(
- presentation.label ?? "",
- presentation.tone,
- presentation.icon,
- "",
- laneHeight,
- );
- if (presentation.label === undefined) uiText(label.querySelector("strong")!, "inspector.timeline");
- uiAttr(label, "title", "timeline.segment-count", { count: snapshot.semantic.segments.length });
- label.classList.add("track-label-semantic");
+
+ const buildTemporalDomainLane = (
+ snapshot: StudioSnapshot,
+ domain: StudioSnapshot["temporalDomains"][number],
+ ): void => {
+ if (domain.items.length === 0 || domain.lanes.length === 0) return;
+ const laneHeight = domain.lanes.reduce((height, lane) => height + lane.heightPx, itemMetrics.insetYPx * 2);
+ const label = createTrackLabel(domain.presentation.label ?? domain.id, domain.presentation.tone,
+ domain.presentation.icon, "", laneHeight);
+ label.title = `${domain.items.length} temporal items`;
+ label.classList.add("track-label-temporal-domain");
label.style.height = `calc(var(--timeline-ruler-height) + ${laneHeight}px)`;
labels.append(label);
const lane = document.createElement("div");
- lane.className = `lane semantic-lane track-tone-${presentation.tone}`;
+ lane.className = `lane temporal-domain-lane track-tone-${domain.presentation.tone}`;
lane.style.height = `${laneHeight}px`;
- const laneWidth = lanes.clientWidth;
- const nextSemanticNodes: {
- node: HTMLElement;
- id: string;
- start: number;
- end: number;
- kind: "segment" | "word" | "selection" | "moment";
- }[] = [];
-
+ const bands = new Map<string, HTMLElement>();
let bandTop = itemMetrics.insetYPx;
- for (const { kind, height } of bands) {
+ for (const description of domain.lanes) {
const band = document.createElement("div");
- band.className = `semantic-band semantic-band-${kind}`;
+ band.className = "temporal-domain-band";
band.style.top = `${bandTop}px`;
- band.style.setProperty("--semantic-band-height", `${height}px`);
- uiAttr(band, "aria-label", kind === "intent" ? "timeline.selections-and-moments" : kind === "word" ? "timeline.words" : "timeline.segments");
+ band.style.setProperty("--temporal-domain-band-height", `${description.heightPx}px`);
+ band.setAttribute("aria-label", description.label ?? description.id);
+ bands.set(description.id, band);
lane.append(band);
- bandTop += height;
- }
- const segmentBand = lane.querySelector<HTMLElement>(".semantic-band-segment")!;
- const wordBand = lane.querySelector<HTMLElement>(".semantic-band-word")!;
- const intentBand = lane.querySelector<HTMLElement>(".semantic-band-intent")!;
-
- for (const segment of snapshot.semantic.segments) {
- const from = place(segment.startFrame, snapshot.timeline.frameCount, zoom.window());
- const to = place(segment.endFrameExclusive, snapshot.timeline.frameCount, zoom.window());
- if (to <= 0 || from >= 1) continue;
- const node = document.createElement("button");
- node.type = "button";
- node.className = "semantic-cell semantic-segment";
- node.tabIndex = 0;
- node.setAttribute("role", "button");
- uiAttr(node, "aria-label", "timeline.segment-name", { name: segment.id });
- node.dataset.semanticSegment = segment.id;
- node.style.left = `${from * 100}%`;
- const segmentWidth = Math.max(0, to - from) * 100;
- node.style.width = `max(2px, ${segmentWidth}%)`;
- node.title = segment.id;
- const segmentLabel = document.createElement("span");
- segmentLabel.className = "semantic-segment-label";
- segmentLabel.textContent = segment.id;
- const head = document.createElement("div");
- head.className = "semantic-cell-content";
- head.append(segmentLabel);
- node.append(head);
- node.addEventListener("click", (event) => {
- event.stopPropagation();
- if ((event.target as Element).closest(".semantic-word") !== null) return;
- store.selectSemanticSegment(segment.id, "timeline");
- store.seek(segment.startFrame, "timeline");
- });
- node.addEventListener("dblclick", (event) => {
- event.stopPropagation();
- zoom.focus(
- segment.startFrame / Math.max(1, snapshot.timeline.frameCount),
- segment.endFrameExclusive / Math.max(1, snapshot.timeline.frameCount),
- );
- });
- node.addEventListener("keydown", (event) => {
- if (event.key !== "Enter" && event.key !== " ") return;
- event.preventDefault();
- store.selectSemanticSegment(segment.id, "timeline");
- });
- nextSemanticNodes.push({ node, id: segment.id, start: segment.startFrame, end: segment.endFrameExclusive, kind: "segment" });
- segmentBand.append(node);
+ bandTop += description.heightPx;
}
- for (const token of snapshot.semantic.tokens) {
- const wordFrom = place(token.startFrame, snapshot.timeline.frameCount, zoom.window());
- const wordTo = place(token.endFrameExclusive, snapshot.timeline.frameCount, zoom.window());
- if (wordTo <= 0 || wordFrom >= 1) continue;
- const word = document.createElement("span");
- word.className = "semantic-cell semantic-word";
- word.dataset.semanticToken = token.id;
- word.setAttribute("aria-label", token.text);
- word.style.left = `${wordFrom * 100}%`;
- const wordWidth = Math.max(0, wordTo - wordFrom);
- word.style.width = `max(1px, ${wordWidth * 100}%)`;
- word.title = token.text;
- const text = document.createElement("span");
- text.className = "semantic-word-label";
- text.textContent = token.text;
- const wordWidthPx = Math.max(1, wordWidth * laneWidth);
- 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);
- word.append(wordContent);
- word.addEventListener("click", (event) => {
- event.stopPropagation();
- store.clearSelection();
- selectedWord = token.id;
- store.seek(token.startFrame, "timeline");
- });
- nextSemanticNodes.push({ node: word, id: token.id, start: token.startFrame, end: token.endFrameExclusive, kind: "word" });
- wordBand.append(word);
- }
- for (const selection of snapshot.semantic.selections) {
- const from = place(selection.startFrame, snapshot.timeline.frameCount, zoom.window());
- const to = place(selection.endFrameExclusive, snapshot.timeline.frameCount, zoom.window());
+ const nextNodes: typeof domainNodes[number][] = [];
+ for (const item of domain.items) {
+ const band = bands.get(item.laneId);
+ if (band === undefined) continue;
+ const start = item.kind === "point" ? item.frame : item.startFrame;
+ const end = item.kind === "point" ? item.frame + 1 : item.endFrameExclusive;
+ const from = place(start, snapshot.timeline.frameCount, zoom.window());
+ const to = place(end, snapshot.timeline.frameCount, zoom.window());
if (to <= 0 || from >= 1) continue;
- const node = document.createElement("button");
- node.type = "button";
- node.className = "semantic-cell semantic-selection";
- node.tabIndex = 0;
- uiAttr(node, "aria-label", "timeline.selection-name", { name: selection.id });
+ const node = item.appearance === "compact" ? document.createElement("span") : document.createElement("button");
+ if (node instanceof HTMLButtonElement) node.type = "button";
+ node.className = item.kind === "point" ? "temporal-domain-point"
+ : item.appearance === "compact" ? "temporal-domain-cell temporal-domain-compact"
+ : "temporal-domain-cell temporal-domain-span";
node.style.left = `${from * 100}%`;
- node.style.width = `max(2px, ${Math.max(0, to - from) * 100}%)`;
- node.title = selection.id;
- const selectionLabel = document.createElement("span");
- selectionLabel.className = "semantic-selection-label";
- selectionLabel.textContent = selection.id;
- const selectionContent = document.createElement("div");
- selectionContent.className = "semantic-cell-content";
- selectionContent.append(selectionLabel);
- node.append(selectionContent);
+ if (item.kind === "span") node.style.width = `max(${item.appearance === "compact" ? 1 : 2}px, ${Math.max(0, to - from) * 100}%)`;
+ node.title = item.label;
+ node.setAttribute("aria-label", item.label);
+ if (item.kind === "span") {
+ const content = document.createElement("span");
+ content.className = "temporal-domain-cell-content";
+ const text = document.createElement("span");
+ text.className = item.appearance === "compact" ? "temporal-domain-compact-label" : "temporal-domain-span-label";
+ text.textContent = item.label;
+ content.append(text);
+ node.append(content);
+ if (item.appearance === "compact") {
+ const widthPx = Math.max(1, (to - from) * lanes.clientWidth);
+ node.classList.toggle("word-label-visible", widthPx - wordLabelPaddingPx * 2 >= measuredText(item.label));
+ }
+ }
node.addEventListener("click", (event) => {
event.stopPropagation();
- store.selectSemanticSelection(selection.id, "timeline");
- store.seek(selection.startFrame, "timeline");
+ if (item.appearance === "compact") {
+ store.clearSelection();
+ selectedWord = `${domain.companion}:${domain.id}:${item.id}`;
+ } else {
+ store.selectTemporalDomainItem(domain.companion, domain.id, item.id, "timeline");
+ }
+ store.seek(start, "timeline");
});
- intentBand.append(node);
- nextSemanticNodes.push({ node, id: selection.id, start: selection.startFrame, end: selection.endFrameExclusive, kind: "selection" });
- }
- for (const moment of snapshot.semantic.moments) {
- const at = place(moment.frame, snapshot.timeline.frameCount, zoom.window());
- if (at < 0 || at > 1) continue;
- const node = document.createElement("button");
- node.type = "button";
- node.className = "semantic-moment";
- node.tabIndex = 0;
- uiAttr(node, "aria-label", "timeline.moment-name", { name: moment.id });
- node.style.left = `${at * 100}%`;
- node.title = moment.id;
- node.addEventListener("click", (event) => {
+ if (item.kind === "span" && item.appearance !== "compact") node.addEventListener("dblclick", (event) => {
event.stopPropagation();
- store.selectSemanticMoment(moment.id, "timeline");
+ zoom.focus(item.startFrame / Math.max(1, snapshot.timeline.frameCount),
+ item.endFrameExclusive / Math.max(1, snapshot.timeline.frameCount));
});
- intentBand.append(node);
- nextSemanticNodes.push({ node, id: moment.id, start: moment.frame, end: moment.frame + 1, kind: "moment" });
+ band.append(node);
+ nextNodes.push({ node, companion: domain.companion, domainId: domain.id, id: item.id,
+ start, end, kind: item.kind, appearance: item.appearance });
}
- lane.addEventListener("contextmenu", event => {
- const hits = nextSemanticNodes.filter(({ node }) => {
+ lane.addEventListener("contextmenu", (event) => {
+ const hits = nextNodes.filter(({ node }) => {
const rect = node.getBoundingClientRect();
return event.clientX >= rect.left && event.clientX < rect.right
&& event.clientY >= rect.top && event.clientY < rect.bottom;
@@ -693,7 +598,7 @@ export function createTimeline(store: Store): Timeline {
menu.querySelector("button")?.focus();
});
rows.append(lane);
- semanticNodes = nextSemanticNodes;
+ domainNodes = [...domainNodes, ...nextNodes];
};
const buildTrack = (
@@ -800,7 +705,7 @@ export function createTimeline(store: Store): Timeline {
if (handle !== undefined
&& (handle.gesture === "move" || handle.gesture === "trim-start" || handle.gesture === "trim-end")) {
event.stopPropagation();
- const pointerFrame = handle.coordinate === "semantic-anchor"
+ const pointerFrame = handle.coordinate === "domain-anchor"
? rawFrameAt(event.clientX)
: frameAt(event.clientX);
activeEdit = {
@@ -835,12 +740,12 @@ export function createTimeline(store: Store): Timeline {
const scrollTop = body.scrollTop;
labels.replaceChildren();
rows.replaceChildren();
- semanticNodes = [];
+ domainNodes = [];
const corner = document.createElement("div");
corner.className = "label-corner";
userText(corner, "");
- if (snapshot.semantic === undefined || snapshot.semantic.segments.length === 0) labels.append(corner);
- buildSemanticLane(snapshot);
+ if (snapshot.temporalDomains.every((domain) => domain.items.length === 0)) labels.append(corner);
+ for (const domain of snapshot.temporalDomains) buildTemporalDomainLane(snapshot, domain);
const nextClipNodes: { node: HTMLElement; start: number; end: number; id: string; selectionGroup?: string }[] = [];
for (const track of snapshot.tracks) {
const attachedTo = track.binding.lane.attachedTo;
@@ -880,20 +785,16 @@ export function createTimeline(store: Store): Timeline {
item.node.setAttribute("aria-pressed", String(selected));
item.node.classList.toggle("live", head.frame >= item.start && head.frame < item.end);
}
- for (const item of semanticNodes) {
- item.node.classList.toggle("live",
- (item.kind === "segment" || item.kind === "selection")
- && head.frame >= item.start && head.frame < item.end);
- item.node.classList.toggle("current", item.kind === "word" && head.frame >= item.start && head.frame < item.end);
- const selected = (item.kind === "word" && selectedWord === item.id && selection.kind === "none")
- || (item.kind === "segment"
- && selection.kind === "semantic-segment" && selection.segmentId === item.id)
- || (item.kind === "selection"
- && selection.kind === "semantic-selection" && selection.selectionId === item.id)
- || (item.kind === "moment"
- && selection.kind === "semantic-moment" && selection.momentId === item.id);
+ for (const item of domainNodes) {
+ const inside = item.kind === "span" && head.frame >= item.start && head.frame < item.end;
+ item.node.classList.toggle("live", inside && item.appearance !== "compact");
+ item.node.classList.toggle("current", inside && item.appearance === "compact");
+ const identity = `${item.companion}:${item.domainId}:${item.id}`;
+ const selected = (item.appearance === "compact" && selectedWord === identity && selection.kind === "none")
+ || (selection.kind === "temporal-domain" && selection.companion === item.companion
+ && selection.domainId === item.domainId && selection.itemId === item.id);
item.node.classList.toggle("selected", selected);
- if (item.kind !== "word") item.node.setAttribute("aria-pressed", String(selected));
+ if (item.appearance !== "compact") item.node.setAttribute("aria-pressed", String(selected));
}
};
diff --git a/packages/studio/test/parameters.test.ts b/packages/studio/test/parameters.test.ts
index 40bdf188..1610c9d5 100644
--- a/packages/studio/test/parameters.test.ts
+++ b/packages/studio/test/parameters.test.ts
@@ -3,7 +3,7 @@ import test from "node:test";
import type {
StudioPlacement,
- StudioSemanticTimeline,
+ StudioTemporalDomainView,
StudioTemporalLineage,
} from "@hypit/studio-adapter";
import type { MarkupSurfaceRegistryLike, RegisteredSurface } from "@hypit/markup";
@@ -13,36 +13,37 @@ import { serializeParameterValue, validateParameterValue } from "../src/paramete
const temporalIdentity = { timelineId: "speech", narrativeId: "story" } as const;
const narrativeSourceIdentity = { ...temporalIdentity,
+ domain: { companion: "script", id: "story" },
type: { module: { name: "@hypit/narrative", version: "1" }, name: "NarrativeReference" } } as const;
const timelineSourceType = { module: { name: "@hypit/timeline", version: "1" }, name: "Timeline" } as const;
-const semantic: StudioSemanticTimeline = {
- ...temporalIdentity,
- presentation: {
- family: "speech",
- tone: "teal",
- icon: "timeline",
- lane: { heightPx: 52 },
- },
+const temporalDomain: StudioTemporalDomainView = {
+ id: "story", companion: "script", timelineId: "speech",
+ presentation: { family: "speech", tone: "teal", icon: "timeline" },
+ lanes: [{ id: "intent", heightPx: 26 }],
anchors: [
- { id: "segment:a:start", kind: "segment-start", frame: 0, segmentId: "a" },
- { id: "segment:a:token:1:start", kind: "token-start", frame: 0, segmentId: "a", tokenId: "segment:a:token:1" },
- { id: "segment:a:token:1:end", kind: "token-end", frame: 12, segmentId: "a", tokenId: "segment:a:token:1" },
- { id: "segment:a:end", kind: "segment-end", frame: 12, segmentId: "a" },
+ { id: "segment:a:start", kind: "segment-start", frame: 0 },
+ { id: "segment:a:token:1:start", kind: "token-start", frame: 0 },
+ { id: "segment:a:token:1:end", kind: "token-end", frame: 12 },
+ { id: "segment:a:end", kind: "segment-end", frame: 12 },
],
- segments: [{ id: "a", startFrame: 0, endFrameExclusive: 12 }],
- tokens: [{ id: "segment:a:token:1", segmentId: "a", text: "hello", startFrame: 0, endFrameExclusive: 12 }],
- selections: [{
- id: "claim",
+ items: [{ kind: "span", appearance: "block", id: "claim", laneId: "intent", label: "claim",
+ source: { type: narrativeSourceIdentity.type, kind: "selection", id: "claim" }, editable: true,
startAnchorId: "segment:a:token:1:start",
endAnchorId: "segment:a:token:1:end",
startFrame: 0,
endFrameExclusive: 12,
}],
- moments: [],
provenance: { output: "speech", origin: "run", status: "resolved", errors: [] },
+ source: { path: "main.svml", content: { start: 0, end: 100 } },
};
+const withMoment: StudioTemporalDomainView = { ...temporalDomain, items: [...temporalDomain.items, {
+ kind: "point", appearance: "marker", id: "beat", laneId: "intent", label: "beat",
+ source: { type: narrativeSourceIdentity.type, kind: "moment", id: "beat" }, editable: true,
+ anchorId: "segment:a:token:1:end", frame: 12,
+}] };
+
test("structured parameter values validate and serialize through the generic SVS path", () => {
const schema = { kind: "array", minItems: 1, items: { kind: "string", format: "color" } } as const;
assert.doesNotThrow(() => validateParameterValue(["#FF3F56", "#FFA72D"], schema, "Colors"));
@@ -69,17 +70,15 @@ test("timeline gestures resolve through the shared Selection identity", () => {
},
phases: [],
};
- const handles = resolveTimelineEditHandles([], temporal, semantic);
+ const handles = resolveTimelineEditHandles([], temporal, [temporalDomain]);
assert.deepEqual(handles.map((handle) => [handle.operation, handle.gesture, handle.coordinate, handle.enabled]), [
- ["timeline.adjust", "move", "semantic-anchor", true],
- ["timeline.adjust", "trim-start", "semantic-anchor", true],
- ["timeline.adjust", "trim-end", "semantic-anchor", true],
+ ["timeline.adjust", "move", "domain-anchor", true],
+ ["timeline.adjust", "trim-start", "domain-anchor", true],
+ ["timeline.adjust", "trim-end", "domain-anchor", true],
]);
- assert.deepEqual(handles.map((handle) => handle.semantic), Array.from({ length: 3 }, () => ({
- kind: "selection",
- narrativeId: "story",
- id: "claim",
+ assert.deepEqual(handles.map((handle) => handle.domain), Array.from({ length: 3 }, () => ({
+ kind: "span", companion: "script", domainId: "story", itemId: "claim",
startAnchorId: "segment:a:token:1:start",
endAnchorId: "segment:a:token:1:end",
})));
@@ -93,16 +92,11 @@ test("moving a Moment projection resolves to the shared Moment identity", () =>
authority: { kind: "domain", source: { ...narrativeSourceIdentity, kind: "moment", id: "beat" }, boundary: "cue" },
},
phases: [],
- }, {
- ...semantic,
- moments: [{ id: "beat", anchorId: "segment:a:token:1:end", frame: 12 }],
- });
+ }, [withMoment]);
assert.deepEqual(handles.map((handle) => [handle.gesture, handle.enabled]), [["move", true]]);
- assert.deepEqual(handles[0]!.semantic, {
- kind: "moment",
- narrativeId: "story",
- id: "beat",
+ assert.deepEqual(handles[0]!.domain, {
+ kind: "point", companion: "script", domainId: "story", itemId: "beat",
anchorId: "segment:a:token:1:end",
});
});
@@ -112,10 +106,6 @@ test("at/for and until/for derive complementary semantic and duration inverses",
id: "for", binding: "for", name: "for", value: "8f", language: "svml" as const, writable: true,
source: { endpoint: "main::for", path: "main.svml", range: { start: 4, end: 6 }, preimage: "8f" },
};
- const withMoment = {
- ...semantic,
- moments: [{ id: "beat", anchorId: "segment:a:token:1:end", frame: 12 }],
- };
const moment = {
kind: "instant" as const, expression: "moment.cue", reference: "moment.cue" as const, frame: 12,
source: { ...narrativeSourceIdentity, kind: "moment" as const, id: "beat" },
@@ -133,17 +123,17 @@ test("at/for and until/for derive complementary semantic and duration inverses",
};
const atFor = resolveTimelineEditHandles([duration], {
projection: { kind: "window", start: moment, end: after, startFrame: 12, endFrameExclusive: 20 }, phases: [],
- }, withMoment);
- assert.deepEqual(atFor.map((handle) => [handle.gesture, handle.semantic?.kind, handle.sources?.map((source) => source.role)]), [
- ["move", "moment", undefined],
+ }, [withMoment]);
+ assert.deepEqual(atFor.map((handle) => [handle.gesture, handle.domain?.kind, handle.sources?.map((source) => source.role)]), [
+ ["move", "point", undefined],
["trim-end", undefined, ["duration"]],
]);
const untilFor = resolveTimelineEditHandles([duration], {
projection: { kind: "window", start: before, end: moment, startFrame: 4, endFrameExclusive: 12 }, phases: [],
- }, withMoment);
- assert.deepEqual(untilFor.map((handle) => [handle.gesture, handle.semantic?.kind, handle.sources?.map((source) => source.role)]), [
- ["move", "moment", undefined],
+ }, [withMoment]);
+ assert.deepEqual(untilFor.map((handle) => [handle.gesture, handle.domain?.kind, handle.sources?.map((source) => source.role)]), [
+ ["move", "point", undefined],
["trim-start", undefined, ["duration"]],
]);
});
@@ -212,11 +202,11 @@ test("independent reference endpoints expose local edits without claiming their
}));
const handles = resolveTimelineEditHandles(bindings, { projection: {
kind: "window", start: endpoints[0]!, end: endpoints[1]!, startFrame: 2, endFrameExclusive: 20,
- }, phases: [] }, semantic);
- assert.deepEqual(handles.map(({ gesture, enabled, semantic, sources }) => ({ gesture, enabled, semantic, roles: sources?.map(source => source.role) })), [
- { gesture: "move", enabled: true, semantic: undefined, roles: ["start", "end"] },
- { gesture: "trim-start", enabled: true, semantic: undefined, roles: ["start"] },
- { gesture: "trim-end", enabled: true, semantic: undefined, roles: ["end"] },
+ }, phases: [] }, [temporalDomain]);
+ assert.deepEqual(handles.map(({ gesture, enabled, domain, sources }) => ({ gesture, enabled, domain, roles: sources?.map(source => source.role) })), [
+ { gesture: "move", enabled: true, domain: undefined, roles: ["start", "end"] },
+ { gesture: "trim-start", enabled: true, domain: undefined, roles: ["start"] },
+ { gesture: "trim-end", enabled: true, domain: undefined, roles: ["end"] },
]);
});
diff --git a/packages/studio/test/preflight.test.ts b/packages/studio/test/preflight.test.ts
index 1c7fee18..3959b7e4 100644
--- a/packages/studio/test/preflight.test.ts
+++ b/packages/studio/test/preflight.test.ts
@@ -14,7 +14,7 @@ const filmModule = { name: "@example/film", version: "1" } as const;
const companion: StudioFilmCompanion = {
id: "film",
match: { module: filmModule, surface: "film", outputType: compositionTypes.composition },
- timeSources: [{ attribute: "semantic", type: timelineTypes.track }, { attribute: "space", type: timelineTypes.track }],
+ timeSources: [{ attribute: "semantic", type: timelineTypes.timeline }, { attribute: "space", type: timelineTypes.timeline }],
tracks: { childSurface: "Track", sourceAttribute: "source", types: [compositionTypes.visualTrack] },
};
@@ -28,7 +28,7 @@ function placement(id: string): StudioPlacement {
test("Studio rejects a Run that reaches two distinct Film compositions", () => {
const source = {
- observations: { placements: [placement("one"), placement("two")], sourceMaps: [] },
+ observations: { placements: [placement("one"), placement("two")], temporalDomains: [] },
served: new Map(),
exports: ["one", "two"].map((id) => ({
name: `${id}.composition`, ref: `${id}.composition`, type: "Composition", typeRef: compositionTypes.composition,
diff --git a/packages/studio/test/provenance.test.ts b/packages/studio/test/provenance.test.ts
index d4396889..925ccfa7 100644
--- a/packages/studio/test/provenance.test.ts
+++ b/packages/studio/test/provenance.test.ts
@@ -56,7 +56,7 @@ test("Studio joins repeated local names through compiler-owned provenance", asyn
} as unknown as NodeCompiledSourceClosure;
const source = await observedCompiledSource(compiled, {
placements: [placement("a.svml"), placement("b.svml")],
- sourceMaps: [],
+ temporalDomains: [],
});
assert.equal(outputFor(source, "b::output::visual")?.ref, "b::output::visual");
assert.equal(placementFor(source, "b::output::visual")?.sourcePath, "b.svml");
diff --git a/packages/studio/test/registry.test.ts b/packages/studio/test/registry.test.ts
index 982be984..9ad038dd 100644
--- a/packages/studio/test/registry.test.ts
+++ b/packages/studio/test/registry.test.ts
@@ -40,7 +40,7 @@ test("internal bands keep entities in their Track and own their Inspector bindin
assert.deepEqual(registry.bindTrack(track).bands, [{ id: "rules", placement: "after", heightPx: 15, display: "label" }]);
assert.deepEqual(registry.bindingDeclarations(track, undefined, undefined, "rules"), [{ name: "style" }]);
assert.equal(registry.inspectorDeclarations(track, undefined, undefined, "rules")[0]?.label, "Style");
- const context = { track, values: new Map(), spans: [], temporalBindings: [], semantic: undefined, generic: () => [] };
+ const context = { track, values: new Map(), spans: [], temporalBindings: [], temporalDomains: [], generic: () => [] };
const [draft] = registry.projectTrack(context);
assert.equal(draft?.lane, undefined);
assert.equal(draft?.band, "rules");
diff --git a/packages/studio/test/semantic-gesture.test.ts b/packages/studio/test/semantic-gesture.test.ts
index 37192b08..58d099c4 100644
--- a/packages/studio/test/semantic-gesture.test.ts
+++ b/packages/studio/test/semantic-gesture.test.ts
@@ -1,60 +1,64 @@
import assert from "node:assert/strict";
import test from "node:test";
-import type { StudioEditHandle, StudioSemanticAnchor, StudioTemporalInstantProjection } from "@hypit/studio-adapter";
+import type { StudioEditHandle, StudioTemporalDomainAnchor, StudioTemporalInstantProjection } from "@hypit/studio-adapter";
import { adjustScriptSelection, parseScript } from "@hypit/script";
import { projectProgramInstant } from "@hypit/temporal";
import { parseTemporalInstant } from "@hypit/temporal-markup";
-import { chooseSemanticGesture, formatTemporalPointEdit, semanticGestureSpan } from "../src/temporal-edit.js";
+import { chooseDomainGesture, formatTemporalPointEdit, domainGestureSpan } from "../src/temporal-edit.js";
const source = '<one><HOST>@{proof} One two @{/proof} three.</one>';
const narrative = parseScript("gesture", source);
// Duplicate word/Segment boundaries count as one stop, not additional movement steps.
const frames = [0, 0, 5, 10, 20, 40, 55, 55];
-const anchors: readonly StudioSemanticAnchor[] = narrative.semanticIndex.anchors.map((anchor, index) => ({ ...anchor, frame: frames[index]! }));
+const anchors: readonly StudioTemporalDomainAnchor[] = narrative.anchors.map((anchor, index) => ({ ...anchor, frame: frames[index]! }));
const selection = narrative.selections[0]!;
const narrativeType = { module: { name: "@hypit/narrative", version: "1" }, name: "NarrativeReference" } as const;
-const temporalSource = { kind: "selection", id: "proof", narrativeId: "story", timelineId: "film", type: narrativeType } as const;
+const domainIdentity = { companion: "script", id: "story" } as const;
+const temporalSource = { kind: "selection", id: "proof", narrativeId: "story", timelineId: "film", type: narrativeType, domain: domainIdentity } as const;
const endpoint = (boundary: "start" | "end", frame: number): StudioTemporalInstantProjection => ({
kind: "instant", expression: `selection.${boundary}`, reference: `selection.${boundary}`, source: temporalSource, frame,
authority: { kind: "domain", source: temporalSource, boundary },
});
const handle: StudioEditHandle = {
id: "move", operation: "timeline.adjust", gesture: "move", enabled: true,
- semantic: { kind: "selection", id: "proof", narrativeId: "story", startAnchorId: selection.startAnchorId, endAnchorId: selection.endAnchorId },
+ domain: { kind: "span", companion: "script", domainId: "story", itemId: "proof",
+ startAnchorId: selection.startAnchorId, endAnchorId: selection.endAnchorId },
temporal: { kind: "window", start: endpoint("start", 0), end: endpoint("end", 20), startFrame: 0, endFrameExclusive: 20 },
};
-const choose = (h: StudioEditHandle, from: number, to: number, list = anchors) => chooseSemanticGesture({
+const choose = (h: StudioEditHandle, from: number, to: number, list = anchors) => chooseDomainGesture({
anchors: list, handle: h, pointerStart: from, pointerNow: to, frameCount: 100,
});
test("Selection move advances both ends one stop, changes duration, and writes back through Script", () => {
const target = choose(handle, 0, 5)!;
- assert.equal(target.kind, "selection");
- if (target.kind !== "selection") return;
- assert.deepEqual(semanticGestureSpan(anchors, handle, target), { startFrame: 5, endFrameExclusive: 40 });
+ assert.equal(target.kind, "span");
+ if (target.kind !== "span") return;
+ assert.deepEqual(domainGestureSpan(anchors, handle, target), { startFrame: 5, endFrameExclusive: 40 });
const rewritten = adjustScriptSelection({ sourceName: "gesture", source, parsed: narrative, adjustment: { id: "proof", ...target } });
const next = parseScript("gesture", rewritten).selections[0]!;
assert.equal(next.startAnchorId, target.startAnchorId);
assert.equal(next.endAnchorId, target.endAnchorId);
- const moved: StudioEditHandle = { ...handle, semantic: { ...handle.semantic!, ...target }, temporal: {
+ const moved: StudioEditHandle = { ...handle, domain: target, temporal: {
kind: "window", start: endpoint("start", 5), end: endpoint("end", 40), startFrame: 5, endFrameExclusive: 40,
} };
const back = choose(moved, 5, 0)!;
- assert.deepEqual(semanticGestureSpan(anchors, moved, back), { startFrame: 0, endFrameExclusive: 20 });
+ assert.deepEqual(domainGestureSpan(anchors, moved, back), { startFrame: 0, endFrameExclusive: 20 });
});
test("coincident anchors preserve the current identity without preferring starts to ends", () => {
- assert.deepEqual(choose(handle, 0, 0), { kind: "selection", startAnchorId: selection.startAnchorId, endAnchorId: selection.endAnchorId });
+ assert.deepEqual(choose(handle, 0, 0), { kind: "span", companion: "script", domainId: "story", itemId: "proof",
+ startAnchorId: selection.startAnchorId, endAnchorId: selection.endAnchorId });
const point: StudioEditHandle = { ...handle, temporal: endpoint("end", 20) };
- assert.equal(choose(point, 20, 40)?.kind, "selection");
+ assert.equal(choose(point, 20, 40)?.kind, "span");
});
test("a directly selected boundary remains editable even when the raw range reverses in time", () => {
const overlapping = anchors.map((anchor) => anchor.id === selection.startAnchorId ? { ...anchor, frame: 30 } : anchor);
const point: StudioEditHandle = { ...handle, temporal: endpoint("start", 30) };
- const unchanged = { kind: "selection", startAnchorId: selection.startAnchorId, endAnchorId: selection.endAnchorId } as const;
- assert.deepEqual(semanticGestureSpan(overlapping, point, unchanged), { startFrame: 30, endFrameExclusive: 31 });
- assert.equal(semanticGestureSpan(overlapping, handle, unchanged), undefined);
+ const unchanged = { kind: "span", companion: "script", domainId: "story", itemId: "proof",
+ startAnchorId: selection.startAnchorId, endAnchorId: selection.endAnchorId } as const;
+ assert.deepEqual(domainGestureSpan(overlapping, point, unchanged), { startFrame: 30, endFrameExclusive: 31 });
+ assert.equal(domainGestureSpan(overlapping, handle, unchanged), undefined);
assert.ok(choose(point, 30, 40, overlapping));
});
@@ -62,12 +66,13 @@ test("dragging a bound Moment keeps an event-and-duration Window intact", () =>
const momentSource = { ...temporalSource, kind: "moment", id: "beat" } as const;
const moment: StudioTemporalInstantProjection = { kind: "instant", frame: 20, expression: "moment.cue", reference: "moment.cue", source: momentSource,
authority: { kind: "domain", source: momentSource, boundary: "cue" } };
- const timed: StudioEditHandle = { ...handle, semantic: { kind: "moment", id: "beat", narrativeId: "story", anchorId: selection.endAnchorId }, temporal: {
+ const timed: StudioEditHandle = { ...handle, domain: { kind: "point", companion: "script", domainId: "story",
+ itemId: "beat", anchorId: selection.endAnchorId }, temporal: {
kind: "window", start: moment, end: { ...moment, frame: 28, authority: { kind: "parameter", binding: "for", relation: "after-start" } },
startFrame: 20, endFrameExclusive: 28,
} };
const target = choose(timed, 20, 40)!;
- assert.deepEqual(semanticGestureSpan(anchors, timed, target), { startFrame: 40, endFrameExclusive: 48 });
+ assert.deepEqual(domainGestureSpan(anchors, timed, target), { startFrame: 40, endFrameExclusive: 48 });
});
diff --git a/packages/studio/test/snapshot-range.test.ts b/packages/studio/test/snapshot-range.test.ts
index 1d34e2fc..51eb176a 100644
--- a/packages/studio/test/snapshot-range.test.ts
+++ b/packages/studio/test/snapshot-range.test.ts
@@ -7,7 +7,7 @@ import { StudioCompanionRegistry } from "../src/studio-registry.js";
import { fallbackStudioTrackCompanions } from "../src/fallback-companions.js";
test("a pure-MG work keeps its declared extent even when an editor entity extends beyond it", () => {
- const built = { source: { observations: { placements: [], sourceMaps: [] } },
+ const built = { source: { observations: { placements: [], temporalDomains: [] } },
tracks: [{ outputRef: "art.visual", name: "art.visual", typeRef: compositionTypes.visualTrack,
trace: { outputPorts: [], references: [] }, candidateOrigin: "source", value: { presents: [{ id: "scene", order: 0, z: 0, span: { startFrame: 0, endFrameExclusive: 150 } }] } }],
timeline: { id: "work", frameCount: 90, frameRate: { numerator: 30, denominator: 1 } },
@@ -20,6 +20,6 @@ test("a pure-MG work keeps its declared extent even when an editor entity extend
});
assert.equal(result.timeline.frameCount, 90); assert.equal(result.timeline.durationSec, 3);
assert.equal(result.tracks[0]!.clips[0]!.endFrameExclusive, 150);
- assert.equal(result.semantic, undefined);
+ assert.deepEqual(result.temporalDomains, []);
assert.equal("timing" in result.provenance, false);
});
diff --git a/packages/studio/test/temporal-graph.test.ts b/packages/studio/test/temporal-graph.test.ts
index 952e72d8..ae6ee524 100644
--- a/packages/studio/test/temporal-graph.test.ts
+++ b/packages/studio/test/temporal-graph.test.ts
@@ -60,8 +60,8 @@ test("Studio reads Instant lineage and author authority from executed graph edge
id: "deck.card::cue",
projection: {
kind: "instant", expression: "moment.cue", reference: "moment.cue", frame: 42,
- source: { timelineId: "speech", narrativeId: "story", type: type("@hypit/narrative", "NarrativeMoment"), kind: "moment", id: "cue" },
- authority: { kind: "domain", source: { timelineId: "speech", narrativeId: "story", type: type("@hypit/narrative", "NarrativeMoment"), kind: "moment", id: "cue" }, boundary: "cue" },
+ source: { timelineId: "speech", type: type("@hypit/narrative", "NarrativeMoment"), kind: "moment", id: "cue" },
+ authority: { kind: "domain", source: { timelineId: "speech", type: type("@hypit/narrative", "NarrativeMoment"), kind: "moment", id: "cue" }, boundary: "cue" },
},
consumers: [{
step: "append",
diff --git a/packages/temporal-markup/src/context.ts b/packages/temporal-markup/src/context.ts
index 06d40029..5c664bd7 100644
--- a/packages/temporal-markup/src/context.ts
+++ b/packages/temporal-markup/src/context.ts
@@ -5,7 +5,7 @@ import { timelineTypes } from "@hypit/timeline";
export type TemporalContext = { readonly timeline: SurfaceResolvedReference };
export const temporalContextAttributeVocabulary = [
- { name: "timeline", kind: "reference", required: true, accepts: [timelineTypes.track],
+ { name: "timeline", kind: "reference", required: true, accepts: [timelineTypes.timeline],
summary: "The complete absolute film Timeline." },
] as const satisfies readonly SurfaceAttributeVocabulary[];
@@ -16,7 +16,7 @@ export function resolveTemporalContext(input: {
const raw = input.element.attributes.timeline;
if (typeof raw !== "object" || raw.kind !== "reference") throw new Error(`${input.element.name}.timeline must be a reference.`);
const found = input.resolveReference(raw.path);
- if (found === undefined || !sameType(found.type, timelineTypes.track)) {
+ if (found === undefined || !sameType(found.type, timelineTypes.timeline)) {
throw new Error(`${input.element.name}.timeline must reference a Timeline.`);
}
return { timeline: found };
diff --git a/packages/temporal-markup/src/index.ts b/packages/temporal-markup/src/index.ts
index 9353668d..a43d881d 100644
--- a/packages/temporal-markup/src/index.ts
+++ b/packages/temporal-markup/src/index.ts
@@ -125,7 +125,7 @@ function constructWindow(value: {
readonly extent?: ExtentDraft; readonly direction?: 1 | -1;
}): TemporalMarkupConstruction {
const ports: Array<{ readonly name: string; readonly type: TypeRef }> = [
- { name: "timeline", type: timelineTypes.track }, { name: "window-spec", type: temporalTypes.windowSpec },
+ { name: "timeline", type: timelineTypes.timeline }, { name: "window-spec", type: temporalTypes.windowSpec },
];
const bindings: Record<string, SurfaceResolvedReference["ref"] | { kind: "record"; id: string }> = {
timeline: value.timeline.ref, "window-spec": { kind: "record", id: `${value.id}.__temporal.window` },
@@ -254,7 +254,7 @@ export function createTemporalInstantConstruction(value: {
}
const specId = `${value.id}.__temporal.instant`;
const fragment = sealGraphFragment({ inputs: [
- { name: "timeline", type: timelineTypes.track }, { name: "spec", type: temporalTypes.instantSpec },
+ { name: "timeline", type: timelineTypes.timeline }, { name: "spec", type: temporalTypes.instantSpec },
], operations: [{ id: "materialize", producer: temporalProducers.projectProgramInstant,
inputs: { timeline: fragmentInput("timeline"), spec: fragmentInput("spec") }, result: { kind: "output", name: "instant" } }],
exports: [{ name: "instant", type: temporalTypes.instant, root: operation("materialize") }] });
diff --git a/packages/temporal-markup/test/temporal-markup.test.ts b/packages/temporal-markup/test/temporal-markup.test.ts
index e4201580..5857400a 100644
--- a/packages/temporal-markup/test/temporal-markup.test.ts
+++ b/packages/temporal-markup/test/temporal-markup.test.ts
@@ -12,7 +12,7 @@ const reference = (path: string): MarkupAttributeValue => ({ kind: "reference",
const resolved = (path: string, type: SurfaceResolvedReference["type"]): SurfaceResolvedReference => ({
path, type, ref: { kind: "record", id: path },
});
-const timeline = resolved("timeline", timelineTypes.track);
+const timeline = resolved("timeline", timelineTypes.timeline);
const references = new Map([
["timeline", timeline],
["start-instant", resolved("start-instant", temporalTypes.instant)],
diff --git a/packages/temporal/src/index.ts b/packages/temporal/src/index.ts
index c0e3554a..4758b499 100644
--- a/packages/temporal/src/index.ts
+++ b/packages/temporal/src/index.ts
@@ -68,17 +68,17 @@ export const temporalManifest: ModuleManifest = {
inputs: [{ name: "domain", type: temporalTypes.localDomain }],
outputs: [{ name: "extent", type: temporalTypes.extent }], needs: [] },
{ name: temporalProducers.extentFromDuration.name,
- inputs: [{ name: "timeline", type: timelineTypes.track }, { name: "duration", type: temporalTypes.duration }],
+ inputs: [{ name: "timeline", type: timelineTypes.timeline }, { name: "duration", type: temporalTypes.duration }],
outputs: [{ name: "extent", type: temporalTypes.extent }], needs: [] },
{ name: temporalProducers.shiftInstant.name,
- inputs: [{ name: "timeline", type: timelineTypes.track }, { name: "instant", type: temporalTypes.instant },
+ inputs: [{ name: "timeline", type: timelineTypes.timeline }, { name: "instant", type: temporalTypes.instant },
{ name: "extent", type: temporalTypes.extent }, { name: "spec", type: temporalTypes.shiftSpec }],
outputs: [{ name: "instant", type: temporalTypes.instant }], needs: [] },
{ name: temporalProducers.reuseInstant.name,
inputs: [{ name: "instant", type: temporalTypes.instant }],
outputs: [{ name: "instant", type: temporalTypes.instant }], needs: [] },
{ name: temporalProducers.projectProgramInstant.name,
- inputs: [{ name: "timeline", type: timelineTypes.track }, { name: "spec", type: temporalTypes.instantSpec }],
+ inputs: [{ name: "timeline", type: timelineTypes.timeline }, { name: "spec", type: temporalTypes.instantSpec }],
outputs: [{ name: "instant", type: temporalTypes.instant }], needs: [] },
{ name: temporalProducers.composeWindow.name,
inputs: [{ name: "spec", type: temporalTypes.windowSpec }, { name: "start", type: temporalTypes.instant }, { name: "end", type: temporalTypes.instant }],
diff --git a/packages/text-fine/src/manifest.ts b/packages/text-fine/src/manifest.ts
index 78a25155..5b4f07aa 100644
--- a/packages/text-fine/src/manifest.ts
+++ b/packages/text-fine/src/manifest.ts
@@ -176,7 +176,7 @@ export const fineTextWindowAttributeVocabulary = [
const fineTextCommonAttributes = [
{ name: "id", kind: "identifier", required: true, summary: "Names this independent text occurrence and both compiled outputs." },
- { name: "timeline", kind: "reference", required: true, accepts: [timelineTypes.track], summary: "The absolute Timeline on which this occurrence is placed." },
+ { name: "timeline", kind: "reference", required: true, accepts: [timelineTypes.timeline], summary: "The absolute Timeline on which this occurrence is placed." },
{ name: "style", kind: "reference", required: true, accepts: [textFineTypes.style], summary: "Chooses the compiled fine-text Style." },
{ name: "z", kind: "literal", required: true, summary: "Sets this occurrence's absolute picture stacking position; it is not part of the reusable Style." },
{ name: "motion", kind: "reference", required: false, accepts: [textFineTypes.motion], summary: "Chooses the Motion; an omitted Motion is still." },
@@ -478,7 +478,7 @@ export const textFineMarkupSurfaces = [
attributes: [
{ name: "id", kind: "identifier", required: true,
summary: "Names this Mask, under which its VisualTrack is published." },
- { name: "timeline", kind: "reference", required: true, accepts: [timelineTypes.track],
+ { name: "timeline", kind: "reference", required: true, accepts: [timelineTypes.timeline],
summary: "The absolute Timeline shared with the consumed occurrence." },
{ name: "text", kind: "reference", required: true, accepts: [textFineTypes.occurrence],
summary: "Chooses the one authored fine-text occurrence that gives the mask its shape and timing." },
@@ -528,8 +528,8 @@ export const textFineManifest: ModuleManifest = {
{ name: textFineProducers.bindPoint.name, inputs: [{ name: "point", type: spatialTypes.point }, { name: "policy", type: textFineTypes.pointPlacementPolicy }], outputs: [{ name: "placement", type: textFineTypes.placement }], needs: [] },
{ name: textFineProducers.bindArea.name, inputs: [{ name: "frame", type: spatialTypes.frame }, { name: "policy", type: textFineTypes.flowPlacementPolicy }], outputs: [{ name: "placement", type: textFineTypes.placement }], needs: [] },
{ name: textFineProducers.bindPath.name, inputs: [{ name: "path", type: spatialTypes.path }, { name: "policy", type: textFineTypes.pathPlacementPolicy }, { name: "marginMotion", type: textFineTypes.pathMotion }], outputs: [{ name: "placement", type: textFineTypes.placement }], needs: [] },
- { name: textFineProducers.createOccurrence.name, inputs: [{ name: "timeline", type: timelineTypes.track }, { name: "placement", type: textFineTypes.placement }, { name: "spec", type: textFineTypes.itemSpec }, { name: "style", type: textFineTypes.style }, { name: "motion", type: textFineTypes.motion }, { name: "window", type: temporalTypes.window }], outputs: [{ name: "occurrence", type: textFineTypes.occurrence }], needs: [] },
- { name: textFineProducers.renderOccurrence.name, inputs: [{ name: "timeline", type: timelineTypes.track }, { name: "occurrence", type: textFineTypes.occurrence }], outputs: [{ name: "visual", type: compositionTypes.visualTrack }], needs: [] },
- { name: textFineProducers.renderOccurrenceMask.name, inputs: [{ name: "timeline", type: timelineTypes.track }, { name: "occurrence", type: textFineTypes.occurrence }, { name: "material", type: mediaTypes.compositableSurface }, { name: "spec", type: textFineTypes.maskSpec }], outputs: [{ name: "visual", type: compositionTypes.visualTrack }], needs: [] },
+ { name: textFineProducers.createOccurrence.name, inputs: [{ name: "timeline", type: timelineTypes.timeline }, { name: "placement", type: textFineTypes.placement }, { name: "spec", type: textFineTypes.itemSpec }, { name: "style", type: textFineTypes.style }, { name: "motion", type: textFineTypes.motion }, { name: "window", type: temporalTypes.window }], outputs: [{ name: "occurrence", type: textFineTypes.occurrence }], needs: [] },
+ { name: textFineProducers.renderOccurrence.name, inputs: [{ name: "timeline", type: timelineTypes.timeline }, { name: "occurrence", type: textFineTypes.occurrence }], outputs: [{ name: "visual", type: compositionTypes.visualTrack }], needs: [] },
+ { name: textFineProducers.renderOccurrenceMask.name, inputs: [{ name: "timeline", type: timelineTypes.timeline }, { name: "occurrence", type: textFineTypes.occurrence }, { name: "material", type: mediaTypes.compositableSurface }, { name: "spec", type: textFineTypes.maskSpec }], outputs: [{ name: "visual", type: compositionTypes.visualTrack }], needs: [] },
],
};
diff --git a/packages/text-fine/src/surface.ts b/packages/text-fine/src/surface.ts
index 733c844f..a3f78f6f 100644
--- a/packages/text-fine/src/surface.ts
+++ b/packages/text-fine/src/surface.ts
@@ -701,7 +701,7 @@ function createFineTextFragment(form: FineTextForm, externalContent: boolean): G
);
return sealGraphFragment({
inputs: [
- { name: "timeline", type: timelineTypes.track },
+ { name: "timeline", type: timelineTypes.timeline },
{ name: "geometry", type: form === "flow" ? spatialTypes.frame : form === "point" ? spatialTypes.point : spatialTypes.path },
{ name: "placementPolicy", type: form === "flow" ? textFineTypes.flowPlacementPolicy : form === "point" ? textFineTypes.pointPlacementPolicy : textFineTypes.pathPlacementPolicy },
...(form === "path" ? [{ name: "pathMotion", type: textFineTypes.pathMotion }] : []),
@@ -804,7 +804,7 @@ export const decodeTypographyPathSurface = decodeFineTextOccurrenceSurface("path
function createMaskFragment(id: string): GraphFragment {
const inputs = [
- { name: "timeline", type: timelineTypes.track },
+ { name: "timeline", type: timelineTypes.timeline },
{ name: "occurrence", type: textFineTypes.occurrence },
{ name: "material", type: mediaTypes.compositableSurface },
{ name: "spec", type: textFineTypes.maskSpec },
diff --git a/packages/text-fine/test/text-fine.test.ts b/packages/text-fine/test/text-fine.test.ts
index 614cdd4b..5147bdf6 100644
--- a/packages/text-fine/test/text-fine.test.ts
+++ b/packages/text-fine/test/text-fine.test.ts
@@ -265,7 +265,7 @@ test("the self-described Markup Surfaces compile Style, Motion and all three spa
name: "inputs", tag: "Inputs", mode: "structured",
outputs: [
svsRecipeType,
- timelineTypes.track,
+ timelineTypes.timeline,
spatialTypes.point,
spatialTypes.frame,
spatialTypes.path,
@@ -326,7 +326,7 @@ test("the self-described Markup Surfaces compile Style, Motion and all three spa
} },
range: element.range,
},
- { id: "semantic", type: timelineTypes.track, value: { kind: "inline", value: semantic }, range: element.range },
+ { id: "semantic", type: timelineTypes.timeline, value: { kind: "inline", value: semantic }, range: element.range },
{ id: "title-point", type: spatialTypes.point, value: { kind: "inline", value: { xPx: 540, yPx: 120 } }, range: element.range },
{ id: "body-frame", type: spatialTypes.frame, value: { kind: "inline", value: { xPx: 80, yPx: 220, widthPx: 920, heightPx: 520 } }, range: element.range },
{ id: "arc", type: spatialTypes.path, value: { kind: "inline", value: { commands: [
@@ -582,7 +582,7 @@ test("a paragraph's source indentation is not part of its words", async () => {
const fixtureSurface = {
name: "inputs", tag: "Inputs", mode: "structured",
outputs: [
- svsRecipeType, timelineTypes.track, spatialTypes.frame,
+ svsRecipeType, timelineTypes.timeline, spatialTypes.frame,
mediaTypes.fontArtifact, textTypes.text,
],
} as const;
@@ -601,7 +601,7 @@ test("a paragraph's source indentation is not part of its words", async () => {
{ id: "editorial", type: svsRecipeType, value: { kind: "inline", value: {
path: "text.editorial", properties: { size: 44, "line-height": 1.15 } } },
range: element.range },
- { id: "semantic", type: timelineTypes.track, value: { kind: "inline", value: semantic }, range: element.range },
+ { id: "semantic", type: timelineTypes.timeline, value: { kind: "inline", value: semantic }, range: element.range },
{ id: "body-frame", type: spatialTypes.frame, value: { kind: "inline", value: { xPx: 80, yPx: 220, widthPx: 920, heightPx: 520 } }, range: element.range },
{ id: "exact-font", type: mediaTypes.fontArtifact, value: { kind: "inline", value: exactTestFont }, range: element.range },
],
diff --git a/packages/timeline-author/src/fragment.ts b/packages/timeline-author/src/fragment.ts
index 9a2c8edb..81553f58 100644
--- a/packages/timeline-author/src/fragment.ts
+++ b/packages/timeline-author/src/fragment.ts
@@ -232,7 +232,7 @@ export function compileTimelineAuthorFragment(options: TimelineAuthorFragmentOpt
inputs: { start: originRef(), end: operation("point:end") }, result: { kind: "output", name: "span" } });
const exports: { name: string; type: TypeRef; root: FragmentOperationRef }[] = [
- { name: "timeline", type: timelineTypes.track, root: operation("timeline") },
+ { name: "timeline", type: timelineTypes.timeline, root: operation("timeline") },
];
const outputNames: { port: string; suffix: string }[] = [{ port: "timeline", suffix: "timeline" }];
const exportInstant = (port: string, suffix: string, point: FragmentOperationRef, id: string, subjectId: string): void => {
diff --git a/packages/timeline-author/src/manifest.ts b/packages/timeline-author/src/manifest.ts
index 1a19ad19..48dd69c6 100644
--- a/packages/timeline-author/src/manifest.ts
+++ b/packages/timeline-author/src/manifest.ts
@@ -54,15 +54,15 @@ export const timelineAuthorManifest: ModuleManifest = {
{ name: timelineAuthorProducers.spanBetween.name, inputs: [{ name: "start", type: timelineAuthorTypes.point }, { name: "end", type: timelineAuthorTypes.point }], outputs: [{ name: "span", type: timelineAuthorTypes.span }], needs: [] },
{ name: timelineAuthorProducers.spanStart.name, inputs: [{ name: "span", type: timelineAuthorTypes.span }], outputs: [{ name: "point", type: timelineAuthorTypes.point }], needs: [] },
{ name: timelineAuthorProducers.spanEnd.name, inputs: [{ name: "span", type: timelineAuthorTypes.span }], outputs: [{ name: "point", type: timelineAuthorTypes.point }], needs: [] },
- { name: timelineAuthorProducers.finalize.name, inputs: [{ name: "header", type: timelineAuthorTypes.header }, { name: "clock", type: timelineTypes.clock }, { name: "end", type: timelineAuthorTypes.point }], outputs: [{ name: "timeline", type: timelineTypes.track }], needs: [] },
- { name: timelineAuthorProducers.instant.name, inputs: [{ name: "timeline", type: timelineTypes.track }, { name: "point", type: timelineAuthorTypes.point }, { name: "spec", type: timelineAuthorTypes.identity }], outputs: [{ name: "instant", type: temporalTypes.instant }], needs: [] },
- { name: timelineAuthorProducers.window.name, inputs: [{ name: "timeline", type: timelineTypes.track }, { name: "span", type: timelineAuthorTypes.span }, { name: "spec", type: timelineAuthorTypes.identity }], outputs: [{ name: "window", type: temporalTypes.window }], needs: [] },
+ { name: timelineAuthorProducers.finalize.name, inputs: [{ name: "header", type: timelineAuthorTypes.header }, { name: "clock", type: timelineTypes.clock }, { name: "end", type: timelineAuthorTypes.point }], outputs: [{ name: "timeline", type: timelineTypes.timeline }], needs: [] },
+ { name: timelineAuthorProducers.instant.name, inputs: [{ name: "timeline", type: timelineTypes.timeline }, { name: "point", type: timelineAuthorTypes.point }, { name: "spec", type: timelineAuthorTypes.identity }], outputs: [{ name: "instant", type: temporalTypes.instant }], needs: [] },
+ { name: timelineAuthorProducers.window.name, inputs: [{ name: "timeline", type: timelineTypes.timeline }, { name: "span", type: timelineAuthorTypes.span }, { name: "spec", type: timelineAuthorTypes.identity }], outputs: [{ name: "window", type: temporalTypes.window }], needs: [] },
],
};
export const timelineAuthorMarkupSurfaces = [{
name: "timeline", tag: "Timeline", mode: "structured",
- outputs: [...Object.values(timelineAuthorTypes), timelineTypes.track, temporalTypes.instant, temporalTypes.window],
+ outputs: [...Object.values(timelineAuthorTypes), timelineTypes.timeline, temporalTypes.instant, temporalTypes.window],
vocabulary: {
summary: "Lowers a small acyclic Instant/Window author graph into one finite Timeline and scoped absolute anchors.",
attributes: [
@@ -83,7 +83,7 @@ export const timelineAuthorMarkupSurfaces = [{
] },
],
ports: [
- { name: "timeline", type: timelineTypes.track, summary: "The finalized absolute Timeline." },
+ { name: "timeline", type: timelineTypes.timeline, summary: "The finalized absolute Timeline." },
{ name: "window", type: temporalTypes.window, summary: "The complete [start,end) Window." },
{ name: "start/end", type: temporalTypes.instant, summary: "The complete Timeline boundaries." },
{ name: "<name>", type: temporalTypes.instant, summary: "A named Instant child." },
@@ -111,7 +111,7 @@ export const timelineAuthorMarkupSurfaces = [{
summary: "Publishes one reusable absolute Window without putting content on Timeline.",
attributes: [
{ name: "id", kind: "identifier", required: true, summary: "Names the Window and its .start/.end Instants." },
- { name: "timeline", kind: "reference", required: true, accepts: [timelineTypes.track], summary: "Selects the absolute coordinate system." },
+ { name: "timeline", kind: "reference", required: true, accepts: [timelineTypes.timeline], summary: "Selects the absolute coordinate system." },
{ name: "from", kind: "expression", required: false, accepts: [temporalTypes.instant], summary: "Inclusive absolute start." },
{ name: "until", kind: "expression", required: false, accepts: [temporalTypes.instant], summary: "Exclusive absolute end." },
{ name: "for", kind: "expression", required: false, accepts: [temporalTypes.extent], summary: "Exact duration." },
@@ -128,7 +128,7 @@ export const timelineAuthorMarkupSurfaces = [{
summary: "Publishes one reusable authored absolute Instant.",
attributes: [
{ name: "id", kind: "identifier", required: true, summary: "Names the Instant." },
- { name: "timeline", kind: "reference", required: true, accepts: [timelineTypes.track], summary: "Selects the absolute coordinate system." },
+ { name: "timeline", kind: "reference", required: true, accepts: [timelineTypes.timeline], summary: "Selects the absolute coordinate system." },
{ name: "at", kind: "literal", required: true, summary: "Absolute time or Timeline-boundary expression." },
],
ports: [{ name: "<id>", type: temporalTypes.instant, summary: "The resolved Instant." }],
diff --git a/packages/timeline-author/test/surface.test.ts b/packages/timeline-author/test/surface.test.ts
index 2c27c6b9..ee9ac112 100644
--- a/packages/timeline-author/test/surface.test.ts
+++ b/packages/timeline-author/test/surface.test.ts
@@ -13,7 +13,7 @@ import {
} from "@hypit/timeline-author";
const absoluteReferences = new Map([
- ["film.timeline", { path: "film.timeline", type: timelineTypes.track, ref: { kind: "record" as const, id: "film.timeline" } }],
+ ["film.timeline", { path: "film.timeline", type: timelineTypes.timeline, ref: { kind: "record" as const, id: "film.timeline" } }],
["reveal", { path: "reveal", type: temporalTypes.instant, ref: { kind: "record" as const, id: "reveal" } }],
["answer-end", { path: "answer-end", type: temporalTypes.instant, ref: { kind: "record" as const, id: "answer-end" } }],
]);
diff --git a/packages/timeline/src/component.ts b/packages/timeline/src/component.ts
index 7a3a5a2a..e2da6767 100644
--- a/packages/timeline/src/component.ts
+++ b/packages/timeline/src/component.ts
@@ -12,7 +12,7 @@ function track(value: StoredValue | undefined): Timeline {
export const timelineComponent = {
producers: [],
validators: [{
- type: timelineTypes.track,
+ type: timelineTypes.timeline,
handler: ({ value }) => assertTimelineIdentity(track(value)),
}],
} satisfies ComponentPackage;
diff --git a/packages/timeline/src/manifest.ts b/packages/timeline/src/manifest.ts
index 1fdffa2f..028ff1a3 100644
--- a/packages/timeline/src/manifest.ts
+++ b/packages/timeline/src/manifest.ts
@@ -2,7 +2,7 @@ import type { ModuleManifest, TypeRef, ValueSchema } from "@hypit/protocol";
export const timelineModuleRef = { name: "@hypit/timeline", version: "1" } as const;
export const timelineTypes = {
- track: { module: timelineModuleRef, name: "Timeline" },
+ timeline: { module: timelineModuleRef, name: "Timeline" },
clock: { module: timelineModuleRef, name: "Clock" },
} satisfies Record<string, TypeRef>;
@@ -26,7 +26,7 @@ export const timelineManifest: ModuleManifest = {
name: timelineModuleRef.name,
version: timelineModuleRef.version,
dependencies: [],
- types: [{ name: timelineTypes.track.name }, { name: timelineTypes.clock.name }],
+ types: [{ name: timelineTypes.timeline.name }, { name: timelineTypes.clock.name }],
capabilities: [],
producers: [],
};
diff --git a/packages/visual-track-studio/src/index.ts b/packages/visual-track-studio/src/index.ts
index 1e39da34..790c1014 100644
--- a/packages/visual-track-studio/src/index.ts
+++ b/packages/visual-track-studio/src/index.ts
@@ -9,7 +9,7 @@ import type {
StudioMaterialPreview,
StudioSourceBindingDeclaration,
} from "@hypit/studio-adapter";
-import { artifactPreview, authoredItemTitle, childEntities, previewLayer, requiredSurfaceValue, temporalLineageFor, temporalSemanticSource } from "@hypit/studio-adapter";
+import { artifactPreview, authoredItemTitle, childEntities, previewLayer, requiredSurfaceValue, temporalLineageFor, temporalDomainSource } from "@hypit/studio-adapter";
const frameParameters: readonly StudioSourceBindingDeclaration[] = [
{ name: "within" },
@@ -151,7 +151,7 @@ function projectVisualClips(context: StudioTrackCompanionContext): readonly Stud
const clip = clips[index];
if (clip === undefined) return entity;
const temporal = temporalLineageFor(context, clip.id, clip.temporalInput);
- const semanticSource = temporalSemanticSource(temporal);
+ const semanticSource = temporalDomainSource(temporal);
return {
...entity,
display: {
diff --git a/packages/visual-track/src/fragment.ts b/packages/visual-track/src/fragment.ts
index 8a81bf68..bac6c9d8 100644
--- a/packages/visual-track/src/fragment.ts
+++ b/packages/visual-track/src/fragment.ts
@@ -15,7 +15,7 @@ const operation = (id: string) => ({ kind: "fragment-operation" as const, operat
export const stillVisualTrackFragment = sealGraphFragment({
inputs: [
{ name: "header", type: visualTrackTypes.header },
- { name: "timeline", type: timelineTypes.track },
+ { name: "timeline", type: timelineTypes.timeline },
{ name: "source", type: artifactTypes.blob },
{ name: "extent", type: spatialTypes.extent },
{ name: "frame", type: spatialTypes.frame },
@@ -48,7 +48,7 @@ export const stillVisualTrackFragment = sealGraphFragment({
});
export const renderVisualTrackFragment = sealGraphFragment({
- inputs: [{ name: "timeline", type: timelineTypes.track }, { name: "program", type: visualTrackTypes.program }],
+ inputs: [{ name: "timeline", type: timelineTypes.timeline }, { name: "program", type: visualTrackTypes.program }],
operations: [
{ id: "visual", producer: visualTrackProducers.projectVisual, inputs: { timeline: input("timeline"), program: input("program") }, result: { kind: "output", name: "track" } },
],
diff --git a/packages/visual-track/src/manifest.ts b/packages/visual-track/src/manifest.ts
index d6e0683c..8055fe12 100644
--- a/packages/visual-track/src/manifest.ts
+++ b/packages/visual-track/src/manifest.ts
@@ -214,7 +214,7 @@ export const visualTrackHeaderSchema: ValueSchema = object({
const clipInputs = [
{ name: "set", type: visualTrackTypes.set }, { name: "header", type: visualTrackTypes.header },
- { name: "timeline", type: timelineTypes.track },
+ { name: "timeline", type: timelineTypes.timeline },
{ name: "layers", type: visualTrackTypes.layerSet },
{ name: "frame", type: spatialTypes.frame }, { name: "spec", type: visualTrackTypes.clipSpec },
{ name: "window", type: temporalTypes.window },
@@ -431,8 +431,8 @@ export const visualTrackManifest: ModuleManifest = {
{ name: visualTrackProducers.appendClip.name, inputs: clipInputs, outputs: [{ name: "set", type: visualTrackTypes.set }], needs: [] },
{ name: visualTrackProducers.bindClipPath.name, inputs: [{ name: "spec", type: visualTrackTypes.clipSpec }, { name: "path", type: spatialTypes.path }], outputs: [{ name: "spec", type: visualTrackTypes.clipSpec }], needs: [] },
{ name: visualTrackProducers.bindMotion.name, inputs: [{ name: "spec", type: visualTrackTypes.clipSpec }, { name: "motion", type: visualTrackTypes.motion }], outputs: [{ name: "spec", type: visualTrackTypes.clipSpec }], needs: [] },
- { name: visualTrackProducers.finalize.name, inputs: [{ name: "set", type: visualTrackTypes.set }, { name: "header", type: visualTrackTypes.header }, { name: "timeline", type: timelineTypes.track }], outputs: [{ name: "program", type: visualTrackTypes.program }], needs: [] },
- { name: visualTrackProducers.projectVisual.name, inputs: [{ name: "timeline", type: timelineTypes.track }, { name: "program", type: visualTrackTypes.program }], outputs: [{ name: "track", type: compositionTypes.visualTrack }], needs: [] },
+ { name: visualTrackProducers.finalize.name, inputs: [{ name: "set", type: visualTrackTypes.set }, { name: "header", type: visualTrackTypes.header }, { name: "timeline", type: timelineTypes.timeline }], outputs: [{ name: "program", type: visualTrackTypes.program }], needs: [] },
+ { name: visualTrackProducers.projectVisual.name, inputs: [{ name: "timeline", type: timelineTypes.timeline }, { name: "program", type: visualTrackTypes.program }], outputs: [{ name: "track", type: compositionTypes.visualTrack }], needs: [] },
],
};
diff --git a/packages/visual-track/test/visual-track.test.ts b/packages/visual-track/test/visual-track.test.ts
index 728cb4ff..670f11c3 100644
--- a/packages/visual-track/test/visual-track.test.ts
+++ b/packages/visual-track/test/visual-track.test.ts
@@ -657,7 +657,7 @@ test("the Visual author Surface emits explicit graph edges for layers, absolute
path, ref: { kind: "record", id: path }, type,
});
const references = new Map<string, SurfaceResolvedReference>([
- ["semantic", plain("semantic", timelineTypes.track)],
+ ["semantic", plain("semantic", timelineTypes.timeline)],
["frame", plain("frame", spatialTypes.frame)],
["mapping", plain("mapping", spatialTypes.map2D)],
["clip-path", plain("clip-path", spatialTypes.path)],
diff --git a/packages/whisperx/src/fragment.ts b/packages/whisperx/src/fragment.ts
index 3e9bd32e..a2135352 100644
--- a/packages/whisperx/src/fragment.ts
+++ b/packages/whisperx/src/fragment.ts
@@ -12,7 +12,7 @@ const input = (name: string) => ({ kind: "fragment-input" as const, name });
const operation = (id: string) => ({ kind: "fragment-operation" as const, operation: id });
export const whisperXAlignmentFragment = sealGraphFragment({
- inputs: [{ name: "narrative", type: narrativeTypes.narrative }, { name: "segment", type: narrativeTypes.excerpt },
+ inputs: [{ name: "narrative", type: narrativeTypes.narrative }, { name: "segment", type: narrativeTypes.segmentRef },
{ name: "media", type: mediaTypes.synchronized }, { name: "domain", type: temporalTypes.localDomain },
{ name: "language", type: whisperXTypes.language }],
operations: [
@@ -29,7 +29,7 @@ export const whisperXAlignmentFragment = sealGraphFragment({
});
export const whisperXBoundaryAlignmentFragment = sealGraphFragment({
- inputs: [{ name: "narrative", type: narrativeTypes.narrative }, { name: "segment", type: narrativeTypes.excerpt },
+ inputs: [{ name: "narrative", type: narrativeTypes.narrative }, { name: "segment", type: narrativeTypes.segmentRef },
{ name: "domain", type: temporalTypes.localDomain }],
operations: [
{ id: "materialize-boundaries", producer: narrativeTemporalProducers.materializeSegmentBoundaries,
diff --git a/packages/whisperx/src/manifest.ts b/packages/whisperx/src/manifest.ts
index f6da188c..d69fd3d6 100644
--- a/packages/whisperx/src/manifest.ts
+++ b/packages/whisperx/src/manifest.ts
@@ -33,7 +33,7 @@ export const whisperXMarkupSurfaces = [{
accepts: [narrativeTypes.narrative],
summary: "Selects the authored Narrative that owns the Segment and Token identities." },
{ name: "segment", kind: "reference", required: true,
- accepts: [narrativeTypes.excerpt],
+ accepts: [narrativeTypes.segmentRef],
summary: "Selects the single authored Segment performed by this Take." },
{ name: "media", kind: "reference", required: true,
accepts: [mediaTypes.synchronized],
diff --git a/packages/whisperx/src/surface.ts b/packages/whisperx/src/surface.ts
index 08df27fd..d371b540 100644
--- a/packages/whisperx/src/surface.ts
+++ b/packages/whisperx/src/surface.ts
@@ -2,7 +2,7 @@ import { assertExactAttributes as exactAttributes, textAttribute as stringAttrib
type StructuredElement, type StructuredSurfaceHandler, type SurfaceResolvedReference, type SurfaceRecordDraft, type MarkupAttributeValue } from "@hypit/markup";
import { sameType } from "@hypit/protocol";
import { narrativeTypes } from "@hypit/narrative";
-import type { NarrativeExcerpt } from "@hypit/narrative";
+import type { NarrativeSegmentRef } from "@hypit/narrative";
import { mediaTypes } from "@hypit/media";
import { temporalTypes } from "@hypit/temporal";
@@ -18,13 +18,13 @@ function reference(element: StructuredElement, name: string, expected: SurfaceRe
if (value === undefined || !sameType(value.type, expected)) throw new Error(`${element.name}.${name} has the wrong type`);
return value;
}
-function authoredExcerpt(value: SurfaceResolvedReference): NarrativeExcerpt | undefined {
- return value.record?.value.kind === "inline" ? value.record.value.value as unknown as NarrativeExcerpt : undefined;
+function authoredExcerpt(value: SurfaceResolvedReference): NarrativeSegmentRef | undefined {
+ return value.record?.value.kind === "inline" ? value.record.value.value as unknown as NarrativeSegmentRef : undefined;
}
export const decodeWhisperXAlignmentSurface: StructuredSurfaceHandler = ({ element, resolveReference }) => {
const narrative = reference(element, "narrative", narrativeTypes.narrative, resolveReference);
- const segment = reference(element, "segment", narrativeTypes.excerpt, resolveReference);
+ const segment = reference(element, "segment", narrativeTypes.segmentRef, resolveReference);
const domain = reference(element, "domain", temporalTypes.localDomain, resolveReference);
const excerpt = authoredExcerpt(segment);
const hasNoTokens = excerpt !== undefined && excerpt.tokenStart === excerpt.tokenEndExclusive;
diff --git a/packages/whisperx/test/whisperx.test.ts b/packages/whisperx/test/whisperx.test.ts
index 5ac12e5c..09b7c3f6 100644
--- a/packages/whisperx/test/whisperx.test.ts
+++ b/packages/whisperx/test/whisperx.test.ts
@@ -45,7 +45,7 @@ test("WhisperX receives normalized bytes without authored Segment truth", () =>
test("SVML language reaches the alignment request without a service-support table", async () => {
const refs = new Map<string, SurfaceResolvedReference>([
["story", { path: "story", ref: { kind: "record", id: "story" }, type: narrativeTypes.narrative }],
- ["excerpt", { path: "excerpt", ref: { kind: "record", id: "excerpt" }, type: narrativeTypes.excerpt }],
+ ["excerpt", { path: "excerpt", ref: { kind: "record", id: "excerpt" }, type: narrativeTypes.segmentRef }],
["media", { path: "media", ref: { kind: "record", id: "media" }, type: mediaTypes.synchronized }],
["domain", { path: "domain", ref: { kind: "record", id: "domain" }, type: temporalTypes.localDomain }],
]);
@@ -87,10 +87,10 @@ test("the real-media Surface materializes an empty Segment from its media domain
tokenEndExclusive: 0,
}],
tokens: [], turns: [], selections: [], moments: [],
- semanticIndex: { anchors: [
+ anchors: [
{ id: "pause:start", kind: "segment-start", segmentId: "pause" },
{ id: "pause:end", kind: "segment-end", segmentId: "pause" },
- ] },
+ ],
};
const excerpt = {
narrativeId: narrative.id,
@@ -119,7 +119,7 @@ test("the real-media Surface materializes an empty Segment from its media domain
});
const refs = new Map<string, SurfaceResolvedReference>([
["story", authored("story", narrativeTypes.narrative, narrative)],
- ["story.segment.pause", authored("story.segment.pause", narrativeTypes.excerpt, excerpt)],
+ ["story.segment.pause", authored("story.segment.pause", narrativeTypes.segmentRef, excerpt)],
["pause-media.domain", authored("pause-media.domain", temporalTypes.localDomain, {
id: "pause-media", frameRate: media.frameDomain.frameRate, frameCount: media.frameDomain.frameCount,
})],
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index cfc4e0ea..eee42a36 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -291,18 +291,18 @@ importers:
'@hypit/text':
specifier: workspace:*
version: link:packages/text
- '@hypit/timeline':
- specifier: workspace:*
- version: link:packages/timeline
- '@hypit/timeline-author':
- specifier: workspace:*
- version: link:packages/timeline-author
'@hypit/text-fine':
specifier: workspace:*
version: link:packages/text-fine
'@hypit/text-fine-studio':
specifier: workspace:*
version: link:packages/text-fine-studio
+ '@hypit/timeline':
+ specifier: workspace:*
+ version: link:packages/timeline
+ '@hypit/timeline-author':
+ specifier: workspace:*
+ version: link:packages/timeline-author
'@hypit/visual-ir':
specifier: workspace:*
version: link:packages/visual-ir
@@ -2893,6 +2893,9 @@ importers:
'@hypit/narrative':
specifier: workspace:*
version: link:../narrative
+ '@hypit/narrative-temporal':
+ specifier: workspace:*
+ version: link:../narrative-temporal
'@hypit/protocol':
specifier: workspace:*
version: link:../protocol
@@ -3094,9 +3097,6 @@ importers:
'@hypit/media-pipeline':
specifier: workspace:*
version: link:../media-pipeline
- '@hypit/narrative-temporal':
- specifier: workspace:*
- version: link:../narrative-temporal
'@hypit/package-loader-node':
specifier: workspace:*
version: link:../package-loader-node
@@ -3136,12 +3136,12 @@ importers:
'@hypit/temporal':
specifier: workspace:*
version: link:../temporal
- '@hypit/timeline':
- specifier: workspace:*
- version: link:../timeline
'@hypit/text-fine-studio':
specifier: workspace:*
version: link:../text-fine-studio
+ '@hypit/timeline':
+ specifier: workspace:*
+ version: link:../timeline
'@hypit/validation':
specifier: workspace:*
version: link:../validation
@@ -3234,124 +3234,124 @@ importers:
specifier: workspace:*
version: link:../svs
- packages/timeline:
+ packages/text-fine:
dependencies:
'@hypit/component-kit':
specifier: workspace:*
version: link:../component-kit
- '@hypit/protocol':
- specifier: workspace:*
- version: link:../protocol
-
- packages/timeline-author:
- dependencies:
- '@hypit/component-kit':
+ '@hypit/composition':
specifier: workspace:*
- version: link:../component-kit
+ version: link:../composition
'@hypit/elaborator':
specifier: workspace:*
version: link:../elaborator
'@hypit/markup':
specifier: workspace:*
version: link:../markup
+ '@hypit/media':
+ specifier: workspace:*
+ version: link:../media
'@hypit/protocol':
specifier: workspace:*
version: link:../protocol
+ '@hypit/spatial':
+ specifier: workspace:*
+ version: link:../spatial
+ '@hypit/svs':
+ specifier: workspace:*
+ version: link:../svs
'@hypit/temporal':
specifier: workspace:*
version: link:../temporal
'@hypit/temporal-markup':
specifier: workspace:*
version: link:../temporal-markup
+ '@hypit/text':
+ specifier: workspace:*
+ version: link:../text
'@hypit/timeline':
specifier: workspace:*
version: link:../timeline
+ '@hypit/visual-ir':
+ specifier: workspace:*
+ version: link:../visual-ir
devDependencies:
'@hypit/core':
specifier: workspace:*
version: link:../core
- '@hypit/script':
- specifier: workspace:*
- version: link:../script
- '@hypit/text':
- specifier: workspace:*
- version: link:../text
'@hypit/validation':
specifier: workspace:*
version: link:../validation
- packages/transport-aws-lambda:
+ packages/text-fine-studio:
dependencies:
- '@aws-sdk/client-lambda':
- specifier: 3.1103.0
- version: 3.1103.0
+ '@hypit/composition':
+ specifier: workspace:*
+ version: link:../composition
+ '@hypit/fonts-open':
+ specifier: workspace:*
+ version: link:../fonts-open
+ '@hypit/studio-adapter':
+ specifier: workspace:*
+ version: link:../studio-adapter
+ '@hypit/text-fine':
+ specifier: workspace:*
+ version: link:../text-fine
+
+ packages/timeline:
+ dependencies:
+ '@hypit/component-kit':
+ specifier: workspace:*
+ version: link:../component-kit
'@hypit/protocol':
specifier: workspace:*
version: link:../protocol
- packages/text-fine:
+ packages/timeline-author:
dependencies:
'@hypit/component-kit':
specifier: workspace:*
version: link:../component-kit
- '@hypit/composition':
- specifier: workspace:*
- version: link:../composition
'@hypit/elaborator':
specifier: workspace:*
version: link:../elaborator
'@hypit/markup':
specifier: workspace:*
version: link:../markup
- '@hypit/media':
- specifier: workspace:*
- version: link:../media
'@hypit/protocol':
specifier: workspace:*
version: link:../protocol
- '@hypit/spatial':
- specifier: workspace:*
- version: link:../spatial
- '@hypit/svs':
- specifier: workspace:*
- version: link:../svs
'@hypit/temporal':
specifier: workspace:*
version: link:../temporal
'@hypit/temporal-markup':
specifier: workspace:*
version: link:../temporal-markup
- '@hypit/text':
- specifier: workspace:*
- version: link:../text
'@hypit/timeline':
specifier: workspace:*
version: link:../timeline
- '@hypit/visual-ir':
- specifier: workspace:*
- version: link:../visual-ir
devDependencies:
'@hypit/core':
specifier: workspace:*
version: link:../core
+ '@hypit/script':
+ specifier: workspace:*
+ version: link:../script
+ '@hypit/text':
+ specifier: workspace:*
+ version: link:../text
'@hypit/validation':
specifier: workspace:*
version: link:../validation
- packages/text-fine-studio:
+ packages/transport-aws-lambda:
dependencies:
- '@hypit/composition':
- specifier: workspace:*
- version: link:../composition
- '@hypit/fonts-open':
- specifier: workspace:*
- version: link:../fonts-open
- '@hypit/studio-adapter':
- specifier: workspace:*
- version: link:../studio-adapter
- '@hypit/text-fine':
+ '@aws-sdk/client-lambda':
+ specifier: 3.1103.0
+ version: 3.1103.0
+ '@hypit/protocol':
specifier: workspace:*
- version: link:../text-fine
+ version: link:../protocol
packages/validation:
dependencies:
diff --git a/skills/hypit/references/production/script-syntax.md b/skills/hypit/references/production/script-syntax.md
index ad0ac09a..5012c712 100644
--- a/skills/hypit/references/production/script-syntax.md
+++ b/skills/hypit/references/production/script-syntax.md
@@ -146,7 +146,7 @@ One Script publishes the full Narrative and the narrow views needed by the rest
| Reference | What it carries |
| --- | --- |
| `{story}` | The complete authored Narrative. |
-| `{story.segment.hook}` | The `hook` Segment as a NarrativeExcerpt for generation, alignment or another semantic consumer. |
+| `{story.segment.hook}` | The `hook` Segment as a NarrativeSegmentRef for generation, alignment or another semantic consumer. |
| `{story.segment.hook.dialogue}` | Role-aware dialogue using the spoken side of Dual Text, suitable for a speaking performance request. |
| `{story.segment.hook.speech}` | Pronunciation-only Text, suitable for `hypit measure` or independent speech. |
| `{story.caption}` | Display Words, Alignment Units, attributes, Roles, and authored Cue Breaks for Caption. |
diff --git a/test/temporal-fixture.ts b/test/temporal-fixture.ts
index 1b64d8e1..b8a805d9 100644
--- a/test/temporal-fixture.ts
+++ b/test/temporal-fixture.ts
@@ -1,4 +1,4 @@
-import type { NarrativeExcerpt, NarrativeMomentRef, NarrativeSelectionRef } from "@hypit/narrative";
+import type { NarrativeSegmentRef, NarrativeMomentRef, NarrativeSelectionRef } from "@hypit/narrative";
import type { Timeline } from "@hypit/timeline";
import {
composeTemporalWindow,
@@ -73,7 +73,7 @@ export function projectSegmentWindow(input: {
readonly subjectId?: string;
readonly semantic: Timeline;
readonly narrative: NarrativeProjection;
- readonly segment: NarrativeExcerpt;
+ readonly segment: NarrativeSegmentRef;
readonly projection: NarrativeWindowProjection;
}) {
const subjectId = input.subjectId ?? input.itemId;