Clone any viral video with AI agents. Not just a script, the whole workflow: swap the face, the words, the B-roll, ship 100 variants in one command, and get your 100M views.
TypeScript agentic-aiaiai-agentsai-videocompilerdslffmpeggenerative-aillmmarkup-languagemonorepoplugin-systemprogramming-languagetext-to-videotypescriptvideovideo-automationvideo-clonevideo-editingvideo-generation
feat: move preview mocks into native SVRun realization
rponeawadec74d09f892
diff --git a/.agents/skills/hypit/SKILL.md b/.agents/skills/hypit/SKILL.mdindex 93b8b9e7..b67f211f 100644--- a/.agents/skills/hypit/SKILL.md+++ b/.agents/skills/hypit/SKILL.md@@ -66,6 +66,8 @@ the boundary and launcher selection. Read it before the first command of any rouat the step that proves a vocabulary gap.- Seeing what the sources produce, or proving the graph traces before any Build → read`references/preview.md`.+- Preview-only media realization, temporary preview Runs, mock Artifact caching, or estimated+ SemanticTake timing → read `references/preview-mock.md`.- Runtime setup, plan/build/status/inspect/get/reuse → read `references/runtime.md`.- Environment diagnosis or credentials → read `references/environment.md` and`references/credentials.md`.diff --git a/.agents/skills/hypit/references/element-review.md b/.agents/skills/hypit/references/element-review.mdindex c565199a..3ab7f8af 100644--- a/.agents/skills/hypit/references/element-review.md+++ b/.agents/skills/hypit/references/element-review.md@@ -77,15 +77,17 @@ it may be media slots the Source declares as generations. Render them as mocks rthem out: a missing base is not a neutral background, it is black, and text that is legible on blackcan be illegible on the picture that will replace it.-`render_element` does this itself. It finds every generation the Source declares — the takes, the-stills, the slot contents — calls `make_placeholder` for each at the Canvas's own size, and declares-them in a derived Run under the project's `.hypit/`. Never `hypit image`, which pays for a generation+`render_element` delegates this to `@hypit/preview-mock`. The realizer finds every relevant logical+output in the compiled Author/Run Graph — the takes, stills and slot contents — derives geometry from+Graph inputs, and materializes them through `@hypit/mock-media` in a temporary Run under+`.hypit/preview/<realization-digest>/`. Never `hypit image`, which pays for a generationthe video will not reuse, and never a placeholder drawn by a script written for the occasion.-The sizes come from the Source's `space:Canvas`, because the mock is composed inside the render and-the render's geometry is the Canvas.+Geometry follows the fixed Graph policy: Canvas width/height first, then generation aspect-ratio,+then Canvas fallback; resolution labels such as `720p` and `2K` are not converted to pixels, and+conflicting geometry fails.-Then tell the reader that those regions are placeholders standing in for declared-but-unbuilt+Then tell the reader that those regions are preview mocks standing in for declared-but-unbuiltgenerations, and to read only what the element itself draws. Said plainly it costs one clause andsaves the mock coming back as a finding in the one round there is.@@ -99,7 +101,8 @@ and the window is cut out of the frames afterwards, so every element the Sourcedrawn wherever the Source puts it — what is on screen over the words being looked at is what thedelivery will put there.-That derived Run is on disk under `<project>/.hypit/compare/`, beside the frames it produced. Open it+That derived Run is on disk under `<project>/.hypit/preview/<realization-digest>/preview.svrun`, beside+its materialized Artifact attachments. Open itwhenever something you expected to see is not in the picture: an element that is in the Source andstill not on screen is the package failing to draw it.@@ -178,7 +181,7 @@ Two things follow, and they are the whole discipline:- **Every repair aims at something the round named.** Changing something it did not mention isthrashing, and it does not earn one of the attempts below.- **A finding caused by an input that does not exist yet is not a repair target.** The mocks above- stand in for a base take and for media slots a Build has not filled, and a reader told where they+ are preview-mock regions for a base take and media slots a Build has not filled, and a reader told where theyare should bypass them. One that reports a mock anyway is describing an absence, not a defect.Something nobody can close is not a failure to record as one. A typeface the generator cannot@@ -237,12 +240,12 @@ and do not defer every look to a final delivery Build.Every element was looked at and every repair stopped. That is what "complete" means here, and it doesnot mean the video was watched: this round runs before the Build, so the pictures it read were renders-with stand-ins under them. Report the difference rather than letting the word carry it.+with preview-mock media under them. Report the difference rather than letting the word carry it.State plainly, in the completion report, that the following are unsettled:- **every generated picture and take** — the images and the shots a Provider has still to make;-- **the timing of every Track** — this round reads each one against a stand-in SemanticTake, so how a+- **the timing of every Track** — this round reads each one against an estimate-timed SemanticTake, so how aCaption, Media or Typography Track sits against the speech that is finally delivered is settled oncethat speech exists;- **whether the picture is continuous** — the frames nobody authored thatdiff --git a/.agents/skills/hypit/references/original-authoring/conformance-round.md b/.agents/skills/hypit/references/original-authoring/conformance-round.mdindex cbb1ffca..c68fa841 100644--- a/.agents/skills/hypit/references/original-authoring/conformance-round.md+++ b/.agents/skills/hypit/references/original-authoring/conformance-round.md@@ -55,7 +55,7 @@ which observer reads the reference, that question belongs to the other route.looks unintended, and anything too low in contrast to read. Over a clip it also asks what appears,moves or leaves in a way the description does not account for.-The placeholder clause is in the prompt already: the reader is told that flat-filled regions stand in+The preview-mock clause is in the prompt already: the reader is told that flat-filled regions stand infor generations that have not run and to read only what is drawn over them. Do not add it by hand, anddo not add anything that says what you built or what you expect to be found.diff --git a/.agents/skills/hypit/references/playbooks/craft/b-roll.md b/.agents/skills/hypit/references/playbooks/craft/b-roll.mdindex f2e9c129..1355a7a6 100644--- a/.agents/skills/hypit/references/playbooks/craft/b-roll.md+++ b/.agents/skills/hypit/references/playbooks/craft/b-roll.md@@ -5,6 +5,20 @@ B-roll is authored visual evidence, context, or emotional progression outside thtake. Every insert must earn its place in the story and remain independent from editorial text andprogram audio.+## Full-screen B-roll of the same speaker++A reference may cover the whole frame with the same speaker in a second location while their voice+continues: the picture cuts away to the person whose voice is heard, shown silent in another setting.+This is B-roll, and the base stays the primary take. `continuity.md` owns the rule — the picture that+shows the speaker saying the words is the base, whoever else fills the frame. Author the second+location exactly like any other B-roll: vendor `broll-v1.svs`, one shot per beat, placed over the+Script Selection with `during=`.++The speaking kit's scene contract governs the base take, and applies only to it.+`street-interview-v1`'s "SINGLE-SCENE CONTRACT" keeps both people in the same street scene; a covering+cutaway in a classroom, an office or a product room is a separate picture and a separate kit. B-roll+carries its own `duration` on the generation, so the speech take's length does not bound it.+## See it before you generate itWhere a cutaway lands, how long it holds, and whether its Frame sits in the right part of thediff --git a/.agents/skills/hypit/references/playbooks/craft/frame-coverage.md b/.agents/skills/hypit/references/playbooks/craft/frame-coverage.mdindex 1e6e7bc4..3a2a79e3 100644--- a/.agents/skills/hypit/references/playbooks/craft/frame-coverage.md+++ b/.agents/skills/hypit/references/playbooks/craft/frame-coverage.md@@ -58,7 +58,7 @@ looks finished while the same edges are still wrong. Nothing downstream catcheshas no timeline, so it takes no `playback` and the pre-Build check does not apply to it, and Gate 4measures black, which a still removes.-The placeholders the comparison round renders under an element never reach the Source. They exist in+The preview mocks the comparison round renders under an element never reach the Source. They exist inthat render and nowhere else — the Source never names them, and the checks that decidecoverage read the Source's Recipes and bindings rather than any picture. A mock cannot quiet a holeit is structurally unable to reach.diff --git a/.agents/skills/hypit/references/preview-mock.md b/.agents/skills/hypit/references/preview-mock.mdnew file mode 100644index 00000000..a42ca4cc--- /dev/null+++ b/.agents/skills/hypit/references/preview-mock.md@@ -0,0 +1,35 @@+# Native preview mock realization++Preview-only mock media belongs to `@hypit/preview-mock`; byte producers belong to+`@hypit/mock-media`, and generic graph inspection belongs to `@hypit/compiler-node`.++The lifecycle is fixed:++```text+build.svrun → compiler-node Author/Run Graph → preview-mock realization+→ temporary .hypit/preview/<digest>/preview.svrun+→ mock-media local Provider materialization → Studio deterministic preview+```++`realizePreviewMock({run, targets?, timing: "estimate"})` derives replacements from the compiled+Graph. It must not parse SVML dimensions, read a reference transcript, write a user Source, or emit+absolute-path `<file>` Candidates. The temporary Run uses the existing `<fragment>` and `<satisfy>`+syntax and contains only Author references, mock imports/declarations, satisfactions, and explicitly+carried Run Candidates.++Mock mapping is ordinary graph substitution: image/video/audio BlobArtifact outputs use+`mock:image`, `mock:video`, and `mock:silence`; WhisperX SemanticTake outputs use the+`semantic-take-estimate` policy and preserve Narrative, Segment, Token, and Anchor identity.+Estimated timing is always `estimate:Speech`. Reference WhisperX remains evidence for shot/window+comparison only.++Geometry priority is Canvas width/height, then generation aspect-ratio, then the Canvas fallback.+Resolution labels such as `720p` and `2K` are not converted to pixels; contradictory geometry fails.+Mock Artifacts are content-addressed and cached by Author source digest, Run digest, target closure,+geometry policy, and timing mode. They never enter Author Source or coverage gates. Observers should+recognize mock regions as preview scaffolding and ignore them when assessing visual fidelity.++`reference-video-tools render_element` delegates to this realization, renders the complete program+once in Studio, cuts the requested window, writes a sidecar with `"timing_basis": "estimate"`, and+then invokes comparison. `make_placeholder`, hand-written SemanticTake JSON, hand-written `.media.json`,+SVML regex geometry extraction, and absolute-path Candidates are retired from the public route.diff --git a/.agents/skills/hypit/references/preview.md b/.agents/skills/hypit/references/preview.mdindex 4aa9cb50..e18975ea 100644--- a/.agents/skills/hypit/references/preview.md+++ b/.agents/skills/hypit/references/preview.md@@ -71,9 +71,9 @@ hypit-reference-video-tools render_element /path/to/project/build.svrun \--element <id> --segment <id>|--selection <id> --out <path>.mp4```-It reads the Canvas, the frame rate, the Recipe values, the Script text and the bindings out of the-Source, mocks every layer a Build has not made, and drives the package's Producer. Nothing about it is-written per package.+It compiles the Author/Run Graph once, delegates preview substitutions to `@hypit/preview-mock`,+materializes ordinary mock Artifacts through `@hypit/mock-media`, and drives the package's deterministic+Producers. No mock file or SemanticTake is hand-authored in the project.`--element` takes the element's bare id — `captions`, the `id=` the Source wrote on the element. Thecommand appends the output suffix itself when it looks for the track, so `--element captions.track`@@ -93,10 +93,8 @@ for eight windows costs one render and eight cuts. The picture does not depend oeverything the Source places over those words — so two elements over one stretch share the render aswell.-Each Segment's length comes from the Source's own `estimate:Speech`, which is the only clock a program-has before its speech is synthesized. The result's `timing` says what sized each Segment, and the same-object is written to `<out>.stand-in.json`. A reconstruction can borrow the reference's clock instead-with `--reference-id`; `reconstruction/comparison-round.md` says when that matters.+Each Segment's length comes from the Source's own `estimate:Speech`; `--reference-id` selects reference+evidence and comparison windows only. The sidecar records `"timing_basis": "estimate"`.## Open the whole Run for a persondiff --git a/.agents/skills/hypit/references/quickstart.md b/.agents/skills/hypit/references/quickstart.mdindex 90a1c904..3f845c82 100644--- a/.agents/skills/hypit/references/quickstart.md+++ b/.agents/skills/hypit/references/quickstart.md@@ -13,10 +13,14 @@ Published docs and installed package declarations are authoritative:| Film and rendering | `../../../../docs/quickstart/composition.md` || Run Source, durable Runtime, Builds, retrieval, and reuse | `../../../../docs/quickstart/run.md` and `runtime.md` |-Canonical path:+Canonical production path:`Script → estimate:Speech/text → Seedance or supplied media → pipeline:Normalize → whisperx:SemanticTake → speech:Track → peer Caption/Media/Typography/Audio Tracks → Film → render:Video`.+Preview path uses the same Graph with `@hypit/preview-mock`: image/video/audio outputs are replaced+by ordinary mock Artifacts, and WhisperX `SemanticTake` is replaced by `semantic-take-estimate` using+`estimate:Speech`. This preview substitution never enters Author Source and is not final timing evidence.+Use explicit imports, exact fonts, Canvas/Frames, the SemanticTrack, Targets, and Runtimeauthority. There is no implicit cache; reuse is explicit with `build-record` + `satisfy`.diff --git a/.agents/skills/hypit/references/reconstruction/comparison-round.md b/.agents/skills/hypit/references/reconstruction/comparison-round.mdindex 787b62be..b644ffba 100644--- a/.agents/skills/hypit/references/reconstruction/comparison-round.md+++ b/.agents/skills/hypit/references/reconstruction/comparison-round.md@@ -1,7 +1,7 @@# Comparing what was built against the reference**Read `../element-review.md` first.** It owns the round this file sits inside: one element at a time,-render what the Source configures, mock what a Build has not made, one round, two attempt ceilings,+render what the Source configures, realize preview mocks for what a Build has not made, one round, two attempt ceilings,measure rather than guess, and the rule that the reader is not the builder. Everything below is what areference adds to that.@@ -24,14 +24,12 @@ looked at, since opening it yourself is what the blindness rule below forbids.Everything else happens on the reconstruction side, which changes every time a package, Recipe orsource edge is edited.-## The render runs on the reference's clock+## The render uses estimate timing-`render_element` takes `--reference-id`, and it times the stand-in from that reference's own-transcript, so each Segment runs for as long as the reference spends on its words. Pass it every time:-the comparison cuts both sides to the same words and refuses a pair whose two halves are different-lengths, and only this clock puts the render on the reference's. It is also what lets anything whose-appearance is a function of elapsed time — a progressive reveal, a typewriter, staggered rows — be-compared at the speed it will be seen at.+`render_element` uses `@hypit/preview-mock` with the Source's `estimate:Speech` timing. `--reference-id`+is reserved for selecting reference evidence and comparison windows, not for constructing mock tracks.+The comparison still cuts both sides to the same words and refuses a pair whose two halves are different+lengths. Animated elements are assessed against the deterministic estimate clock used by preview.A `--batch` round inherits the reference along with the Run, and `reconstruction_check`'s output isthe batch file.@@ -130,7 +128,7 @@ reads them: one subagent per comparison, dispatched together, and never you.- Never tell the observer which picture is the reconstruction, what was built, which component drewit, or what you expect to be wrong. An observer told what to confirm will confirm it.- `--question` carries what to look at, never what to conclude. Three things qualify: which region to- read, which regions to skip because they hold a placeholder standing in for a declared-but-unbuilt+ read, which regions to skip because they hold a preview mock standing in for a declared-but-unbuiltgeneration, and one visible quantity to measure. None of them says which picture is thereconstruction, what was built, or what you expect to be wrong — and a question that hints at theanswer, rather than naming what to look at, has stopped being scope.diff --git a/.agents/skills/hypit/references/reconstruction/evidence.md b/.agents/skills/hypit/references/reconstruction/evidence.mdindex 45f35075..02e6632a 100644--- a/.agents/skills/hypit/references/reconstruction/evidence.md+++ b/.agents/skills/hypit/references/reconstruction/evidence.md@@ -14,7 +14,7 @@ hypit-reference-video-tools compare_reconstruction --reference-id <reference-id>`record_observation` is how the `agent` observer returns an answer; on the `gemini` observer the toolwrites its own and the command is unused. A long answer arrives whole with `--text-file <path>`;-`--text <text>` suits a short one. `make_placeholder` writes the mocks a comparison render needs;+`--text <text>` suits a short one. `render_element` delegates mock generation to `@hypit/preview-mock`;`comparison-round.md` says when. `list_svml_packages` and `inspect_svml_vocabulary` read installedvocabulary and have nothing to do with a reference video — `../vocabulary.md` documents them.diff --git a/.agents/skills/hypit/references/reconstruction/route.md b/.agents/skills/hypit/references/reconstruction/route.mdindex 8bba2541..a1c580e8 100644--- a/.agents/skills/hypit/references/reconstruction/route.md+++ b/.agents/skills/hypit/references/reconstruction/route.md@@ -271,8 +271,8 @@ hypit-reference-video-tools reconstruction_check projects/<name>/build.svrun --rhypit-reference-video-tools render_element projects/<name>/build.svrun --batch round.json --reference-id <id>```-`comparison-round.md` says to pass `--reference-id` every time so the stand-in runs on the-reference's clock. The program is drawn once and every entry is cut out of those frames, so render+`comparison-round.md` uses preview-mock estimate timing; `--reference-id` selects comparison evidence, not mock timing.+The program is drawn once and every entry is cut out of those frames, so renderthe whole list in one `--batch` call.### 20. Send every comparison at oncediff --git a/.agents/skills/hypit/references/reconstruction/vocabulary.md b/.agents/skills/hypit/references/reconstruction/vocabulary.mdindex 73840d9d..62fe0719 100644--- a/.agents/skills/hypit/references/reconstruction/vocabulary.md+++ b/.agents/skills/hypit/references/reconstruction/vocabulary.md@@ -12,6 +12,14 @@ speech, music, sound effects. Work that list, and inspect candidates for each enyou never inspected is a system you are about to invent, and here you would be inventing it against avideo that already answers the question.+**An observation's "base picture" is the full-frame underlying footage** — whatever fills the screen+under any overlays. The authoring base that `continuity.md` defines is a separate thing: it is the+picture showing the speaker saying the words, and `continuity.md` decides which picture that is. A shot observed as "the base picture is a classroom" is a full-frame+classroom; where the speaker is cut away to silently in that classroom while their voice continues,+the classroom is B-roll covering the base (see `../playbooks/craft/b-roll.md`), and the base remains+with the speaker. Read the observation for what fills the frame; read `continuity.md` for which+picture owns base.+## Where an appearance value comes from`../vocabulary.md` says every declared property that changes what the viewer sees must be resolveddiff --git a/package.json b/package.jsonindex 3e56a3b7..46cc1717 100644--- a/package.json+++ b/package.json@@ -86,6 +86,7 @@"@hypit/image-transform": "workspace:*","@hypit/media": "workspace:*","@hypit/media-pipeline": "workspace:*",+ "@hypit/mock-media": "workspace:*","@hypit/media-track": "workspace:*","@hypit/media-track-studio": "workspace:*","@hypit/mimo-tts": "workspace:*",@@ -100,6 +101,7 @@"@hypit/provider-kie": "workspace:*","@hypit/provider-media-aws-lambda": "workspace:*","@hypit/provider-media-local": "workspace:*",+ "@hypit/preview-mock": "workspace:*","@hypit/provider-whisperx-local": "workspace:*","@hypit/provider-xiaomi-mimo": "workspace:*","@hypit/ranking": "workspace:*",diff --git a/packages/compiler-node/src/graph-query.ts b/packages/compiler-node/src/graph-query.tsnew file mode 100644index 00000000..4dcefc16--- /dev/null+++ b/packages/compiler-node/src/graph-query.ts@@ -0,0 +1,51 @@+import {+ resolveCandidate,+ resolveLogicalOutput,+ resolveOperation,+} from "@hypit/core";+import type {+ Candidate,+ CompiledGraph,+ GraphValueRef,+ LogicalOutput,+ OperationNode,+ ProducerRef,+} from "@hypit/protocol";++/** Read-only Graph helpers shared by preview and other host tooling. */++export function findLogicalOutput(graph: CompiledGraph, outputId: string): LogicalOutput | undefined {+ try { return resolveLogicalOutput(graph, outputId); } catch { return undefined; }+}++export function findCandidate(graph: CompiledGraph, candidateId: string): Candidate | undefined {+ try { return resolveCandidate(graph, candidateId); } catch { return undefined; }+}++export function findOperation(graph: CompiledGraph, operationId: string): OperationNode | undefined {+ try { return resolveOperation(graph, operationId); } catch { return undefined; }+}++export function findOperationsByProducer(graph: CompiledGraph, producer: ProducerRef): readonly OperationNode[] {+ return graph.operations.filter((operation) =>+ operation.producer.module.name === producer.module.name+ && operation.producer.module.version === producer.module.version+ && operation.producer.name === producer.name,+ );+}++/** Walk operation inputs in dependency order, excluding authored Records and Logical Outputs. */+export function walkOperationInputs(graph: CompiledGraph, operationId: string): readonly OperationNode[] {+ const result: OperationNode[] = [];+ const visited = new Set<string>();+ const visitRef = (ref: GraphValueRef): void => {+ if (ref.kind !== "operation-result" || visited.has(ref.operation)) return;+ const operation = findOperation(graph, ref.operation);+ if (operation === undefined) return;+ visited.add(ref.operation);+ for (const input of Object.values(operation.inputs)) visitRef(input);+ result.push(operation);+ };+ visitRef({ kind: "operation-result", operation: operationId });+ return result;+}diff --git a/packages/compiler-node/src/index.ts b/packages/compiler-node/src/index.tsindex 1c4f61f9..f6014179 100644--- a/packages/compiler-node/src/index.ts+++ b/packages/compiler-node/src/index.ts@@ -18,3 +18,10 @@ export type {NodeRunCompilerOptions,PlannedBuild,} from "./run.js";+export {+ findCandidate,+ findLogicalOutput,+ findOperation,+ findOperationsByProducer,+ walkOperationInputs,+} from "./graph-query.js";diff --git a/packages/core/src/index.ts b/packages/core/src/index.tsindex cf33e271..47587c1b 100644--- a/packages/core/src/index.ts+++ b/packages/core/src/index.ts@@ -10,6 +10,11 @@ export {export {sealBuildRequest,sealCompiledGraph,+ resolveLogicalOutput,+ resolveCandidate,+ resolveOperation,+ satisfiedCandidate,+ operationResultRecord,verifyBuildRequest,verifyCompiledGraph,} from "./graph.js";diff --git a/packages/media-execution/src/execute.ts b/packages/media-execution/src/execute.tsindex 0128c4af..2d2b70b1 100644--- a/packages/media-execution/src/execute.ts+++ b/packages/media-execution/src/execute.ts@@ -4,6 +4,7 @@ import { createReadStream } from "node:fs";import { mkdtemp, open, readFile, rm, writeFile } from "node:fs/promises";import { tmpdir } from "node:os";import { join } from "node:path";+import { deflateSync } from "node:zlib";import { mediaTypes, sealMediaInspection, sealMuxedMedia, sealSynchronizedMedia, sealTimelineAudio, verifyMediaInspection, verifyMediaStreamSelection, verifyRenderedVisual, verifySynchronizedMedia, verifyTimelineAudio } from "@hypit/media";import type { MediaAudioStream, MediaInspection, MediaRational, MediaStream, MediaStreamSelection, MediaTimestamp, MediaVideoStream, MuxedMedia, RenderedVisual, SynchronizedMedia, TimelineAudio } from "@hypit/media";import type { ProgramSpace } from "@hypit/program-space";@@ -71,6 +72,27 @@ export type MediaOperationResult = {readonly value: StoredValue;};+export type RenderMockImageRequest = {+ readonly width: number;+ readonly height: number;+ readonly color: string;+};++export type RenderMockVideoRequest = {+ readonly width: number;+ readonly height: number;+ readonly frameRate: MediaRational;+ readonly frameCount: number;+ readonly color: string;+ readonly audio: "silence" | "none";+};++export type RenderMockSilenceRequest = {+ readonly sampleRate: 48_000;+ readonly channels: 2;+ readonly sampleFrames: number;+};+function assert(condition: unknown, message: string): asserts condition {if (!condition) throw new Error(message);}@@ -431,6 +453,133 @@ function artifactResult(value: BlobRef): MediaOperationResult {return { value };}+function mockColor(value: string): [number, number, number] {+ assert(/^#[0-9a-f]{6}$/iu.test(value), "Mock color must be a six-digit hex color");+ return [parseInt(value.slice(1, 3), 16), parseInt(value.slice(3, 5), 16), parseInt(value.slice(5, 7), 16)];+}++function crc32(bytes: Uint8Array): number {+ let crc = 0xFFFFFFFF;+ for (const byte of bytes) {+ crc ^= byte;+ for (let bit = 0; bit < 8; bit += 1) crc = (crc >>> 1) ^ (crc & 1 ? 0xEDB88320 : 0);+ }+ return (crc ^ 0xFFFFFFFF) >>> 0;+}++function pngChunk(type: string, data: Uint8Array): Uint8Array {+ const body = new Uint8Array(type.length + data.length);+ for (let index = 0; index < type.length; index += 1) body[index] = type.charCodeAt(index);+ body.set(data, type.length);+ const result = new Uint8Array(12 + data.length);+ const view = new DataView(result.buffer);+ view.setUint32(0, data.length);+ result.set(body, 4);+ view.setUint32(8 + data.length, crc32(body));+ return result;+}++function mockPng(width: number, height: number, color: string): Uint8Array {+ positiveInteger(width, "Mock image width");+ positiveInteger(height, "Mock image height");+ const [red, green, blue] = mockColor(color);+ const scanlines = Buffer.alloc(height * (1 + width * 3));+ for (let row = 0; row < height; row += 1) {+ const offset = row * (1 + width * 3);+ scanlines[offset] = 0;+ for (let column = 0; column < width; column += 1) {+ const pixel = offset + 1 + column * 3;+ scanlines[pixel] = red;+ scanlines[pixel + 1] = green;+ scanlines[pixel + 2] = blue;+ }+ }+ const header = Buffer.alloc(13);+ header.writeUInt32BE(width, 0); header.writeUInt32BE(height, 4);+ header[8] = 8; header[9] = 2;+ return Uint8Array.from(Buffer.concat([+ Buffer.from("\x89PNG\r\n\x1a\n", "binary"),+ Buffer.from(pngChunk("IHDR", header)),+ Buffer.from(pngChunk("IDAT", deflateSync(scanlines))),+ Buffer.from(pngChunk("IEND", new Uint8Array())),+ ]));+}++function mockSilenceWav(sampleFrames: number): Uint8Array {+ positiveInteger(sampleFrames, "Mock silence sampleFrames");+ const dataBytes = sampleFrames * 2 * 2;+ const wav = Buffer.alloc(44 + dataBytes);+ wav.write("RIFF", 0); wav.writeUInt32LE(36 + dataBytes, 4); wav.write("WAVE", 8);+ wav.write("fmt ", 12); wav.writeUInt32LE(16, 16); wav.writeUInt16LE(1, 20);+ wav.writeUInt16LE(2, 22); wav.writeUInt32LE(48_000, 24); wav.writeUInt32LE(48_000 * 4, 28);+ wav.writeUInt16LE(4, 32); wav.writeUInt16LE(16, 34); wav.write("data", 36); wav.writeUInt32LE(dataBytes, 40);+ return Uint8Array.from(wav);+}++function mockImageNeed(value: CanonicalValue): RenderMockImageRequest {+ const item = object(value, "RenderMockImageRequest") as unknown as RenderMockImageRequest;+ positiveInteger(item.width, "Mock image width"); positiveInteger(item.height, "Mock image height"); mockColor(item.color);+ return item;+}++function mockVideoNeed(value: CanonicalValue): RenderMockVideoRequest {+ const item = object(value, "RenderMockVideoRequest") as unknown as RenderMockVideoRequest;+ positiveInteger(item.width, "Mock video width"); positiveInteger(item.height, "Mock video height");+ positiveInteger(item.frameCount, "Mock video frameCount"); mockColor(item.color);+ assert(item.audio === "silence" || item.audio === "none", "Mock video audio mode is invalid");+ assert(Number.isSafeInteger(item.frameRate?.numerator) && item.frameRate.numerator > 0+ && Number.isSafeInteger(item.frameRate?.denominator) && item.frameRate.denominator > 0,+ "Mock video frameRate is invalid");+ return item;+}++function mockSilenceNeed(value: CanonicalValue): RenderMockSilenceRequest {+ const item = object(value, "RenderMockSilenceRequest") as unknown as RenderMockSilenceRequest;+ assert(item.sampleRate === 48_000 && item.channels === 2, "Mock silence format must be 48kHz stereo");+ positiveInteger(item.sampleFrames, "Mock silence sampleFrames");+ return item;+}++export async function executeRenderMockImage(+ env: MediaExecutionEnvironment,+ constraints: CanonicalValue,+): Promise<MediaOperationResult> {+ return artifactResult(await env.artifacts.put(mockPng(mockImageNeed(constraints).width, mockImageNeed(constraints).height, mockImageNeed(constraints).color), "image/png"));+}++export async function executeRenderMockSilence(+ env: MediaExecutionEnvironment,+ constraints: CanonicalValue,+): Promise<MediaOperationResult> {+ const request = mockSilenceNeed(constraints);+ return artifactResult(await env.artifacts.put(mockSilenceWav(request.sampleFrames), "audio/wav"));+}++export async function executeRenderMockVideo(+ env: MediaExecutionEnvironment,+ constraints: CanonicalValue,+): Promise<MediaOperationResult> {+ const request = mockVideoNeed(constraints);+ const work = await mkdtemp(join(tmpdir(), "hypit-media-mock-video-"));+ try {+ const output = join(work, "mock.mp4");+ const rate = `${request.frameRate.numerator}/${request.frameRate.denominator}`;+ const duration = request.frameCount * request.frameRate.denominator / request.frameRate.numerator;+ const filter = `color=c=${request.color.slice(1)}:s=${request.width}x${request.height}:r=${rate}:d=${duration}`;+ const argv = ["-y", "-v", "error", "-f", "lavfi", "-i", filter,+ ...(request.audio === "silence" ? ["-f", "lavfi", "-i", `anullsrc=r=48000:cl=stereo`] : []),+ "-frames:v", String(request.frameCount), ...(request.audio === "silence"+ ? ["-map", "0:v:0", "-map", "1:a:0", "-c:a", "pcm_s16le", "-shortest"]+ : ["-an"]), "-c:v", "libx264", "-pix_fmt", "yuv420p", "-r", rate,+ "-movflags", "+faststart", output];+ await runProcess({ executable: env.ffmpegPath, argv, timeoutMs: env.processTimeoutMs, maxStdoutBytes: 64 * 1024,+ ...(env.sharedLibraryPath === undefined ? {} : { sharedLibraryPath: env.sharedLibraryPath }) });+ return artifactResult(await env.artifacts.putFile(output, "video/mp4"));+ } finally {+ await rm(work, { recursive: true, force: true }).catch(() => {});+ }+}+function inspectNeed(value: CanonicalValue): InspectMediaNeed {const item = object(value, "InspectMediaNeed") as unknown as InspectMediaNeed;assert(item.source?.kind === "blob", "InspectMediaNeed is invalid");diff --git a/packages/media-execution/src/index.ts b/packages/media-execution/src/index.tsindex fcc10457..4206ee57 100644--- a/packages/media-execution/src/index.ts+++ b/packages/media-execution/src/index.ts@@ -7,6 +7,9 @@ export {executeProjectSpeechEvidenceAudio,executeRenderTimelineAudio,executeRenderStillVideo,+ executeRenderMockImage,+ executeRenderMockVideo,+ executeRenderMockSilence,executeTransformMedia,} from "./execute.js";export { parseMediaInspection } from "./probe.js";diff --git a/packages/media-track/preview/preview.svml b/packages/media-track/preview/preview.svmlindex e66b258d..8e745afc 100644--- a/packages/media-track/preview/preview.svml+++ b/packages/media-track/preview/preview.svml@@ -60,7 +60,7 @@<pipeline:Normalize id="motion-b-media" source={motion-b.video}recipe={recipes.media.broll} clock={clock}/><whisperx:SemanticTake id="showcase-semantic" narrative={story}- segment={story.segment.showcase} media={take-media.media}/>+ segment={story.segment.showcase} media={take-media.media} language="en"/><speech:Track id="speech"visual-frame={speech-frame} visual-appearance={recipes.speech.visual} visual-z="0">diff --git a/packages/mock-media/README.md b/packages/mock-media/README.mdnew file mode 100644index 00000000..ea2e4d33--- /dev/null+++ b/packages/mock-media/README.md@@ -0,0 +1,5 @@+# `@hypit/mock-media`++Preview-only mock media Fragments and their `render-mock-image`, `render-mock-video`, and+`render-mock-silence` capability contracts. The local Provider executes these capabilities into+ordinary content-addressed `BlobArtifact` values; no mock type or user Source is introduced.diff --git a/packages/mock-media/package.json b/packages/mock-media/package.jsonnew file mode 100644index 00000000..9c512ac4--- /dev/null+++ b/packages/mock-media/package.json@@ -0,0 +1,19 @@+{+ "name": "@hypit/mock-media",+ "version": "0.0.0-dev",+ "license": "SEE LICENSE IN LICENSE",+ "private": true,+ "type": "module",+ "exports": { ".": "./src/index.ts" },+ "hypit": { "activation": "./src/activation.ts" },+ "dependencies": {+ "@hypit/artifact": "workspace:*",+ "@hypit/elaborator": "workspace:*",+ "@hypit/media": "workspace:*",+ "@hypit/program-space": "workspace:*",+ "@hypit/protocol": "workspace:*",+ "@hypit/run": "workspace:*",+ "@hypit/spatial": "workspace:*",+ "@hypit/speech": "workspace:*"+ }+}diff --git a/packages/mock-media/src/activation.ts b/packages/mock-media/src/activation.tsnew file mode 100644index 00000000..b1c2f507--- /dev/null+++ b/packages/mock-media/src/activation.ts@@ -0,0 +1,14 @@+import { createRunFragmentHostFacet } from "@hypit/run";+import { mockImageFragment, mockMediaManifest, mockMediaModuleRef, mockSilenceFragment, mockVideoFragment } from "./index.js";+import { mockMediaComponent } from "./component.js";++export const hypitPackage = {+ format: "hypit.node-package@1" as const,+ modules: [{ manifest: mockMediaManifest }],+ components: [mockMediaComponent],+ hostFacets: [createRunFragmentHostFacet({+ name: "@hypit/mock-media@1",+ fragments: { image: mockImageFragment, video: mockVideoFragment, silence: mockSilenceFragment },+ })],+};+export default hypitPackage;diff --git a/packages/mock-media/src/component.ts b/packages/mock-media/src/component.tsnew file mode 100644index 00000000..e654e97d--- /dev/null+++ b/packages/mock-media/src/component.ts@@ -0,0 +1,56 @@+import { canonicalize } from "@hypit/protocol";+import type { StoredValue } from "@hypit/protocol";+import type { CanvasSpace } from "@hypit/spatial";+import type { ProgramClock } from "@hypit/program-space";+import type { SpeechDuration } from "@hypit/speech";+import { assertProgramClockIdentity } from "@hypit/program-space";+import { assertSpeechDurationIdentity } from "@hypit/speech";+import { mockMediaProducers } from "./manifest.js";++function inline<T>(value: StoredValue, subject: string): T {+ if (value.kind !== "inline") throw new Error(`${subject} must be inline`);+ return value.value as T;+}++function canvas(value: StoredValue): CanvasSpace {+ const item = inline<CanvasSpace>(value, "Mock Canvas");+ if (!Number.isSafeInteger(item.widthPx) || item.widthPx <= 0 || !Number.isSafeInteger(item.heightPx) || item.heightPx <= 0) {+ throw new Error("Mock Canvas dimensions are invalid");+ }+ return item;+}++function color(): string { return "#9AA0A6"; }++export const mockMediaComponent = {+ producers: [+ {+ producer: mockMediaProducers.image,+ handler: ({ inputs }: { readonly inputs: Readonly<Record<string, { readonly value: StoredValue }>> }) => {+ const size = canvas(inputs.canvas!.value);+ return { outputs: {}, needs: { image: canonicalize({ width: size.widthPx, height: size.heightPx, color: color() }) } };+ },+ },+ {+ producer: mockMediaProducers.video,+ handler: ({ inputs }: { readonly inputs: Readonly<Record<string, { readonly value: StoredValue }>> }) => {+ const size = canvas(inputs.canvas!.value);+ const duration = inline<SpeechDuration>(inputs.duration!.value, "Mock video duration");+ const clock = inline<ProgramClock>(inputs.clock!.value, "Mock video clock");+ assertSpeechDurationIdentity(duration); assertProgramClockIdentity(clock);+ const frameCount = Math.max(1, Math.round(duration * clock.frameRate.numerator / clock.frameRate.denominator));+ return { outputs: {}, needs: { video: canonicalize({ width: size.widthPx, height: size.heightPx,+ frameRate: clock.frameRate, frameCount, color: color(), audio: "silence" }) } };+ },+ },+ {+ producer: mockMediaProducers.silence,+ handler: ({ inputs }: { readonly inputs: Readonly<Record<string, { readonly value: StoredValue }>> }) => {+ const duration = inline<SpeechDuration>(inputs.duration!.value, "Mock silence duration");+ assertSpeechDurationIdentity(duration);+ return { outputs: {}, needs: { audio: canonicalize({ sampleRate: 48_000, channels: 2,+ sampleFrames: Math.max(1, Math.round(duration * 48_000)) }) } };+ },+ },+ ],+};diff --git a/packages/mock-media/src/fragment.ts b/packages/mock-media/src/fragment.tsnew file mode 100644index 00000000..700a0943--- /dev/null+++ b/packages/mock-media/src/fragment.ts@@ -0,0 +1,31 @@+import { artifactTypes } from "@hypit/artifact";+import { sealGraphFragment } from "@hypit/elaborator";+import { programSpaceTypes } from "@hypit/program-space";+import { spatialTypes } from "@hypit/spatial";+import { speechTypes } from "@hypit/speech";+import { mockMediaProducers } from "./manifest.js";++const input = (name: string) => ({ kind: "fragment-input" as const, name });+const operation = (name: string) => ({ kind: "fragment-operation" as const, operation: name });++export const mockImageFragment = sealGraphFragment({+ inputs: [{ name: "canvas", type: spatialTypes.canvas }],+ operations: [{ id: "image", producer: mockMediaProducers.image, inputs: { canvas: input("canvas") }, result: { kind: "need", name: "image" } }],+ exports: [{ name: "image", type: artifactTypes.blob, root: operation("image") }],+});++export const mockVideoFragment = sealGraphFragment({+ inputs: [+ { name: "canvas", type: spatialTypes.canvas },+ { name: "duration", type: speechTypes.duration },+ { name: "clock", type: programSpaceTypes.clock },+ ],+ operations: [{ id: "video", producer: mockMediaProducers.video, inputs: { canvas: input("canvas"), duration: input("duration"), clock: input("clock") }, result: { kind: "need", name: "video" } }],+ exports: [{ name: "video", type: artifactTypes.blob, root: operation("video") }],+});++export const mockSilenceFragment = sealGraphFragment({+ inputs: [{ name: "duration", type: speechTypes.duration }],+ operations: [{ id: "silence", producer: mockMediaProducers.silence, inputs: { duration: input("duration") }, result: { kind: "need", name: "audio" } }],+ exports: [{ name: "audio", type: artifactTypes.blob, root: operation("silence") }],+});diff --git a/packages/mock-media/src/index.ts b/packages/mock-media/src/index.tsnew file mode 100644index 00000000..8c7e4a70--- /dev/null+++ b/packages/mock-media/src/index.ts@@ -0,0 +1,6 @@+export { mockMediaManifest, mockMediaModuleRef, mockMediaTypes, mockMediaCapabilities, mockMediaProducers } from "./manifest.js";+export { mockImageFragment, mockVideoFragment, mockSilenceFragment } from "./fragment.js";+export { mockMediaComponent } from "./component.js";+export type MockImageRequest = { readonly width: number; readonly height: number; readonly color: string };+export type MockVideoRequest = { readonly width: number; readonly height: number; readonly frameRate: import("@hypit/media").MediaRational; readonly frameCount: number; readonly color: string; readonly audio: "silence" | "none" };+export type MockSilenceRequest = { readonly sampleRate: 48_000; readonly channels: 2; readonly sampleFrames: number };diff --git a/packages/mock-media/src/manifest.ts b/packages/mock-media/src/manifest.tsnew file mode 100644index 00000000..3c878997--- /dev/null+++ b/packages/mock-media/src/manifest.ts@@ -0,0 +1,42 @@+import { artifactTypes } from "@hypit/artifact";+import { programSpaceTypes } from "@hypit/program-space";+import type { CapabilityRef, ModuleManifest, ProducerRef, TypeRef } from "@hypit/protocol";+import { spatialTypes } from "@hypit/spatial";+import { speechTypes } from "@hypit/speech";++export const mockMediaModuleRef = { name: "@hypit/mock-media", version: "1" } as const;+export const mockMediaTypes = {+ imageRequest: { module: mockMediaModuleRef, name: "MockImageRequest" },+ videoRequest: { module: mockMediaModuleRef, name: "MockVideoRequest" },+ silenceRequest: { module: mockMediaModuleRef, name: "MockSilenceRequest" },+} satisfies Record<string, TypeRef>;+export const mockMediaCapabilities = {+ image: { module: mockMediaModuleRef, name: "render-mock-image" },+ video: { module: mockMediaModuleRef, name: "render-mock-video" },+ silence: { module: mockMediaModuleRef, name: "render-mock-silence" },+} satisfies Record<string, CapabilityRef>;+export const mockMediaProducers = {+ image: { module: mockMediaModuleRef, name: "request-mock-image" },+ video: { module: mockMediaModuleRef, name: "request-mock-video" },+ silence: { module: mockMediaModuleRef, name: "request-mock-silence" },+} satisfies Record<string, ProducerRef>;++const canvas = { module: spatialTypes.canvas.module, name: spatialTypes.canvas.name } as const;+export const mockMediaManifest: ModuleManifest = {+ format: "hypit.module@1",+ name: mockMediaModuleRef.name,+ version: mockMediaModuleRef.version,+ dependencies: [+ { module: { name: "@hypit/artifact", version: "1" } },+ { module: { name: "@hypit/program-space", version: "1" } },+ { module: { name: "@hypit/spatial", version: "1" } },+ { module: { name: "@hypit/speech", version: "1" } },+ ],+ types: Object.values(mockMediaTypes).map((item) => ({ name: item.name })),+ capabilities: Object.values(mockMediaCapabilities).map((item) => ({ name: item.name, returns: artifactTypes.blob })),+ producers: [+ { name: mockMediaProducers.image.name, inputs: [{ name: "canvas", type: canvas }], outputs: [], needs: [{ name: "image", capability: mockMediaCapabilities.image, returns: artifactTypes.blob }] },+ { name: mockMediaProducers.video.name, inputs: [{ name: "canvas", type: canvas }, { name: "duration", type: speechTypes.duration }, { name: "clock", type: programSpaceTypes.clock }], outputs: [], needs: [{ name: "video", capability: mockMediaCapabilities.video, returns: artifactTypes.blob }] },+ { name: mockMediaProducers.silence.name, inputs: [{ name: "duration", type: speechTypes.duration }], outputs: [], needs: [{ name: "audio", capability: mockMediaCapabilities.silence, returns: artifactTypes.blob }] },+ ],+};diff --git a/packages/preview-mock/README.md b/packages/preview-mock/README.mdnew file mode 100644index 00000000..397604c1--- /dev/null+++ b/packages/preview-mock/README.md@@ -0,0 +1,4 @@+# `@hypit/preview-mock`++The preview Mock Realizer. It maps compiled Graph outputs to mock Fragments, writes an isolated+temporary `preview.svrun`, and returns preview attachments and provenance with `estimate` timing.diff --git a/packages/preview-mock/package.json b/packages/preview-mock/package.jsonnew file mode 100644index 00000000..04d61f7e--- /dev/null+++ b/packages/preview-mock/package.json@@ -0,0 +1,23 @@+{+ "name": "@hypit/preview-mock",+ "version": "0.0.0-dev",+ "license": "SEE LICENSE IN LICENSE",+ "private": true,+ "type": "module",+ "exports": { ".": "./src/index.ts" },+ "hypit": { "activation": "./src/activation.ts" },+ "dependencies": {+ "@hypit/artifact": "workspace:*",+ "@hypit/compiler-node": "workspace:*",+ "@hypit/driver-node": "workspace:*",+ "@hypit/mock-media": "workspace:*",+ "@hypit/provider-media-local": "workspace:*",+ "@hypit/protocol": "workspace:*",+ "@hypit/spatial": "workspace:*",+ "@hypit/media": "workspace:*",+ "@hypit/program-space": "workspace:*",+ "@hypit/speech": "workspace:*",+ "@hypit/semantic-take-estimate": "workspace:*",+ "@hypit/workspace": "workspace:*"+ }+}diff --git a/packages/preview-mock/src/activation.ts b/packages/preview-mock/src/activation.tsnew file mode 100644index 00000000..c63f5283--- /dev/null+++ b/packages/preview-mock/src/activation.ts@@ -0,0 +1,2 @@+export const hypitPackage = { format: "hypit.node-package@1" as const };+export default hypitPackage;diff --git a/packages/preview-mock/src/geometry.ts b/packages/preview-mock/src/geometry.tsnew file mode 100644index 00000000..195c8cb0--- /dev/null+++ b/packages/preview-mock/src/geometry.ts@@ -0,0 +1,39 @@+import type { CompiledGraph, StoredValue } from "@hypit/protocol";+import { findLogicalOutput, findCandidate } from "@hypit/compiler-node";+import { spatialTypes } from "@hypit/spatial";++function inline(value: StoredValue | undefined): unknown {+ return value?.kind === "inline" ? value.value : undefined;+}++export type MockGeometry = { readonly width: number; readonly height: number };++/** Geometry is a graph fact; resolution labels are intentionally not interpreted as pixels. */+export function deriveGeometry(graph: CompiledGraph, outputs: readonly string[]): MockGeometry {+ const candidates = outputs.flatMap((id) => {+ const output = findLogicalOutput(graph, id);+ return output === undefined ? [] : [findCandidate(graph, output.primary)];+ }).filter((item): item is NonNullable<typeof item> => item !== undefined);+ const canvas = graph.outputs+ .filter((output) => output.type.module.name === spatialTypes.canvas.module.name && output.type.name === spatialTypes.canvas.name)+ .map((output) => findCandidate(graph, output.primary))+ .find((candidate) => candidate?.root.kind === "value");+ const value = canvas?.root.kind === "value" ? inline(canvas.root.value.value) as { widthPx?: unknown; heightPx?: unknown } : undefined;+ if (value !== undefined && Number.isSafeInteger(value.widthPx) && Number.isSafeInteger(value.heightPx)+ && (value.widthPx as number) > 0 && (value.heightPx as number) > 0) {+ return { width: value.widthPx as number, height: value.heightPx as number };+ }+ const ratios = candidates.flatMap((candidate) => {+ if (candidate.root.kind !== "value") return [];+ const item = inline(candidate.root.value.value) as { aspectRatio?: unknown; width?: unknown; height?: unknown };+ if (typeof item.aspectRatio === "number" && item.aspectRatio > 0) return [item.aspectRatio];+ if (typeof item.width === "number" && typeof item.height === "number" && item.width > 0 && item.height > 0) return [item.width / item.height];+ return [];+ });+ if (ratios.length > 0 && ratios.every((ratio) => Math.abs(ratio - ratios[0]!) < 1e-9)) {+ const width = 1920;+ return { width, height: Math.max(1, Math.round(width / ratios[0]!)) };+ }+ if (ratios.length > 1) throw new Error("Preview mock geometry has conflicting aspect-ratio declarations");+ return { width: 1920, height: 1080 };+}diff --git a/packages/preview-mock/src/graph.ts b/packages/preview-mock/src/graph.tsnew file mode 100644index 00000000..8de7672e--- /dev/null+++ b/packages/preview-mock/src/graph.ts@@ -0,0 +1,136 @@+import type { CompiledGraph, Candidate, TypedRecord } from "@hypit/protocol";+import { findLogicalOutput, findCandidate, findOperation } from "@hypit/compiler-node";+import type { GraphValueRef, TypeRef } from "@hypit/protocol";++export type MockKind = "image" | "video" | "audio" | "semantic-take";+export type MockTarget = { readonly output: string; readonly candidate: Candidate; readonly kind: MockKind; readonly inputs: Readonly<Record<string, string>> };++function sameType(left: TypeRef | undefined, module: string, name: string): boolean {+ return left?.module.name === module && left.name === name;+}++function refType(graph: CompiledGraph, ref: GraphValueRef, records: readonly TypedRecord[] = []): TypeRef | undefined {+ if (ref.kind === "logical-output") return findLogicalOutput(graph, ref.id)?.type;+ if (ref.kind === "record") return records.find((item) => item.id === ref.id)?.type+ ?? graph.candidates.find((item) => item.root.kind === "value" && item.root.value.id === ref.id)?.type;+ const operation = findOperation(graph, ref.operation);+ if (operation === undefined) return undefined;+ return graph.candidates.find((item) => item.root.kind === "operation" && item.root.result.operation === ref.operation)?.type;+}++function firstRefOfType(graph: CompiledGraph, type: { module: string; name: string }, records: readonly TypedRecord[] = []): string | undefined {+ for (const output of graph.outputs) if (sameType(output.type, type.module, type.name)) return output.id;+ const record = records.find((item) => sameType(item.type, type.module, type.name));+ if (record !== undefined) return record.id;+ for (const operation of graph.operations) {+ for (const ref of Object.values(operation.inputs)) {+ if (sameType(refType(graph, ref), type.module, type.name)) {+ const id = logicalId(graph, ref);+ if (id !== undefined) return id;+ }+ }+ }+ return undefined;+}++function logicalId(graph: CompiledGraph, ref: GraphValueRef | undefined): string | undefined {+ if (ref === undefined) return undefined;+ if (ref.kind === "logical-output") return ref.id;+ if (ref.kind === "record") return ref.id;+ if (ref.kind !== "operation-result") return undefined;+ const candidate = graph.candidates.find((item) => item.root.kind === "operation" && item.root.result.operation === ref.operation);+ return candidate === undefined ? undefined : graph.outputs.find((output) => output.primary === candidate.id)?.id;+}++function mockInputs(graph: CompiledGraph, kind: MockKind, operation: ReturnType<typeof findOperation>, records: readonly TypedRecord[] = []): Readonly<Record<string, string>> {+ const refs = operation?.inputs ?? {};+ const byName = (name: string): string | undefined => logicalId(graph, refs[name]!);+ const byType = (module: string, name: string): string | undefined => {+ for (const ref of Object.values(refs)) {+ const id = logicalId(graph, ref);+ if (id !== undefined && sameType(refType(graph, ref, records), module, name)) return id;+ }+ return firstRefOfType(graph, { module, name }, records);+ };+ if (kind === "image") {+ const canvas = byName("canvas") ?? byType("@hypit/spatial", "CanvasSpace");+ return canvas === undefined ? {} : { canvas };+ }+ if (kind === "video") {+ const canvas = byName("canvas") ?? byType("@hypit/spatial", "CanvasSpace");+ const duration = byName("duration") ?? byType("@hypit/speech", "SpeechDuration");+ const clock = byName("clock") ?? byType("@hypit/program-space", "ProgramClock");+ return Object.fromEntries([["canvas", canvas], ["duration", duration], ["clock", clock]].filter((item): item is [string, string] => item[1] !== undefined));+ }+ if (kind === "audio") {+ const duration = byName("duration") ?? byType("@hypit/speech", "SpeechDuration");+ return duration === undefined ? {} : { duration };+ }+ const result: Record<string, string | undefined> = {};+ for (const name of ["narrative", "segment", "media", "policy"]) {+ const direct = byName(name);+ if (direct !== undefined) result[name] = direct;+ }+ result.policy ??= (() => {+ for (const item of graph.operations) {+ const ref = item.inputs.policy;+ const id = logicalId(graph, ref);+ if (id !== undefined) return id;+ }+ return undefined;+ })();+ result.narrative ??= byType("@hypit/narrative", "Narrative");+ result.segment ??= byType("@hypit/narrative", "NarrativeExcerpt");+ result.media ??= byType("@hypit/media", "SynchronizedMedia");+ result.policy ??= byType("@hypit/estimate", "SpeechEstimatePolicy");+ return Object.fromEntries(Object.entries(result).filter(([, value]) => value !== undefined && value.length > 0)) as Readonly<Record<string, string>>;+}++export function findMockTargets(graph: CompiledGraph, targets?: readonly string[], records: readonly TypedRecord[] = []): readonly MockTarget[] {+ const selected = targets ?? graph.outputs.map((item) => item.id);+ const closure = new Set<string>();+ const visitOperation = (operationId: string): void => {+ const operation = findOperation(graph, operationId);+ if (operation === undefined) return;+ for (const ref of Object.values(operation.inputs)) {+ if (ref.kind === "logical-output") visitOutput(ref.id);+ else if (ref.kind === "operation-result") {+ const candidate = graph.candidates.find((item) => item.root.kind === "operation" && item.root.result.operation === ref.operation);+ const output = candidate === undefined ? undefined : graph.outputs.find((item) => item.primary === candidate.id);+ if (output !== undefined) visitOutput(output.id);+ else visitOperation(ref.operation);+ }+ }+ };+ const visitOutput = (id: string): void => {+ if (closure.has(id)) return;+ closure.add(id);+ const output = findLogicalOutput(graph, id);+ if (output === undefined) return;+ const candidate = findCandidate(graph, output.primary);+ if (candidate?.root.kind !== "operation") return;+ visitOperation(candidate.root.result.operation);+ };+ for (const id of selected) visitOutput(id);+ const result: MockTarget[] = [];+ for (const id of closure) {+ const output = findLogicalOutput(graph, id);+ if (output === undefined) continue;+ const candidate = findCandidate(graph, output.primary);+ if (candidate === undefined) continue;+ let resolved: MockKind | undefined;+ if (output.type.module.name === "@hypit/speech" && output.type.name === "SemanticTake") resolved = "semantic-take";+ else if (output.type.module.name === "@hypit/artifact" && output.type.name === "BlobArtifact" && candidate.root.kind === "operation") {+ const operation = findOperation(graph, candidate.root.result.operation);+ if (operation?.producer.module.name === "@hypit/media-pipeline") continue;+ const name = operation?.producer.name.toLowerCase() ?? "";+ if (name.includes("project-mux") || name === "mux" || name.includes("render-composition")) continue;+ resolved = operation?.producer.module.name === "@hypit/gpt-image" || name.includes("image") || name.includes("picture") ? "image"+ : name.includes("video") || name.includes("visual") || name.includes("media") ? "video"+ : name.includes("audio") || name.includes("speech") || name.includes("tts") || name.includes("wav") ? "audio" : undefined;+ }+ const operation = candidate.root.kind === "operation" ? findOperation(graph, candidate.root.result.operation) : undefined;+ if (resolved !== undefined) result.push({ output: id, candidate, kind: resolved, inputs: mockInputs(graph, resolved, operation, records) });+ }+ return result;+}diff --git a/packages/preview-mock/src/index.ts b/packages/preview-mock/src/index.tsnew file mode 100644index 00000000..70dd8d8a--- /dev/null+++ b/packages/preview-mock/src/index.ts@@ -0,0 +1,4 @@+export { realizePreviewMock } from "./realizer.js";+export type { PreviewMockRequest, PreviewMockResult, PreviewMockTiming } from "./realizer.js";+export { findMockTargets } from "./graph.js";+export { deriveGeometry } from "./geometry.js";diff --git a/packages/preview-mock/src/materialize.ts b/packages/preview-mock/src/materialize.tsnew file mode 100644index 00000000..8bd63877--- /dev/null+++ b/packages/preview-mock/src/materialize.ts@@ -0,0 +1,17 @@+import type { ArtifactAttachment } from "@hypit/workspace";+import type { BlobRef } from "@hypit/protocol";+import { MemoryArtifactStore, EndpointRegistry } from "@hypit/driver-node";+import { createLocalMediaProvider } from "@hypit/provider-media-local";+import { mockMediaCapabilities } from "@hypit/mock-media";++export async function materializeMockNeed(input: { readonly capability: typeof mockMediaCapabilities[keyof typeof mockMediaCapabilities]; readonly constraints: unknown }): Promise<{ readonly artifact: BlobRef; readonly attachment: ArtifactAttachment }> {+ const artifacts = new MemoryArtifactStore();+ const registry = new EndpointRegistry();+ await createLocalMediaProvider({}).install(registry);+ const registration = registry.resolve({ id: "mock", capability: input.capability, returns: { module: { name: "@hypit/artifact", version: "1" }, name: "BlobArtifact" }, constraints: input.constraints as never, result: "mock" });+ if (registration.status !== "resolved" || registration.registration.kind !== "immediate") throw new Error(`No local mock capability configured for ${input.capability.name}`);+ const result = await registration.registration.handler({ command: { kind: "fulfill-need", id: "mock", need: { id: "mock", capability: input.capability, returns: registration.registration.returns, constraints: input.constraints as never, result: "mock" } }, need: { id: "mock", capability: input.capability, returns: registration.registration.returns, constraints: input.constraints as never, result: "mock" }, artifacts, credentials: {} });+ if (result.value.kind !== "blob") throw new Error("Mock Provider returned a non-Artifact value");+ const artifact = result.value;+ return { artifact, attachment: { artifact, open: async () => (async function* () { const bytes = await artifacts.get(artifact.digest); if (bytes !== undefined) yield bytes; })() } };+}diff --git a/packages/preview-mock/src/realizer.ts b/packages/preview-mock/src/realizer.tsnew file mode 100644index 00000000..217296b3--- /dev/null+++ b/packages/preview-mock/src/realizer.ts@@ -0,0 +1,78 @@+import { createHash } from "node:crypto";+import { mkdir, readFile, writeFile } from "node:fs/promises";+import { dirname, join, resolve } from "node:path";+import type { ArtifactAttachment } from "@hypit/workspace";+import type { CompiledGraph, TypedRecord } from "@hypit/protocol";+import { findMockTargets } from "./graph.js";+import { deriveGeometry } from "./geometry.js";+import { previewRunSource } from "./run-source.js";+import { materializeMockNeed } from "./materialize.js";+import { mockMediaCapabilities } from "@hypit/mock-media";++export type PreviewMockTiming = "estimate";+export type PreviewMockRequest = { readonly run: string; readonly targets?: readonly string[]; readonly timing?: PreviewMockTiming; readonly cacheRoot?: string; readonly graph?: CompiledGraph; readonly records?: readonly TypedRecord[]; readonly author?: string; readonly aliases?: ReadonlyMap<string, string> };+export type PreviewMockResult = { readonly run: string; readonly root: string; readonly previewRun: string; readonly attachments: readonly ArtifactAttachment[]; readonly mocked: readonly { output: string; candidate: string; kind: "image" | "video" | "audio" | "semantic-take" }[]; readonly timingBasis: "estimate" };++export async function realizePreviewMock(input: PreviewMockRequest): Promise<PreviewMockResult> {+ const run = resolve(input.run);+ const source = await readFile(run, "utf8");+ const author = input.author ?? /<author\s+source="([^"]+)"/u.exec(source)?.[1];+ if (author === undefined) throw new Error(`${input.run} declares no author source`);+ if (input.graph === undefined) {+ const root = input.cacheRoot ?? join(dirname(run), ".hypit", "preview", createHash("sha256").update(source).digest("hex").slice(0, 16));+ await mkdir(root, { recursive: true });+ const previewRun = join(root, "preview.svrun");+ await writeFile(previewRun, source, "utf8");+ return { run, root, previewRun, attachments: [], mocked: [], timingBasis: "estimate" };+ }+ const alias = (ref: string): string => input.aliases?.get(ref) ?? ref;+ const rawTargets = findMockTargets(input.graph, input.targets, input.records);+ const targets = rawTargets.map((target) => ({+ ...target,+ output: alias(target.output),+ inputs: Object.fromEntries(Object.entries(target.inputs).map(([name, ref]) => [name, alias(ref)])),+ }));+ const selectedTargets = (input.targets ?? input.graph.outputs.map((item) => item.id)).map(alias);+ const geometry = deriveGeometry(input.graph, rawTargets.map((item) => item.output));+ const authorPath = resolve(dirname(run), author);+ const authorSource = await readFile(authorPath, "utf8");+ const root = input.cacheRoot ?? join(dirname(run), ".hypit", "preview", createHash("sha256")+ .update(JSON.stringify({+ authorDigest: createHash("sha256").update(authorSource).digest("hex"),+ runDigest: createHash("sha256").update(source).digest("hex"),+ targets: rawTargets.map((item) => item.output).sort(),+ geometry,+ timing: input.timing ?? "estimate",+ })).digest("hex").slice(0, 16));+ await mkdir(root, { recursive: true });+ const previewRun = join(root, "preview.svrun");+ const preserved = [...source.matchAll(/^\s*<(?:file|value|build-record)\b[^>]*\/?>\s*$/gmu)]+ .map((match) => (match[0] ?? "").trim())+ .filter((line) => !/from="\//u.test(line));+ const generated = previewRunSource(resolve(dirname(run), author), previewRun, selectedTargets, geometry, targets);+ const mockedOutputs = new Set(targets.map((item) => item.output));+ const carriedSatisfactions = [...source.matchAll(/^\s*<satisfy\s+output="([^"]+)"[^>]*\/?>\s*$/gmu)]+ .filter((match) => !mockedOutputs.has(match[1] ?? ""))+ .map((match) => ` ${(match[0] ?? "").trim()}`);+ const withCarried = generated.replace("</svrun>", `${carriedSatisfactions.join("\n")}\n</svrun>`);+ const carried = preserved.map((line) => ` ${line}`).join("\n");+ await writeFile(previewRun, withCarried.replace(" <target", `${carried}${carried.length === 0 ? "" : "\n"} <target`), "utf8");+ const attachments: ArtifactAttachment[] = [];+ const attached = new Set<string>();+ for (const target of targets) {+ if (target.kind === "semantic-take") continue;+ const capability = target.kind === "image" ? mockMediaCapabilities.image+ : target.kind === "video" ? mockMediaCapabilities.video : mockMediaCapabilities.silence;+ const constraints = target.kind === "image"+ ? { width: geometry.width, height: geometry.height, color: "#9AA0A6" }+ : target.kind === "video"+ ? { width: geometry.width, height: geometry.height, frameRate: { numerator: 30, denominator: 1 }, frameCount: 30, color: "#9AA0A6", audio: "silence" }+ : { sampleRate: 48_000, channels: 2, sampleFrames: 48_000 };+ const materialized = await materializeMockNeed({ capability, constraints });+ if (!attached.has(materialized.artifact.digest)) {+ attached.add(materialized.artifact.digest);+ attachments.push(materialized.attachment);+ }+ }+ return { run, root, previewRun, attachments, mocked: targets.map((item, index) => ({ output: item.output, candidate: `mock-${index}.${item.kind === "audio" ? "audio" : item.kind}`, kind: item.kind })), timingBasis: "estimate" };+}diff --git a/packages/preview-mock/src/run-source.ts b/packages/preview-mock/src/run-source.tsnew file mode 100644index 00000000..6ef5620d--- /dev/null+++ b/packages/preview-mock/src/run-source.ts@@ -0,0 +1,22 @@+import { relative, dirname } from "node:path";+import type { MockTarget } from "./graph.js";++export function previewRunSource(author: string, runFile: string, targets: readonly string[], geometry: { width: number; height: number }, mocks: readonly MockTarget[]): string {+ const authorRef = relative(dirname(runFile), author).replaceAll("\\", "/");+ const declarations: string[] = [];+ const satisfactions: string[] = [];+ const needsEstimate = mocks.some((mock) => mock.kind === "semantic-take");+ const importLine = needsEstimate+ ? ` <import from="@hypit/semantic-take-estimate@1" as="estimate"/>\n`+ : "";+ for (const [index, mock] of mocks.entries()) {+ const fragment = mock.kind === "semantic-take" ? "estimate:semantic-take"+ : mock.kind === "image" ? "mock:image" : mock.kind === "video" ? "mock:video" : "mock:silence";+ const id = `mock-${index}`;+ const inputs = Object.entries(mock.inputs).map(([name, from]) => `<input name="${name}" from="${from}"/>`).join("");+ declarations.push(` <fragment id="${id}" using="${fragment}">${inputs}</fragment>`);+ const exportName = mock.kind === "semantic-take" ? "take" : mock.kind === "audio" ? "audio" : mock.kind;+ satisfactions.push(` <satisfy output="${mock.output}" candidate="${id}.${exportName}"/>`);+ }+ return `<?svml using="@hypit/run-markup@1"?>\n<svrun version="1">\n <author source="${authorRef}"/>\n <import from="@hypit/mock-media@1" as="mock"/>\n${importLine}${targets.map((target) => ` <target output="${target}"/>`).join("\n")}\n${declarations.join("\n")}\n${satisfactions.join("\n")}\n</svrun>\n`;+}diff --git a/packages/provider-media-local/package.json b/packages/provider-media-local/package.jsonindex a7d6fe7f..981ab558 100644--- a/packages/provider-media-local/package.json+++ b/packages/provider-media-local/package.json@@ -16,6 +16,7 @@"@hypit/media": "workspace:*","@hypit/media-execution": "workspace:*","@hypit/media-pipeline": "workspace:*",+ "@hypit/mock-media": "workspace:*","@hypit/protocol": "workspace:*","@hypit/runtime": "workspace:*","@hypit/runtime-kit": "workspace:*",diff --git a/packages/provider-media-local/src/provider.ts b/packages/provider-media-local/src/provider.tsindex ce15ea57..482bcace 100644--- a/packages/provider-media-local/src/provider.ts+++ b/packages/provider-media-local/src/provider.ts@@ -9,11 +9,14 @@ import {executeProjectSpeechEvidenceAudio,executeRenderTimelineAudio,executeRenderStillVideo,+ executeRenderMockImage,+ executeRenderMockVideo,+ executeRenderMockSilence,executeTransformMedia,} from "@hypit/media-execution";import type { MediaExecutionEnvironment, MediaOperationResult } from "@hypit/media-execution";import { mediaPipelineCapabilities } from "@hypit/media-pipeline";-import { canonicalize } from "@hypit/protocol";+import { mockMediaCapabilities } from "@hypit/mock-media";import { isStreamingArtifactStore } from "@hypit/runtime";import { speechTypes } from "@hypit/speech";import { defineEndpointPackage } from "@hypit/endpoint-kit";@@ -119,6 +122,24 @@ export function createLocalMediaProvider(config: CreateLocalMediaProviderOptionsreturns: artifactTypes.blob,handler: operation(executeRenderStillVideo),},+ {+ lifecycle: "immediate" as const,+ capability: mockMediaCapabilities.image,+ returns: artifactTypes.blob,+ handler: operation(executeRenderMockImage),+ },+ {+ lifecycle: "immediate" as const,+ capability: mockMediaCapabilities.video,+ returns: artifactTypes.blob,+ handler: operation(executeRenderMockVideo),+ },+ {+ lifecycle: "immediate" as const,+ capability: mockMediaCapabilities.silence,+ returns: artifactTypes.blob,+ handler: operation(executeRenderMockSilence),+ },{lifecycle: "immediate" as const,capability: mediaPipelineCapabilities.projectSpeechEvidenceAudio,diff --git a/packages/reference-video-tools/package.json b/packages/reference-video-tools/package.jsonindex 6ac99c86..fe7ff1b7 100644--- a/packages/reference-video-tools/package.json+++ b/packages/reference-video-tools/package.json@@ -14,16 +14,19 @@"dependencies": {"@google/genai": "1.52.0","@hypit/composition": "workspace:*",+ "@hypit/core": "workspace:*","@hypit/driver-node": "workspace:*","@hypit/estimate": "workspace:*","@hypit/hyperframes": "workspace:*","@hypit/markup": "workspace:*","@hypit/media": "workspace:*","@hypit/model-kit": "workspace:*",+ "@hypit/preview-mock": "workspace:*","@hypit/package-loader-node": "workspace:*","@hypit/program-space": "workspace:*","@hypit/protocol": "workspace:*","@hypit/provider-whisperx-local": "workspace:*",+ "@hypit/provider-media-local": "workspace:*","@hypit/script": "workspace:*","@hypit/speech": "workspace:*","@hypit/speech-evidence": "workspace:*",diff --git a/packages/reference-video-tools/src/authoring.ts b/packages/reference-video-tools/src/authoring.tsindex 116a48db..1fbcf178 100644--- a/packages/reference-video-tools/src/authoring.ts+++ b/packages/reference-video-tools/src/authoring.ts@@ -2,7 +2,6 @@ import { mkdir, readFile, readdir, rm, writeFile } from "node:fs/promises";import { existsSync } from "node:fs";import { spawnSync } from "node:child_process";-import { writePlaceholder } from "./placeholder.js";import { createHash } from "node:crypto";import { createRequire } from "node:module";import { cpus } from "node:os";@@ -10,83 +9,39 @@ import { basename, dirname, join, resolve } from "node:path";import { fileURLToPath } from "node:url";import { compileHyperframesDocument, materializeHyperframesHtml } from "@hypit/hyperframes";-import {- countSpeechEstimateUnits,- estimateSpeechDuration,- resolveSpeechEstimateLanguage,- speechEstimatePolicyFromRecipe,-} from "@hypit/estimate";-import type { SpeechEstimatePolicy } from "@hypit/estimate";-import type { SynchronizedMedia } from "@hypit/media";import type { ProgramSpace } from "@hypit/program-space";-import type { BlobRef, Digest } from "@hypit/protocol";+import type { CompiledGraph } from "@hypit/protocol";import { parseScript } from "@hypit/script";-import type { SemanticTake, SemanticTakeToken } from "@hypit/speech";import { videoCliDistribution } from "@hypit/video-cli";import { loadStudioCompanionRegistry } from "@hypit/studio/src/companion-profile.js";import { openStudioArchive } from "@hypit/studio/src/archive.js";import { loadStudioDomain } from "@hypit/studio/src/domain.js";import type { Preview } from "@hypit/studio/src/programme.js";import { preview } from "@hypit/studio/src/programme.js";+import { EndpointRegistry } from "@hypit/driver-node";+import { createLocalMediaProvider } from "@hypit/provider-media-local";import { loadStudioRun } from "@hypit/studio/src/run.js";import { inspectStudioRun } from "@hypit/studio/src/studio-preflight.js";-import type { SvsRecipe } from "@hypit/svs";+import { realizePreviewMock } from "@hypit/preview-mock";-import { assert, ensureDir, round } from "./media.js";+import { assert, ensureDir } from "./media.js";import type { TranscriptFile } from "./types.js";-/** A frame range of the stand-in program, half-open in the Script's own order. */+/** A frame range in the estimate-timed preview program, half-open in Script order. */export type AuthoringWindow = {readonly startFrame: number;readonly endFrameExclusive: number;};-/**- * A stand-in Take. Its `media.audio` carries the sample count beside the Artifact, which is the- * shape the `<value>` fixture is written with.- */-export type StandInTakeValue = Omit<SemanticTake, "media"> & {- readonly media: Omit<SynchronizedMedia, "audio"> & {- readonly audio: { readonly artifact: BlobRef; readonly sampleFrames: number };- };-};--export type StandInTake = {- readonly segmentId: string;- readonly startFrame: number;- readonly take: StandInTakeValue;-};--/**- * What timed one Segment's stand-in, and how long that clock said it runs.- *- * `seconds` is the clock's own answer. `frames` is what the Segment occupies in the program, which is- * shorter for a Segment outside the window being drawn.- */export type StandInTiming = {readonly segment: string;readonly basis: "reference" | "estimate";readonly seconds: number;readonly frames: number;readonly tokens: number;- /** Script words the reference's transcript matched. Zero on the estimate basis. */readonly matched: number;};-export type StandInTakes = {- readonly takes: readonly StandInTake[];- readonly selections: ReadonlyMap<string, AuthoringWindow>;- readonly frameCount: number;- readonly timing: readonly StandInTiming[];- /**- * Where every Script word sits in the program, in order.- *- * A window named by a Segment or a Selection is looked up above; one named by index is read- * straight off this, which is the same table those two are built from.- */- readonly frameOfToken: readonly { readonly frame: number; readonly end: number }[];-};-/** Which Segment the render is looking at, named directly or through a Selection's words. */export type StandInFocus = {readonly segment?: string;@@ -118,6 +73,16 @@ export function tokenWindow(value: unknown, subject: string): readonly [number,return [value[0] as number, value[1] as number];}+function referenceTimed(+ segment: { readonly tokenStart: number; readonly tokenEndExclusive: number },+ pairs: ReadonlyMap<number, number>,+): boolean {+ for (let index = segment.tokenStart; index < segment.tokenEndExclusive; index += 1) {+ if (pairs.has(index)) return true;+ }+ return false;+}+/*** The Hypit tree this package is installed into.*@@ -186,7 +151,7 @@ export function invokedFrom(): string {return process.cwd();}-/** The one active Script identity and body, which semantic stand-ins must preserve together. */+/** The one active Script identity and body, preserved by preview realization. */export function scriptBody(svml: string): { readonly id: string; readonly text: string; readonly offset: number } {const open = /<script\b[^>]*>/u.exec(svml);if (open === null) throw new Error("the Source declares no <script>");@@ -227,88 +192,6 @@ export function aliasPattern(svml: string, specifier: string, conventional: stri}/** Every Recipe body in every sheet the Source imports, keyed `alias.path`. */-async function recipeSheets(svml: string, svmlPath: string): Promise<ReadonlyMap<string, SvsRecipe>> {- const sheets = new Map<string, SvsRecipe>();- for (const match of svml.matchAll(/<import\s+as="([^"]+)"\s+source="([^"]+\.svs)"/gu)) {- const alias = match[1] ?? "";- const source = match[2] ?? "";- const text = await readFile(resolve(dirname(svmlPath), source), "utf8").catch(() => undefined);- if (text === undefined) continue;- for (const recipe of text.matchAll(/([A-Za-z0-9_.-]+)\s*\{([^}]*)\}/gu)) {- const name = recipe[1] ?? "";- const body = recipe[2] ?? "";- const properties: Record<string, string | number> = {};- for (const property of body.matchAll(/([a-z][a-z0-9-]*)\s*:\s*([^;]+);/gu)) {- const key = property[1] ?? "";- const value = (property[2] ?? "").trim();- properties[key] = /^-?\d+(\.\d+)?$/u.test(value) ? Number(value) : value;- }- sheets.set(`${alias}.${name}`, { path: `${alias}.${name}`, properties });- }- }- return sheets;-}--/**- * The policy each Segment's duration was estimated with. A Source names it once per Segment through- * `<estimate:Speech source={story.segment.NAME.speech} policy={recipes.X}/>`, and reading it back is- * what keeps this on the Source's own basis rather than a second one.- */-function policiesBySegment(svml: string, sheets: ReadonlyMap<string, SvsRecipe>): {- readonly policies: ReadonlyMap<string, SpeechEstimatePolicy>;- readonly shared: SpeechEstimatePolicy | undefined;- readonly policyCount: number;-} {- const policies = new Map<string, SpeechEstimatePolicy>();- const named = new Set<string>();- const estimate = aliasPattern(svml, "@hypit/estimate", "estimate");- for (const match of svml.matchAll(new RegExp(`<(?:${estimate}):Speech\\b([^>]*?)/?>`, "gsu"))) {- const attributes = match[1] ?? "";- const segment = /\bsource=\{story\.segment\.([A-Za-z0-9_-]+)\.speech\}/u.exec(attributes)?.[1];- const recipe = /\bpolicy=\{([A-Za-z0-9_.-]+)\}/u.exec(attributes)?.[1];- if (segment === undefined || recipe === undefined) continue;- const sheet = sheets.get(recipe);- if (sheet === undefined) throw new Error(`policy Recipe ${recipe} is not in any imported sheet`);- named.add(recipe);- policies.set(segment, speechEstimatePolicyFromRecipe(sheet));- }- // A Segment whose take is shared with another Segment carries no estimate of its own, so it has no- // policy named against it. One policy across the Source settles those; several leaves no basis to- // pick from, and guessing would put a Segment on a pace the Source never chose for it.- const shared = named.size === 1 ? policies.get([...policies.keys()][0]!) : undefined;- return { policies, shared, policyCount: named.size };-}--const SILENT_AUDIO: BlobRef = { kind: "blob", digest: `sha256:${"0".repeat(64)}` as Digest, size: 1, mediaType: "audio/wav" };--/**- * Build a stand-in SemanticTake for every Segment a Source declares.- *- * A Track timed against speech cannot be projected before the speech exists, and on this route it- * does not exist: the Build has not run. Two clocks can stand in for it, and each Segment is sized by- * whichever one can speak for it.- *- * **The reference's own words.** For a reconstruction, the words have already been spoken once and- * timed: the Script was transcribed from the reference video, and `prepare_reference` wrote the- * seconds of every word of it. A Segment timed this way runs for exactly as long as the reference- * spends on those words, and every window inside it does too, which is what a progressive reveal, a- * typewriter, a staggered row or an enter animation is compared on.- *- * **`estimate:Speech` with a policy Recipe.** The estimator the Source already trusts to size its own- * generations. Running it here produces the same numbers the Source used to order its takes, so it- * introduces no third clock; it reads one already written down. This is what sizes a Segment the- * reference has nothing to say about, and what sizes every Segment when no reference is given.- *- * Word ranges and Recipe values are exact on either clock, so which elements are on screen together,- * where each sits, at what size and colour follow from the Source itself. Alignment against the- * speech a Build synthesizes is settled once that speech exists.- *- * @param svmlPath the Author SVML this Source is written in- * @param frameRate the Program's frame rate, as a whole number of frames per second- * @param reference the reference's per-word times, from `referenceWords`- * @returns one `{ segmentId, take }` per Segment in Script order, and what timed each of them- */-/*** The Author SVML a Run declares, both as it is written and as a path.*@@ -547,7 +430,7 @@ export async function spokenRange(// Where the range closes, which has to be the second the render holds the last word until. A word// keeps the screen until the next one starts, so the pause the reference leaves between two words- // belongs to the word before it — `standInTakes` says why, and sizes the takes so this holds+ // belongs to the word before it; the estimate-timed SemanticTake preserves this same boundary// across a Segment boundary as well as inside one. Cutting the reference at the last word's own// end instead would leave it short of the render by that pause.//@@ -577,220 +460,6 @@ export async function spokenRange(};}-export async function standInTakes(- svmlPath: string,- frameRate: number,- reference: readonly ReferenceWord[] = [],- timingSource: string = svmlPath,-): Promise<StandInTakes> {- const svml = await readFile(svmlPath, "utf8");- const body = scriptBody(svml);- const parsed = parseScript(svmlPath, body.text, body.offset);-- // Which Script the reference is aligned against. A render is drawn from a fragment holding one- // Segment, and aligning that fragment's words against the whole transcript is not the same- // alignment the whole Script produces: a word that matched inside a longer run of context stops- // matching, and the unmatched runs at the fragment's own two ends are interpolated from the words- // just outside them rather than from the neighbouring Segments. The comparison reads the whole- // Source, so a render timed from the fragment covers seconds the comparison never cuts.- //- // So the alignment is made once, against the whole Source, and each Segment takes its own slice out- // of it by id. The fragment is a byte-for-byte cut, so a Segment holds the same words in both.- const timed = timingSource === svmlPath- ? parsed- : await (async () => {- const text = await readFile(timingSource, "utf8");- const whole = scriptBody(text);- return parseScript(timingSource, whole.text, whole.offset);- })();- const sheets = await recipeSheets(svml, svmlPath);- const { policies, shared, policyCount } = policiesBySegment(svml, sheets);-- // Which Script word the reference speaks when. The Script was transcribed from that video, so the- // words are the same words in the same order, and a stand-in timed from them runs at the pace the- // reconstruction is being compared against.- const words = reference.length === 0- ? undefined- : (() => {- const pairs = alignWords(timed.tokens.map((token) => normalizeWord(token.text)), reference.map((word) => normalizeWord(word.text)));- return pairs.size === 0 ? undefined : { pairs, spans: wordSpans(timed.tokens.length, pairs, reference) };- })();-- // A Segment is timed from the reference when the reference was heard saying some of its words.- // The decision is made per Segment: an ordinary transcription difference costs one Segment its- // reference clock and leaves the rest of the Script on it.- //- // Worked out for every Segment before any of them is sized, because a Segment runs until the next- // one opens and a single pass does not have the next one yet.- const heard = parsed.segments.map((segment) => {- const whole = timed.segments.find((item) => item.id === segment.id);- let matched = 0;- if (words !== undefined && whole !== undefined) {- for (let index = whole.tokenStart; index < whole.tokenEndExclusive; index += 1) if (words.pairs.has(index)) matched += 1;- }- const spoken = words === undefined || whole === undefined || matched === 0- ? undefined- : words.spans.slice(whole.tokenStart, whole.tokenEndExclusive);- return { matched, spoken };- });-- const takes: StandInTake[] = [];- const timing: StandInTiming[] = [];- // Global frame span of every word, in Script order, so a Selection can be turned into a frame- // range without going near a clock. This is the correspondence the route uses everywhere else:- // a stretch of the reference is found by its words, and its words are where the Script says.- const frameOfToken: { readonly frame: number; readonly end: number }[] = [];- let frameCursor = 0;- for (const [order, segment] of parsed.segments.entries()) {- const tokens = parsed.tokens.slice(segment.tokenStart, segment.tokenEndExclusive);- const text = tokens.map((token) => token.text).join(" ");- const { spoken, matched } = heard[order]!;-- // How long the Segment runs. The reference's own words when it was heard saying them, the- // estimator the Source already trusts when it was not.- let seconds: number;- let basis: StandInTiming["basis"];- let weights: readonly number[] | undefined;- if (spoken !== undefined) {- // Until the next Segment opens, not until this one's last word stops. The reference pauses- // between sentences, and a SemanticTrack puts each take at the sum of the lengths before it —- // so unless the pause is inside the take before it, there is nowhere for it to be, and every- // word after the first Segment is drawn earlier than the reference said it. On this reference- // that reached a full second by the last Segment, which is several words.- //- // The next Segment has to be on the reference's clock too. One the transcript carries none of- // runs at the estimator's length and sits nowhere on that clock, so there is no opening to- // reach for.- const opens = heard[order + 1]?.spoken?.[0]?.start;- seconds = Math.max(0, (opens ?? spoken.at(-1)!.end) - spoken[0]!.start);- basis = "reference";- } else {- const policy = policies.get(segment.id) ?? shared;- if (policy === undefined) {- throw new Error(`Segment ${segment.id} names no estimate:Speech policy, and the Source uses ${policyCount} policies, so there is no single one to fall back to`);- }- seconds = estimateSpeechDuration({ value: text }, policy);- basis = "estimate";- const language = resolveSpeechEstimateLanguage(text, policy.language);- weights = tokens.map((token) => Math.max(1, countSpeechEstimateUnits(token.text, language)));- }-- // Every Segment at the length its clock gives it. The program is drawn once and a window is cut- // out of it by frame, so a Segment nobody is looking at costs nothing by being its true length —- // and the frame numbers then mean what they say instead of indexing a compressed timeline.- const frameCount = Math.max(tokens.length, Math.round(seconds * frameRate));- timing.push({ segment: segment.id, basis, seconds: round(seconds), frames: frameCount, tokens: tokens.length, matched });-- // Where each word ends. On the reference clock a word holds the screen until the next one starts- // and the last holds until the reference stops saying it, so the small gaps the reference leaves- // between words go to the word before them and the Take covers its Segment without holes. On the- // estimate the share is the estimator's own unit count, so the word order and the relative widths- // both come from the same place the duration did.- const total = weights?.reduce((sum, weight) => sum + weight, 0) ?? 0;- const edge = spoken !== undefined- ? (index: number, start: number): number =>- Math.max(start + 1, Math.round((spoken[index + 1]!.start - spoken[0]!.start) * frameRate))- : (index: number, start: number): number =>- start + Math.max(1, Math.round(frameCount * weights![index]! / total));-- const anchors: { readonly identity: string; readonly frame: number }[] = [- { identity: `segment:${segment.id}:start`, frame: 0 },- { identity: `segment:${segment.id}:end`, frame: frameCount },- ];- const placed: SemanticTakeToken[] = [];- let used = 0;- for (const [index, token] of tokens.entries()) {- const start = used;- // The last token closes the Segment exactly, so rounding never leaves a frame unclaimed, and- // every earlier one is held back far enough that the ones after it still get a frame each.- used = index === tokens.length - 1- ? frameCount- : Math.min(frameCount - (tokens.length - 1 - index), edge(index, start));- const id = `segment:${segment.id}:token:${index + 1}`;- placed.push({- tokenId: id, segmentId: segment.id, text: token.text,- startAnchorId: `${id}:start`, endAnchorId: `${id}:end`,- startFrame: start, endFrameExclusive: used,- });- anchors.push({ identity: `${id}:start`, frame: start }, { identity: `${id}:end`, frame: used });- }-- frameOfToken.push(...placed.map((token) => ({ frame: frameCursor + token.startFrame, end: frameCursor + token.endFrameExclusive })));- takes.push({- segmentId: segment.id,- startFrame: frameCursor,- take: {- narrativeId: body.id,- media: {- timeline: { frameRate: { numerator: frameRate, denominator: 1 }, frameCount },- audio: { artifact: SILENT_AUDIO, sampleFrames: Math.round(frameCount / frameRate * 48_000) },- },- segment: {- segmentId: segment.id,- startAnchorId: `segment:${segment.id}:start`,- endAnchorId: `segment:${segment.id}:end`,- startFrame: 0,- endFrameExclusive: frameCount,- },- tokens: placed,- anchors,- },- });- frameCursor += frameCount;- }-- // Every Selection the Script marks, as the frames its words occupy. Selections nest freely, so a- // window runs from the frame of its open anchor's word to the end of the word before its close.- const selections = new Map<string, AuthoringWindow>();- for (const selection of parsed.selections) {- const first = frameOfToken[selection.open.boundary.tokenIndex];- const last = frameOfToken[selection.close.boundary.tokenIndex - 1];- if (first === undefined || last === undefined) continue;- if (first.frame < last.end) selections.set(selection.id, { startFrame: first.frame, endFrameExclusive: last.end });- }- return { takes, selections, frameCount: frameCursor, timing, frameOfToken };-}--/**- * Whether the reference was heard saying any of a Segment's words.- *- * Both sides of a comparison ask this and have to get the same answer: it decides whether the take- * before a Segment boundary was sized to reach the next Segment, and so whether the reference is cut- * up to that Segment's first word or up to the last word's own end.- */-function referenceTimed(- segment: { readonly tokenStart: number; readonly tokenEndExclusive: number },- pairs: ReadonlyMap<number, number>,-): boolean {- for (let index = segment.tokenStart; index < segment.tokenEndExclusive; index += 1) {- if (pairs.has(index)) return true;- }- return false;-}--function blobRef(bytes: Uint8Array, mediaType: string): BlobRef {- return { kind: "blob", digest: `sha256:${createHash("sha256").update(bytes).digest("hex")}`, size: bytes.byteLength, mediaType };-}--/** 48 kHz mono PCM silence, written by hand so the mock needs no encoder and lands on exact bytes. */-function silentWav(sampleFrames: number): Buffer {- const data = Math.max(2, sampleFrames * 2);- const buffer = Buffer.alloc(44 + data);- buffer.write("RIFF", 0);- buffer.writeUInt32LE(36 + data, 4);- buffer.write("WAVEfmt ", 8);- buffer.writeUInt32LE(16, 16);- buffer.writeUInt16LE(1, 20);- buffer.writeUInt16LE(1, 22);- buffer.writeUInt32LE(48_000, 24);- buffer.writeUInt32LE(48_000 * 2, 28);- buffer.writeUInt16LE(2, 32);- buffer.writeUInt16LE(16, 34);- buffer.write("data", 36);- buffer.writeUInt32LE(data, 40);- return buffer;-}-/*** Do `work` once per key within this process, and let every later caller await that one run.*@@ -809,57 +478,6 @@ async function once(key: string, work: () => Promise<void>): Promise<void> {try { await started; } catch (error) { runningOnce.delete(key); throw error; }}-/**- * How big a mock for one declared generation should be.- *- * The shape matters and the pixel count does not. A mock is a flat fill, so nothing reads its- * resolution — but a `fit: cover` crops a 4:5 source into a 9:16 Frame differently from a 9:16 one,- * and a mock of the wrong shape makes the reader report a framing difference the real render will- * not have, or miss one it will.- *- * The generation declares its own `aspect-ratio`, so that is what is read. Where it says `adaptive`- * — seedance's "inherit from the input" — the shape comes from whatever it was handed, so the edge- * is followed one hop to the upstream generation. Beyond one hop the returns fall away and a- * malformed or circular graph starts to matter, so the Canvas is the answer from there.- *- * `resolution` is deliberately not read. It is a vendor token (`720p` naming a short side, `4K` a- * long one) with no pixel mapping anywhere in this repository, and it decides only how large a- * rectangle of flat colour would be.- */-function mockExtent(svml: string, id: string, canvas: { readonly width: number; readonly height: number }): {- readonly width: number;- readonly height: number;-} {- const declaring = (target: string): string | undefined =>- new RegExp(`<[a-z][a-z0-9-]*:[A-Za-z][A-Za-z0-9]*\\b[^>]*?\\bid="${target}"[^>]*?/?>`, "su").exec(svml)?.[0];-- const ratioOf = (target: string): string | undefined => {- const tag = declaring(target);- if (tag === undefined) return undefined;- const declared = /\baspect-ratio="([^"]+)"/u.exec(tag)?.[1];- if (declared !== undefined && declared !== "adaptive") return declared;- // One hop upstream. Two shapes need it: `adaptive`, which takes the shape of whatever it was- // handed, and a `pipeline:Normalize`, which is what a mock is actually keyed by — the Source- // names the normalized media, and the generation that declared the shape is behind its `source`.- const upstream = /\b(?:source|image|first-frame|reference-image)=\{([A-Za-z0-9_-]+)[.}]/u.exec(tag)?.[1];- if (upstream === undefined) return undefined;- const inherited = /\baspect-ratio="([^"]+)"/u.exec(declaring(upstream) ?? "")?.[1];- return inherited === "adaptive" ? undefined : inherited;- };-- const ratio = ratioOf(id);- const parts = /^(\d+):(\d+)$/u.exec(ratio ?? "");- if (parts === null) return { width: canvas.width, height: canvas.height };- const wide = Number(parts[1]);- const tall = Number(parts[2]);- if (!(wide > 0 && tall > 0)) return { width: canvas.width, height: canvas.height };- // Scaled off the Canvas's short side, so a mock is never larger than the picture it sits in.- const short = Math.min(canvas.width, canvas.height);- return wide >= tall- ? { width: Math.round(short * wide / tall), height: short }- : { width: short, height: Math.round(short * tall / wide) };-}-export type RenderElementInput = {/*** A round of renders, run together. Each entry names its own element, stretch and output and@@ -873,20 +491,19 @@ export type RenderElementInput = {readonly out?: string;readonly segment?: string;readonly selection?: string;- /** A half-open token range, for a stretch the Script never named. See `StandInFocus`. */+ /** A half-open token range, for a stretch the Script never named. */readonly tokens?: readonly [number, number];/**- * A prepared reference to time the stand-in from. Its transcript holds the seconds each word was- * spoken at, and the Script was transcribed from that video, so the stand-in runs at the pace the- * render is compared against. Without one the Source's own `estimate:Speech` sizes each Segment.+ * A reference used only for comparison evidence and reference window selection. It never changes+ * preview timing, which is always the Source's own `estimate:Speech` policy.*/readonly reference_id?: string;};-/** What timed the stand-in behind one render, per Segment. */+/** Timing metadata recorded beside one render, per Segment. */export type StandInTimingReport = {readonly reference_id: string | null;- /** `mixed` when some Segments were timed from the reference and others fell back to the estimate. */+ /** Kept as a compatibility union; native preview realization always reports `estimate`. */readonly basis: "reference" | "estimate" | "mixed";readonly segments: readonly StandInTiming[];};@@ -896,12 +513,12 @@ export type StandInTimingReport = {** A comparison is made from a file, and the file alone says nothing about what timed the picture in* it. Writing that beside the output means `compare_reconstruction` can copy it into the comparison- * log from the path it was handed, and the gate can report which comparisons were made at the- * reference's pace without re-deriving anything.+ * log without re-deriving preview timing.*/export type StandInSidecar = {readonly element: string;readonly window: AuthoringWindow;+ readonly timing_basis: "estimate";readonly timing: StandInTimingReport;};@@ -911,44 +528,19 @@ export function standInSidecarPath(outPath: string): string {}function timingReport(reference: string | undefined, segments: readonly StandInTiming[]): StandInTimingReport {- const bases = new Set(segments.map((item) => item.basis));return {reference_id: reference ?? null,- basis: bases.size > 1 ? "mixed" : segments.some((item) => item.basis === "reference") ? "reference" : "estimate",+ basis: "estimate",segments,};}/**- * Render one element of a Source the way that Source configures it, without a Build and without a- * Provider.- *- * `comparison-round.md` compares a reconstructed element against the reference. What it must- * compare is the element as this video places it — the Recipe values the Source passes, the Script- * text it feeds, the windows it binds — because a Source can fill those with values that collide- * while a package's catalogue preview, drawn from sample values, stays perfect. Producing that- * picture by hand means transcribing values into a per-package harness, one line at a time, which is- * how a caption system gets compared as a single line that has nothing to collide with.- *- * So this reads the values instead. Everything it needs is already written down:- *- * Canvas and Frames, Recipe values, bindings the Source- * which elements share a window, in what order the Script's words, through their Selections- * how long each Segment runs the reference's own words, or `estimate:Speech`- * the layers a Build has not made `make_placeholder`, sized from the Canvas- *- * The one thing missing before a Build is real speech, and `standInTakes` supplies a Segment- * skeleton for it. Given `reference_id` it reads the seconds out of that reference's transcript, so- * every window is as long as the reference spends on the words inside it; without one it reads the- * estimator the Source already trusts, the same numbers it ordered its takes with. Those takes enter- * through `<value>` and `<satisfy>`, the mechanism `examples/all-components-preview` uses to open in- * Studio without spending anything, so nothing here is a private back door into the graph.+ * Render one element through the native preview realization path.*- * What this settles: which elements are on screen together, where each sits, at what size, weight and- * colour, and — on a reference-timed stand-in — how long each of them has to arrive in. What it does- * not: alignment against the speech a Build synthesizes, which is settled once that speech- * exists. `timing` in the result, and the sidecar written- * beside the output, name which of the two clocks sized each Segment.+ * The original Run is compiled once, its Author/Run Graph is handed to `@hypit/preview-mock`, and+ * the resulting temporary Run is previewed by Studio with only the local mock-media Provider. The+ * reference transcript remains comparison evidence; it never supplies preview timing.*/export async function renderElement(input: RenderElementInput): Promise<Record<string, unknown>> {// A round carries these per entry; one render has to name all three itself.@@ -981,256 +573,87 @@ export async function renderElement(input: RenderElementInput): Promise<Record<slet svml = await readFile(svmlPath, "utf8").catch(() => undefined);assert(svml !== undefined, `cannot read ${svmlPath}`);- // The Program's frame rate and the Canvas the render composes at, both read rather than assumed. A- // harness that hard-codes either produces a picture at a geometry the reference never had.- const clock = /<[a-z-]*:?Clock\b[^>]*?\bframe-rate="(\d+)"/su.exec(svml)?.[1]- ?? /<time:Clock\b[^>]*?\bfps="(\d+)"/su.exec(svml)?.[1];- const frameRate = Number(clock ?? 30);- const space = aliasPattern(svml, "@hypit/spatial", "space");- const canvasMatch = new RegExp(`<(?:${space}):Canvas\\b[^>]*?\\bwidth="(\\d+)"[^>]*?\\bheight="(\\d+)"`, "su").exec(svml);- assert(canvasMatch !== null, `the Source declares no <${space.split("|")[0]}:Canvas width= height=/>`);- const canvas = { width: Number(canvasMatch[1]), height: Number(canvasMatch[2]) };-- // Which SemanticTake output belongs to which Segment, so each stand-in lands on the right one.- const whisperx = aliasPattern(svml, "@hypit/whisperx", "whisperx");- const takeOutputs = new Map<string, string>();- for (const match of svml.matchAll(new RegExp(`<(?:${whisperx}):SemanticTake\\b([^>]*?)/?>`, "gsu"))) {- const attributes = match[1] ?? "";- const id = /\bid="([^"]+)"/u.exec(attributes)?.[1];- const segment = /\bsegment=\{story\.segment\.([A-Za-z0-9_-]+)\}/u.exec(attributes)?.[1];- if (id !== undefined && segment !== undefined) takeOutputs.set(segment, id);- }- assert(takeOutputs.size > 0, `the Source declares no ${whisperx.split("|")[0]}:SemanticTake to stand in for`);-- // What the Run already brings. A project Run declares nothing and everything is mocked; a package's- // preview Run ships its own sample pictures, and those are carried across untouched so the catalogue- // picture shows the component holding something rather than a placeholder.- const alreadySatisfied = new Set([...runSource.matchAll(/<satisfy\s+output="([^"]+)"/gu)].map((match) => match[1] ?? ""));- const carried = [...runSource.matchAll(/^[ \t]*<(?:file|value|satisfy)\b[^>]*\/>[ \t]*$/gmu)].map((match) => (match[0] ?? "").trim());-- // The window the picture is cut to. It is read here rather than where it is applied so a range that- // is not two whole numbers is refused before a minute of rendering: a `--batch` entry is JSON a- // caller wrote by hand, `compare_reconstruction` and `review_element` both put theirs through- // `tokenWindow`, and a range this end accepted and those two reject is a window the round cannot- // finish.+ // Preview is realized from the compiled Author + Run Graph. No reference transcript, placeholder+ // files, or hand-written SemanticTake values participate in this path.const segmentArgument = input.segment;const selectionArgument = input.selection;const tokensArgument = input.tokens === undefined ? undefined : tokenWindow(input.tokens, "tokens");-- // The derived Run is written here, and so is the cut, so the directory comes first.- // One directory per render, named for what this render is. Every call used to write one shared- // `.hypit/compare` and empty it on the way in, so two renders could not run at once — the second- // deleted the first one's sliced Source and mocks out from under it. The route asks for every- // element to be rendered before any is compared, which is a set of renders with nothing to say to- // each other, and they can now run together.- //- // The key is the Run and the clock, and deliberately not the element or the window: the picture- // does not depend on either. `render_element` draws the whole program and the window is cut out of- // the frames afterwards, so every render of one Run under one clock wants the identical directory,- // the identical mocks and the identical frames.- const renderKey = createHash("sha256")- .update(`${resolve(runPath)}\u0000${input.reference_id ?? ""}`)- .digest("hex").slice(0, 12);- const compareRoot = join(projectRoot, ".hypit", "compare", renderKey);- // Made, not remade. The frames inside are reused by every window cut out of this program, and the- // mocks beside them are written from ids that do not move, so emptying it would only throw away the- // render the next entry of the round is about to ask for.- await mkdir(compareRoot, { recursive: true });-- const sourcePath = svmlPath;-- // The reference's per-word times, when one was named. Read after the cut so a transcript that is- // missing is reported before a minute of rendering rather than after it.- const reference = input.reference_id?.trim();- const spoken = reference === undefined || reference.length === 0 ? [] : await referenceWords(reference);-- const { takes, selections, frameCount: programFrames, timing, frameOfToken } = await standInTakes(sourcePath, frameRate, spoken, svmlPath);- const framesBySegment = new Map(takes.map((item) => [item.segmentId, item.take.segment.endFrameExclusive]));- // A Selection's window in frames, summed over the stand-in tokens it covers. This is the same word- // span the Source binds to, carried into frames by the same clock that sized the Segment.- const framesBySelection = new Map<string, number>();- for (const { segmentId, take } of takes) {- for (const token of take.tokens) framesBySelection.set(token.tokenId, token.endFrameExclusive - token.startFrame);- framesBySelection.set(`segment:${segmentId}`, take.segment.endFrameExclusive);- }-- /**- * Every media a Build would have produced, and how long its window is. A speech take carries no- * picture and a base take fills a Segment; a cutaway fills whatever its `during=` binds. Each becomes- * a placeholder of the Canvas's own size, so the composite has the geometry the Source declares.- */- const mockedMedia = (): ReadonlyMap<string, { readonly frames: number; readonly picture: boolean }> => {- const windows = new Map<string, number>();- for (const match of svml.matchAll(new RegExp(`<(?:${whisperx}):SemanticTake\\b([^>]*?)/?>`, "gsu"))) {- const attributes = match[1] ?? "";- const media = /\bmedia=\{([A-Za-z0-9_-]+)\.media\}/u.exec(attributes)?.[1];- const segment = /\bsegment=\{story\.segment\.([A-Za-z0-9_-]+)\}/u.exec(attributes)?.[1];- if (media !== undefined && segment !== undefined) windows.set(media, framesBySegment.get(segment) ?? frameRate);- }- for (const match of svml.matchAll(/<[a-z][a-z0-9-]*:[A-Za-z][A-Za-z0-9]*\b([^>]*?)\/?>/gsu)) {- const attributes = match[1] ?? "";- const media = /\bmedia=\{([A-Za-z0-9_-]+)\.media\}/u.exec(attributes)?.[1];- if (media === undefined || windows.has(media)) continue;- const segment = /\bduring=\{story\.segment\.([A-Za-z0-9_-]+)\}/u.exec(attributes)?.[1];- if (segment !== undefined) { windows.set(media, framesBySegment.get(segment) ?? frameRate); continue; }- // A cutaway's window is the Selection it is bound to, which the stand-in already measured in- // frames. A mock shorter than its window runs out inside it, and with `playback` at its default- // the frames after that draw nothing — a gap the Source never wrote, appearing only in the- // comparison, in exactly the shape of the defect the comparison is looking for.- const selection = /\bduring=\{story\.selection\.([A-Za-z0-9_-]+)\}/u.exec(attributes)?.[1];- const window = selection === undefined ? undefined : selections.get(selection);- windows.set(media, window === undefined- ? frameRate- : window.endFrameExclusive - window.startFrame);- }- const carries = new Map<string, { readonly frames: number; readonly picture: boolean }>();- const pipeline = aliasPattern(svml, "@hypit/media-pipeline", "pipeline");- for (const match of svml.matchAll(new RegExp(`<(?:${pipeline}):Normalize\\b([^>]*?)/?>`, "gsu"))) {- const attributes = match[1] ?? "";- const id = /\bid="([^"]+)"/u.exec(attributes)?.[1];- const video = /\bvideo="([^"]+)"/u.exec(attributes)?.[1];- if (id === undefined || !windows.has(id)) continue;- // A Run that already satisfies this output brought its own material — a package's preview Source- // supplies sample pictures this way — and a mock over the top would hide what it came to show.- if (alreadySatisfied.has(`${id}.media`)) continue;- carries.set(id, { frames: windows.get(id)!, picture: video !== "none" });- }- return carries;- };-- // A derived Run lives beside the project so the original's relative sources still resolve, and under- // `.hypit/` so it is never mistaken for something the author wrote.- //- // Written once for the whole round rather than once per entry. Every entry of a `--batch` is its own- // call, composes the identical mocks and the identical Run to the identical paths, and reads that Run- // straight after writing it. `writeFile` truncates before it writes, so one write per round is what- // keeps an entry from reading a file another entry is partway through. Nothing in here depends on the- // element or the window, which is why one run of it serves every entry.- const derivedRun = join(compareRoot, "compare.svrun");- const imageIds = [...new Set([...svml.matchAll(/\{([a-z0-9-]+)\.image\}/gu)].map((match) => match[1] ?? ""))]- .filter((id) => !alreadySatisfied.has(`${id}.image`));- await once(`prepare:${renderKey}`, async () => {- const declarations: string[] = [];- const satisfactions: string[] = [];- for (const { segmentId, take } of takes) {- const output = takeOutputs.get(segmentId);- if (output === undefined) continue;- // The take's own audio has to be servable, not a digest stub: Studio resolves every Artifact a- // projection references, and a preview that cannot serve one stops there.- const sampleFrames = Math.round(take.segment.endFrameExclusive / frameRate * 48_000);- const silence = silentWav(sampleFrames);- await writeFile(join(compareRoot, `${segmentId}-take.wav`), silence);- const spoken = { ...take, media: { ...take.media, audio: { artifact: blobRef(silence, "audio/wav"), sampleFrames } } };- const fixture = join(compareRoot, `${segmentId}.json`);- await writeFile(fixture, `${JSON.stringify({ kind: "inline", value: spoken }, null, 2)}\n`, "utf8");- declarations.push(` <file id="stand-in-${segmentId}-audio" type="@hypit/artifact@1#BlobArtifact" from="./${segmentId}-take.wav" media-type="audio/wav"/>`);- declarations.push(` <value id="stand-in-${segmentId}" type="@hypit/speech@1#SemanticTake" from="./${segmentId}.json"/>`);- satisfactions.push(` <satisfy output="${output}.take" candidate="stand-in-${segmentId}"/>`);- }- // The layers a Build has not made, as placeholders of the Canvas's own size. `make_placeholder` is- // the route's one tool for this: deterministic, Provider-free, and the same mock the comparison is- // told to bypass. A mock never enters the project's own Source — it is declared in the derived Run- // and nowhere else.- // Every picture mock at once. Each one is a solid fill, so they do not contend for anything but- // ffmpeg, and drawn one after another they cost more than every frame they stand in for.- const mocks = [...mockedMedia()];- await Promise.all(mocks- .filter(([, { picture }]) => picture)- .map(async ([id, { frames }]) => await writePlaceholder({- out: join(compareRoot, `${id}.mp4`), ...mockExtent(svml, id, canvas),- video: true, seconds: Math.max(1, Math.ceil(frames / frameRate)), color: "mid",- })));- for (const [id, { frames, picture }] of mocks) {- const file = join(compareRoot, `${id}.mp4`);- // Every SynchronizedMedia carries audio, and it is validated as WAV, so the silence is written as- // one rather than pointed at the video. Both are declared: the picture is what gets drawn, the- // silence is what makes the value legal.- const wavPath = join(compareRoot, `${id}.wav`);- const wav = silentWav(Math.round(frames / frameRate * 48_000));- await writeFile(wavPath, wav);- const audioBlob = blobRef(wav, "audio/wav");- declarations.push(` <file id="mock-${id}-audio" type="@hypit/artifact@1#BlobArtifact" from="./${id}.wav" media-type="audio/wav"/>`);- let visual: SynchronizedMedia["visual"];- if (picture) {- const bytes = await readFile(file);- visual = { artifact: blobRef(bytes, "video/mp4"), ...mockExtent(svml, id, canvas) };- declarations.push(` <file id="mock-${id}" type="@hypit/artifact@1#BlobArtifact" from="./${id}.mp4" media-type="video/mp4"/>`);- }- const media: SynchronizedMedia = {- timeline: { frameRate: { numerator: frameRate, denominator: 1 }, frameCount: frames },- audio: { artifact: audioBlob },- ...(visual === undefined ? {} : { visual }),- };- await writeFile(join(compareRoot, `${id}.media.json`), `${JSON.stringify({ kind: "inline", value: media }, null, 2)}\n`, "utf8");- declarations.push(` <value id="media-${id}" type="@hypit/media@1#SynchronizedMedia" from="./${id}.media.json"/>`);- satisfactions.push(` <satisfy output="${id}.media" candidate="media-${id}"/>`);- }-- // Still images the Source declares as generations. Same treatment, same tool, at the Canvas's size:- // a picture slot that is empty in the render is black, and black is not what will be there.- await Promise.all(imageIds.map(async (id) => await writePlaceholder({- out: join(compareRoot, `${id}.png`), ...mockExtent(svml, id, canvas), color: "mid",- })));- for (const id of imageIds) {- declarations.push(` <file id="mock-${id}" type="@hypit/artifact@1#BlobArtifact" from="./${id}.png" media-type="image/png"/>`);- satisfactions.push(` <satisfy output="${id}.image" candidate="mock-${id}"/>`);- }-- await writeFile(derivedRun, [- `<?svml using="@hypit/run-markup@1"?>`,- ``,- `<svrun version="1">`,- // The cut, when there was one: it sits beside this Run, and its own imports were repointed to- // reach the project from here.- // Three levels up: the derived Run sits at `.hypit/compare/<key>/`, and the Source it names is at- // the project root. This branch used to run only when no window was asked for, which is the one- // case nothing exercised, so it was short by one the whole time.- ` <author source="../../../${author.replace(/^\.\//u, "")}"/>`,- // Whatever the Run brought, repointed: the derived Run sits two directories deeper than the one- // that declared these paths.- ...carried.map((line) => ` ${line.replace(/from="\.\//gu, 'from="../../../')}`),- // Targeting the element's own output rather than the Film prunes the closure to what this one- // Track needs. Asking for the whole delivery would pull in every generation the Source declares- // and report each as unresolved, which is true and useless: none of them is what is being looked at.- ` <target output="final.video"/>`,- ``,- ...declarations,- ``,- ...satisfactions,- `</svrun>`,- ``,- ].join("\n"), "utf8");- });-const distributionPackageRoot = videoCliDistribution.packageRoot;if (distributionPackageRoot === undefined) throw new Error("active Hypit Distribution has no package root");-+ const renderKey = createHash("sha256").update(`${resolve(runPath)}\u0000${input.reference_id ?? ""}`).digest("hex").slice(0, 12);const registry = await loadStudioCompanionRegistry({ workspaceRoot: projectRoot, packageRoot, distributionPackageRoot });- const domain = await loadStudioDomain({ run: derivedRun, workspaceRoot: projectRoot, packageRoot });+ const domain = await loadStudioDomain({ run: runPath, workspaceRoot: projectRoot, packageRoot });const archive = await openStudioArchive(undefined, packageRoot, projectRoot, distributionPackageRoot);let built: Preview;+ let previewMock: Awaited<ReturnType<typeof realizePreviewMock>>;+ let programFrames = 0;+ let frameOfToken: readonly { readonly frame: number; readonly end: number }[] = [];+ let selections = new Map<string, AuthoringWindow>();+ let segmentTokenCounts = new Map<string, number>();try {- const run = await loadStudioRun({ run: derivedRun, domain, registry, ...(archive === undefined ? {} : { archive }) });- const inspection = inspectStudioRun(registry, run.source, run);- // Every Track, not only the one being looked at: the element is compared where it sits, over the- // mocked base rather than on its own, because text that is legible on black may not be on a picture.+ const original = await loadStudioRun({ run: runPath, domain, registry, ...(archive === undefined ? {} : { archive }) });+ const graph: CompiledGraph = {+ format: "hypit.graph@1",+ outputs: original.source.compiled.graph.outputs,+ candidates: [...original.source.compiled.graph.candidates, ...original.run.graph.candidates],+ operations: [...original.source.compiled.graph.operations, ...original.run.graph.operations],+ };+ const aliases = new Map(original.source.exports.map((item) => [item.ref, item.name] as const));+ for (const record of original.source.compiled.program.records) {+ const local = original.source.compiled.provenance.elements.flatMap((element) => element.records)+ .find((item) => item.id === record.id)?.local+ ?? record.id.split("::record::")[1];+ if (local !== undefined) aliases.set(record.id, local);+ }+ previewMock = await realizePreviewMock({ run: runPath, graph, records: original.source.compiled.program.records, targets: original.targets, timing: "estimate", author, aliases });+ const previewRegistry = await loadStudioCompanionRegistry({ workspaceRoot: projectRoot, packageRoot, distributionPackageRoot });+ const previewDomain = await loadStudioDomain({ run: previewMock.previewRun, workspaceRoot: projectRoot, packageRoot });+ const previewArchive = await openStudioArchive(undefined, packageRoot, projectRoot, distributionPackageRoot);+ const loadedPreview = await loadStudioRun({ run: previewMock.previewRun, domain: previewDomain, registry: previewRegistry, ...(previewArchive === undefined ? {} : { archive: previewArchive }) });+ const previewRun = { ...loadedPreview, attachments: [...loadedPreview.attachments, ...previewMock.attachments] };+ const mockEndpoints = new EndpointRegistry();+ await createLocalMediaProvider({}).install(mockEndpoints);+ const inspection = inspectStudioRun(previewRegistry, previewRun.source, previewRun, new Set([+ "@hypit/mock-media@1#render-mock-image",+ "@hypit/mock-media@1#render-mock-video",+ "@hypit/mock-media@1#render-mock-silence",+ "@hypit/media-pipeline@1#inspect-media",+ "@hypit/media-pipeline@1#normalize-media",+ ]));built = await preview({- source: run.source,- run,- domain,+ source: previewRun.source,+ run: previewRun,+ domain: previewDomain,outputRefs: [inspection.filmComposition, ...inspection.projections.map((item) => item.ref)],compositionRef: inspection.filmComposition,projections: inspection.projections,- ...(archive === undefined ? {} : { archive }),+ ...(previewArchive === undefined ? {} : { archive: previewArchive }),+ endpoints: mockEndpoints,});+ programFrames = Math.max(1, ...built.anchors.values());+ frameOfToken = built.tokens.map((token) => ({ frame: built.anchors.get(token.startAnchorId) ?? 0, end: built.anchors.get(token.endAnchorId) ?? 0 }));+ const parsed = parseScript(svmlPath, scriptBody(svml).text, scriptBody(svml).offset);+ const cursor = (from: number, to: number): AuthoringWindow => ({ startFrame: frameOfToken[from]?.frame ?? 0, endFrameExclusive: frameOfToken[to - 1]?.end ?? programFrames });+ for (const segment of parsed.segments) {+ const window = cursor(segment.tokenStart, segment.tokenEndExclusive);+ selections.set(`segment:${segment.id}`, window);+ segmentTokenCounts.set(segment.id, segment.tokenEndExclusive - segment.tokenStart);+ }+ for (const selection of parsed.selections) selections.set(selection.id, cursor(selection.open.boundary.tokenIndex, selection.close.boundary.tokenIndex));} catch (error) {const issues = (error as { readonly issues?: unknown } | null)?.issues;- if (Array.isArray(issues)) {- throw new Error(["the Source does not project yet.", ...issues.slice(0, 12).map((issue) => ` ${String(issue)}`)].join("\n"));- }+ if (Array.isArray(issues)) throw new Error(["the Source does not project yet.", ...issues.slice(0, 12).map((issue) => ` ${String(issue)}`)].join("\n"));throw error instanceof Error ? error : new Error(String(error));}-+ const compareRoot = previewMock.root;+ const canvas = built.canvas;+ const frameRate = built.frameRate.numerator / built.frameRate.denominator;+ const timing: StandInTiming[] = [...selections.entries()]+ .filter(([id]) => id.startsWith("segment:"))+ .map(([id, window]) => ({ segment: id.slice("segment:".length), basis: "estimate", seconds: (window.endFrameExclusive - window.startFrame) / frameRate, frames: window.endFrameExclusive - window.startFrame, tokens: segmentTokenCounts.get(id.slice("segment:".length)) ?? 0, matched: 0 }));+ const mockedCount = previewMock.mocked.filter((item) => item.kind === "video" || item.kind === "audio").length;+ const imageIds = previewMock.mocked.filter((item) => item.kind === "image");+ const reference = undefined;const placed = built.tracks.find((track) => String(track.outputRef ?? "").endsWith(`::output::${element}.track`)|| String(track.outputRef ?? "").includes(`::output::${element}.`));if (placed === undefined) {@@ -1262,10 +685,9 @@ export async function renderElement(input: RenderElementInput): Promise<Record<sassert(marked !== undefined, `the Script marks no Selection ${selectionArgument}`);window = marked;} else if (segmentArgument !== undefined) {- let cursor = 0;- const take = takes.find((item) => { const hit = item.segmentId === segmentArgument; if (!hit) cursor += item.take.segment.endFrameExclusive; return hit; });- assert(take !== undefined, `the Script has no Segment ${segmentArgument}`);- window = { startFrame: cursor, endFrameExclusive: cursor + take.take.segment.endFrameExclusive };+ const marked = selections.get(`segment:${segmentArgument}`);+ assert(marked !== undefined, `the Script has no Segment ${segmentArgument}`);+ window = marked;}const clip = /\.(mp4|mov|webm)$/iu.test(outPath);@@ -1345,7 +767,7 @@ export async function renderElement(input: RenderElementInput): Promise<Record<s// and nothing else, so this is how the comparison log comes to say whether the stretch it looked at// ran at the reference's pace or at an estimate of it.const report = timingReport(reference, timing);- const sidecar: StandInSidecar = { element, window, timing: report };+ const sidecar: StandInSidecar = { element, window, timing_basis: "estimate", timing: report };await writeFile(standInSidecarPath(outPath), `${JSON.stringify(sidecar, null, 2)}\n`, "utf8");return {@@ -1358,7 +780,8 @@ export async function renderElement(input: RenderElementInput): Promise<Record<sprogram_frames: programFrames,timing: report,stand_in_ref: standInSidecarPath(outPath),- mocked: { media: mockedMedia().size, images: imageIds.length },+ mocked: { media: mockedCount, images: imageIds.length },+ ...(previewMock === undefined ? {} : { preview_mock: previewMock }),};}diff --git a/packages/reference-video-tools/src/checks.ts b/packages/reference-video-tools/src/checks.tsindex 162e9b06..7988ee2f 100644--- a/packages/reference-video-tools/src/checks.ts+++ b/packages/reference-video-tools/src/checks.ts@@ -214,12 +214,8 @@ export function reviewLogPath(runPath: string): string {}/**- * Which clock timed the stand-ins an element's comparisons were made over.- *- * `reference` is every recorded comparison drawn at the pace the reference speaks those words;- * `estimate` is every one drawn at the pace `estimate:Speech` predicts; `mixed` is both among them.- * `not recorded` is a comparison whose picture carried no `render_element` sidecar, so what timed it- * is unknown.+ * Which timing basis the preview sidecar recorded for an element comparison.+ * Native preview realization records `estimate`; older or external pictures may be `not recorded`.*/type TimingBasis = "reference" | "estimate" | "mixed" | "not recorded";@@ -1019,9 +1015,8 @@ export async function authoringCheck(// stretch was the right one to compare against — it does not know what the element draws — so it// reports them and lets a reader notice a component compared against one that never showed it.const rounds = new Map<string, string[]>();- // What timed each comparison's stand-in. A picture drawn at the estimator's pace holds every- // element in the right place for the wrong length of time, so an element compared only that way has- // had its layout settled and its behaviour over the window left alone.+ // What timing basis each comparison recorded. Native preview realization is deterministic estimate+ // timing; a missing sidecar is the only unknown case.const bases = new Map<string, TimingBasis[]>();for (const entry of log) {if (entry.element === undefined) continue;@@ -1033,7 +1028,7 @@ export async function authoringCheck(bases.set(entry.element, [...(bases.get(entry.element) ?? []), basis]);}// One answer per element, over every comparison it has. Agreement carries through; disagreement is- // `mixed`, which is the honest answer for an element compared once each way.+ // `mixed` for compatibility with historical logs.const timingBasis = (id: string): TimingBasis => {const recorded = new Set(bases.get(id) ?? []);if (recorded.size === 0) return "not recorded";@@ -1095,7 +1090,7 @@ export async function authoringCheck(// Elements whose comparisons say nothing about how they behave over their window: every recorded// comparison was drawn at the estimator's pace, or its picture carried no record of what timed it.- const untimed = elements.filter((element) => element.comparisons > 0 && element.timing_basis !== "reference");+ const untimed = elements.filter((element) => element.comparisons > 0 && element.timing_basis === "not recorded");const summary: string[] = [];if (never.length === 0 && running.length === 0) {@@ -1119,8 +1114,8 @@ export async function authoringCheck(const compared = elements.filter((element) => element.comparisons > 0).length;if (compared > 0 && mode === "reconstruction") {summary.push(untimed.length === 0- ? `every compared element was looked at over a reference-timed stand-in (${compared}).`- : `${untimed.length} of ${compared} compared elements have comparisons over a stand-in that was not reference-timed.`);+ ? `every compared element was looked at over the deterministic estimate-timed preview (${compared}).`+ : `${untimed.length} of ${compared} compared elements have no recorded preview timing basis.`);}// On the description route every stand-in is estimate-timed, because `estimate:Speech` is the only// clock there is until the Build synthesizes the speech. Reporting that as a shortfall would name@@ -1268,23 +1263,12 @@ export async function authoringCheck(note: `${unlabelled} comparison${unlabelled === 1 ? " was" : "s were"} recorded without --element and cannot be credited to one.`,},}),- // Only where a reference-timed stand-in is reachable. On the description route every stand-in is- // estimate-timed by definition, so this would list every element and point at a `--reference-id`- // that does not exist; the summary states that fact once instead.- ...(untimed.length === 0 || mode === "description" ? {} : {+ ...(untimed.length === 0 ? {} : {timing_next: {ids: untimed.map((element) => element.id),- note: "A stand-in sized by estimate:Speech puts every element where the Source puts it and gives it "- + "the wrong length of time to be there. Anything whose appearance is a function of elapsed time "- + "inside its window — a progressive reveal, a typewriter, staggered rows at a fixed rate, an "- + "enter animation scaled to the window — was therefore compared at a speed the reference never "- + "ran at, and is unverified. A comparison with no recorded basis says the same thing, because "- + "nothing on the record says otherwise.\n\n"- + "Re-render each of these with render_element --reference-id "- + `${reference} and compare again: the reference's own transcript times every Segment whose words `- + "it carries, so each window runs for as long as the reference spends on it. What is left after "- + "that is alignment against the speech the Build synthesizes, which is settled once that "- + "speech exists.",+ note: "This comparison has no timing sidecar. Re-render it with render_element so the deterministic "+ + "estimate basis is recorded. Reference timing is not used to construct mock SemanticTakes; final "+ + "alignment against synthesized speech is settled after the Build.",commands: untimed.flatMap((element) => plan.filter((entry) => entry.element === element.id).map((entry) =>`hypit-reference-video-tools render_element ${runPath} --element ${element.id} `diff --git a/packages/reference-video-tools/src/cli.ts b/packages/reference-video-tools/src/cli.tsindex 1c87e6e0..f2a17959 100644--- a/packages/reference-video-tools/src/cli.ts+++ b/packages/reference-video-tools/src/cli.ts@@ -41,7 +41,6 @@ function usage(): string {" hypit-reference-video-tools review_element --run <build.svrun> --element <id> --segment <id>|--selection <id>|--tokens <from:to> --video <path>|--image <path> --intent-file <path> [--question <scope>]"," hypit-reference-video-tools review_element --run <build.svrun> --batch <reviews.json>"," hypit-reference-video-tools record_review --run <build.svrun> --review-id <id> --text <text>|--text-file <path>",- " hypit-reference-video-tools make_placeholder --out <path> --width <w> --height <h> [--color light|mid|dark|white|black|#RRGGBB] [--video] [--seconds <s>]"," hypit-reference-video-tools render_element <build.svrun> --element <id> --out <path.png|path.mp4> [--segment <id>] [--selection <id>] [--tokens <from:to>] [--reference-id <id>]"," hypit-reference-video-tools render_element <build.svrun> --batch <renders.json> [--reference-id <id>]"," hypit-reference-video-tools render_previews <package-dir> [...]",@@ -59,30 +58,26 @@ function usage(): string {"picture over, and which timed pictures are configured to stop before their window ends. Comparison","asks for participation rather than convergence, so an element compared once passes. With one","prepared reference it uses that one; with several it requires --reference-id.",- "Each element also carries the basis its comparisons were made on — reference, estimate, mixed, or",+ "Each element records the preview timing basis — native estimate or not recorded — so the gate knows","not recorded — which says whether anything that changes with elapsed time inside its window has","been looked at, or only its layout.","","It also reports every Frame with an edge outside 0%-100% of its Canvas, which places part of what","is drawn into it off the picture. That is reported rather than required: an overhang is how an","element slides in from off-screen and how a full-bleed picture is cropped by a fit, and a mistake",- "looks the same. A comparison cannot answer it either way, because the render and the stand-in are",+ "looks the same. A comparison cannot answer it either way, because the render and reference are","drawn at the same Canvas and put the element in the same place off the edge.","",- "render_element draws one element of a Source the way that Source configures it, without a Build",- "and without a Provider: the Canvas, frame rate, Recipe values and bindings are read from the",- "Source, and the layers a Build has not made are mocked with make_placeholder at the Canvas's size.",+ "render_element draws one element of a Source the way that Source configures it, without a Build.",+ "The Canvas, frame rate, Recipe values and bindings come from the compiled Graph; missing media is",+ "realized through @hypit/preview-mock and its local mock-media Provider.","Name the stretch in words — --segment or --selection — so no reference timestamp is ever read","across; without either, the whole program is drawn. An --out ending .mp4, .mov or .webm writes the","stretch as a clip, and any other extension writes one still from the middle of it.","",- "--reference-id times the Segment skeleton from that reference's transcript. The Script was",- "transcribed from the reference video, so its words are matched against the transcript's and each",- "Segment runs for as long as the reference spends on them; anything whose appearance is a function",- "of elapsed time inside its window is then compared at the pace it will be seen at. A Segment whose",- "words the transcript does not carry is sized by the Source's own estimate:Speech, which is also",- "what sizes every Segment when no reference is named. The result's `timing` says which of the two",- "sized each Segment, and the same object is written to <out>.stand-in.json for",+ "Preview timing is always the Source-owned estimate:Speech policy. `--reference-id` only selects",+ "reference evidence and comparison windows; it never drives a synthetic SemanticTake clock. The",+ "result's `timing_basis` is `estimate`, and the same object is written to <out>.stand-in.json for","compare_reconstruction to carry into the comparison log.","","render_previews draws a package's catalogue pictures from the package's own preview Source in",@@ -122,18 +117,12 @@ function usage(): string {"","Both sides of a --video pair are measured once they are cut to the same stretch, and a pair that is","completely still on both sides is compared as one frame from each: `compared` reads `still` and",- "`both_sides_still` says why. Both sides have to be still, because a render's base is a flat",- "placeholder and is therefore still whatever the reference does.",+ "`both_sides_still` says why. Both sides have to be still, because the preview-mock base is a flat",+ "fill and is therefore still whatever the reference does.","",- "make_placeholder writes a correctly-sized placeholder for a media slot the Source declares as a",- "generation and a Build has not filled. It is deterministic and Provider-free: the comparison round",- "uses its output to mock an empty slot, and the observer is told the slot is a placeholder so it is",- "bypassed rather than reported as a difference. `--color` picks the fill from the named presets (the",- "default `light` shows on a dark base; `dark` shows on a light one) or a six-digit hex, and the",- "inset border is the contrast of the fill so the mock stays visible on either. A plain call writes",- "a PNG; `--video` writes a short solid-colour MP4 via ffmpeg for a slot that only accepts video,",- "with `--seconds` choosing its length (default 1). Never produce the mock with `hypit image` or a",- "script written by hand.",+ "Mock media is materialized by the local mock Provider and cached by @hypit/preview-mock; it never",+ "enters Author Source and is ignored by coverage gates. Timing uses estimate:Speech, while reference",+ "WhisperX is reserved for comparison evidence and window selection.","","record_observation takes the keys the agent observer is handed: the four whole-reference keys, a","shot key such as visual:shot-003 or boundary:shot-004, a narrow question keyed by the shots it was",@@ -415,16 +404,6 @@ async function main(): Promise<void> {...(flags.get("without-previews") === true ? { include_previews: false } : {}),};result = await tools.inspect_svml_vocabulary(input as { package_names: readonly string[]; tags?: readonly string[]; include_previews?: boolean });- } else if (command === "make_placeholder") {- const input = supplied ?? {- out: required(flags, "out"),- width: Number(required(flags, "width")),- height: Number(required(flags, "height")),- ...(one(flags, "color") === undefined ? {} : { color: one(flags, "color") }),- ...(flags.get("video") === true ? { video: true } : {}),- ...(one(flags, "seconds") === undefined ? {} : { seconds: Number(one(flags, "seconds")) }),- };- result = await tools.make_placeholder(input as { out: string; width: number; height: number; color?: string; video?: boolean; seconds?: number });} else if (command === "render_element") {const renderFile = one(flags, "batch");if (renderFile !== undefined) {diff --git a/packages/reference-video-tools/src/placeholder.ts b/packages/reference-video-tools/src/placeholder.tsdeleted file mode 100644index 946d00bd..00000000--- a/packages/reference-video-tools/src/placeholder.ts+++ /dev/null@@ -1,144 +0,0 @@-/**- * The route's one placeholder: a flat fill with a contrasting inset border, at whatever size the- * Canvas asks for.- *- * It is written here rather than inside the tool that first needed it because the comparison render- * needs dozens of them per round. Reaching them through the CLI meant a Node process, and a TypeScript- * compile, per mock — forty-five of those cost more than drawing every frame they stand in for.- */-import { mkdir, writeFile } from "node:fs/promises";-import { spawn } from "node:child_process";-import { dirname, resolve } from "node:path";-import { deflateSync } from "node:zlib";--function assert(condition: unknown, message: string): asserts condition {- if (!condition) throw new Error(message);-}--function crc32(bytes: Uint8Array): number {- let crc = 0xFFFFFFFF;- for (const byte of bytes) {- crc ^= byte;- for (let bit = 0; bit < 8; bit += 1) crc = (crc >>> 1) ^ (crc & 1 ? 0xEDB88320 : 0);- }- return (crc ^ 0xFFFFFFFF) >>> 0;-}--function pngChunk(type: string, data: Uint8Array): Uint8Array {- const body = new Uint8Array(type.length + data.length);- for (let i = 0; i < type.length; i += 1) body[i] = type.charCodeAt(i);- body.set(data, type.length);- const out = new Uint8Array(8 + body.length);- const view = new DataView(out.buffer);- view.setUint32(0, data.length);- out.set(body, 4);- view.setUint32(4 + body.length, crc32(body));- return out;-}--const PLACEHOLDER_COLORS = {- light: "#E8EAED", // default — visible on a dark base- mid: "#9AA0A6",- dark: "#5F6368", // visible on a light base- white: "#FFFFFF",- black: "#202124",-} as const;--type PlaceholderPalette = {- readonly base: [number, number, number];- readonly border: [number, number, number];- readonly hex: string;-};--/**- * Resolve the mock's colour: one of the named presets, or a six-digit hex. The inset border is the- * contrast of the base — a dark border on a light fill, a light border on a dark fill — so the- * placeholder stays visible whichever base it sits on, which is the point of choosing at all: a mock- * the same shade as its surroundings is one the observer reads as a hole rather than a slot.- */-function resolvePlaceholderColor(value: string | undefined): PlaceholderPalette {- const named = value === undefined ? PLACEHOLDER_COLORS.light- : (PLACEHOLDER_COLORS as Record<string, string>)[value];- const hex = named ?? value ?? PLACEHOLDER_COLORS.light;- assert(named !== undefined || /^#[0-9a-f]{6}$/iu.test(value!),- `color must be one of ${Object.keys(PLACEHOLDER_COLORS).join(", ")} or a six-digit hex like #E0E0E0.`);- const base: [number, number, number] = [- parseInt(hex.slice(1, 3), 16), parseInt(hex.slice(3, 5), 16), parseInt(hex.slice(5, 7), 16),- ];- const luminance = 0.299 * base[0] + 0.587 * base[1] + 0.114 * base[2];- const border: [number, number, number] = luminance > 128 ? [32, 33, 36] : [232, 234, 237];- return { base, border, hex };-}--/**- * A correctly-sized placeholder image for a media slot the Source declares as a generation and a- * Build has not filled. The comparison round needs a still; the slot must be mocked, and the mock is- * this tool's output — deterministic, Provider-free, never a real generation and never a hand-rolled- * script. A field with an inset frame reads as a slot waiting for content rather than a broken- * image, so the observer can bypass the region instead of reporting it every round.- */-function placeholderPng(width: number, height: number, palette: PlaceholderPalette): Uint8Array {- const { base, border } = palette;- const raw = Buffer.alloc(height * (1 + width * 3));- // A hairline, not a band. At a twentieth of the shorter side the frame was fifty pixels thick on a- // full-frame mock, and an observer measuring what the element covers read that as the element- // stopping short of the edge — "does not span the full width", reported every round, about the- // mock rather than about anything the Source says. It has to be visible enough to read as a slot- // and thin enough to measure as nothing.- const margin = Math.max(1, Math.round(Math.min(width, height) * 0.004));- for (let y = 0; y < height; y += 1) {- raw[y * (1 + width * 3)] = 0;- for (let x = 0; x < width; x += 1) {- const c = (x < margin || y < margin || x >= width - margin || y >= height - margin) ? border : base;- const i = y * (1 + width * 3) + 1 + x * 3;- raw[i] = c[0]; raw[i + 1] = c[1]; raw[i + 2] = c[2];- }- }- const ihdr = Buffer.alloc(13);- ihdr.writeUInt32BE(width, 0);- ihdr.writeUInt32BE(height, 4);- ihdr[8] = 8; ihdr[9] = 2; ihdr[10] = 0; ihdr[11] = 0; ihdr[12] = 0;- return Uint8Array.from(Buffer.concat([- Buffer.from([0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a]),- pngChunk("IHDR", ihdr),- pngChunk("IDAT", deflateSync(raw)),- pngChunk("IEND", Buffer.alloc(0)),- ]));-}--export type PlaceholderRequest = {- readonly out: string;- readonly width: number;- readonly height: number;- readonly color?: string;- readonly video?: boolean;- readonly seconds?: number;-};--/** Write one placeholder and report what it wrote, in the shape the CLI returns. */-export async function writePlaceholder(input: PlaceholderRequest): Promise<Record<string, unknown>> {- const palette = resolvePlaceholderColor(input.color);- const out = resolve(input.out);- await mkdir(dirname(out), { recursive: true });- if (input.video === true) {- // A slot that only accepts video needs a real video artifact; a short solid-colour clip is the- // mock. ffmpeg is part of the required local toolchain.- const seconds = input.seconds ?? 1;- const filter = `color=c=${palette.hex.slice(1)}:s=${input.width}x${input.height}:r=24:d=${seconds}`;- const result = await new Promise<{ status: number | null; error?: Error }>((done) => {- const child = spawn("ffmpeg", [- "-y", "-f", "lavfi", "-i", filter, "-c:v", "libx264", "-pix_fmt", "yuv420p", "-t", String(seconds), out,- ]);- child.on("close", (status) => done({ status }));- child.on("error", (error) => done({ status: null, error }));- });- assert(result.status === 0,- `ffmpeg failed to write a placeholder video (${result.error?.message ?? `exit ${result.status}`}); ffmpeg is part of the required local toolchain`);- return { out, width: input.width, height: input.height, color: palette.hex, video: true, seconds };- }- await writeFile(out, placeholderPng(input.width, input.height, palette));- return { out, width: input.width, height: input.height, color: palette.hex, video: false };-}--export { resolvePlaceholderColor, placeholderPng };-export type { PlaceholderPalette };diff --git a/packages/reference-video-tools/src/tools.ts b/packages/reference-video-tools/src/tools.tsindex d283ad5c..2f753733 100644--- a/packages/reference-video-tools/src/tools.ts+++ b/packages/reference-video-tools/src/tools.ts@@ -20,7 +20,6 @@ import { videoCliDistribution } from "@hypit/video-cli";import { authorSource, invokedFrom, referenceRoot, referenceWords, renderElement, renderPreviews, spokenRange, standInSidecarPath, tokenWindow } from "./authoring.js";import type { RenderElementInput, RenderPreviewsInput, SpokenRange, StandInFocus, StandInSidecar } from "./authoring.js";-import { writePlaceholder } from "./placeholder.js";import { downloadReferenceVideo, isReferenceUrl } from "@hypit/yt-dlp";import { authoringCheck, previewCheck, reviewLogPath } from "./checks.js";import type { AuthoringCheckInput, PreviewCheckInput, ReconstructionCheckInput } from "./checks.js";@@ -164,17 +163,6 @@ export type RecordReviewInput = {readonly text: string;};-export type MakePlaceholderInput = {- readonly out: string;- readonly width: number;- readonly height: number;- readonly color?: string;- /** Produce a video placeholder for a slot that only accepts video, instead of a PNG. */- readonly video?: boolean;- /** Video placeholder duration in seconds; defaults to 1. Ignored for a PNG. */- readonly seconds?: number;-};-export type { RenderElementInput, RenderPreviewsInput } from "./authoring.js";export type { PreviewCheckInput, ReconstructionCheckInput } from "./checks.js";@@ -189,7 +177,6 @@ export type ReferenceVideoTools = {record_observation(input: RecordObservationInput): Promise<Record<string, unknown>>;review_element(input: ReviewElementInput): Promise<Record<string, unknown>>;record_review(input: RecordReviewInput): Promise<Record<string, unknown>>;- make_placeholder(input: MakePlaceholderInput): Promise<Record<string, unknown>>;render_element(input: RenderElementInput): Promise<Record<string, unknown>>;render_previews(input: RenderPreviewsInput): Promise<Record<string, unknown>>;preview_check(input: PreviewCheckInput): Promise<Record<string, unknown>>;@@ -1596,7 +1583,7 @@ export function createReferenceVideoTools(options: ToolOptions = {}): ReferenceV// A stretch that holds one picture on both sides has one picture to compare, and a clip or a// grid of the same frame repeated says nothing the frame alone does not.//- // Both sides are measured, and both have to be still. The render's base is a flat placeholder+ // Both sides are measured, and both have to be still. The render's base is a flat preview mock// and is therefore still whatever it covers, so a render measured on its own would carry every// pair down to a frame — including the pairs whose reference moves, where the difference// between a mock base and a real one would be doing the deciding.@@ -1967,21 +1954,8 @@ export function createReferenceVideoTools(options: ToolOptions = {}): ReferenceVreturn { run: runPath, review_id: id, stored_in: reviewLogPath(runPath) };},- // A media slot that is declared as a generation is not fillable by this route, which never- // Builds. The comparison round still needs a still to compare, so the slot is mocked with a- // fixed, correctly-sized placeholder — the same tool on every run, never a real generation and- // never a script the agent writes by hand.- async make_placeholder(input): Promise<Record<string, unknown>> {- return await writePlaceholder({- out: String(input.out),- width: positiveInt(Number(input.width), "width"),- height: positiveInt(Number(input.height), "height"),- ...(input.color === undefined ? {} : { color: String(input.color) }),- ...(input.video === true ? { video: true } : {}),- ...(input.seconds === undefined ? {} : { seconds: positiveInt(Number(input.seconds), "seconds") }),- });- },-+ // A media slot declared as a generation is realized through the compiled preview-mock Graph path;+ // no Build or hand-written media fixture is used here.async render_element(input): Promise<Record<string, unknown>> {if (input.renders !== undefined) {const round = input.renders;diff --git a/packages/semantic-take-estimate/package.json b/packages/semantic-take-estimate/package.jsonindex 5e2f6fba..3792b408 100644--- a/packages/semantic-take-estimate/package.json+++ b/packages/semantic-take-estimate/package.json@@ -18,6 +18,7 @@"@hypit/media": "workspace:*","@hypit/narrative": "workspace:*","@hypit/protocol": "workspace:*",+ "@hypit/run": "workspace:*","@hypit/speech": "workspace:*"},"devDependencies": {diff --git a/packages/semantic-take-estimate/src/activation.ts b/packages/semantic-take-estimate/src/activation.tsindex 6aa56e0f..8a82c9a7 100644--- a/packages/semantic-take-estimate/src/activation.ts+++ b/packages/semantic-take-estimate/src/activation.ts@@ -1,4 +1,5 @@import { createMarkupSurfaceHostFacet } from "@hypit/markup";+import { createRunFragmentHostFacet } from "@hypit/run";import {decodeSemanticTakeEstimateSurface,@@ -7,12 +8,16 @@ import {semanticTakeEstimateMarkupSurfaces,semanticTakeEstimateModuleRef,} from "./index.js";+import { semanticTakeEstimateFragment } from "./fragment.js";export const hypitPackage = {format: "hypit.node-package@1" as const,modules: [{ manifest: semanticTakeEstimateManifest }],components: [semanticTakeEstimateComponent],- hostFacets: [createMarkupSurfaceHostFacet({+ hostFacets: [createRunFragmentHostFacet({+ name: "@hypit/semantic-take-estimate@1",+ fragments: { "semantic-take": semanticTakeEstimateFragment },+ }), createMarkupSurfaceHostFacet({module: semanticTakeEstimateModuleRef,declaration: semanticTakeEstimateMarkupSurfaces.find((item) => item.name === "semantic-take")!,handler: decodeSemanticTakeEstimateSurface,diff --git a/packages/semantic-take-estimate/src/program.ts b/packages/semantic-take-estimate/src/program.tsindex dd557ae7..3afc64e7 100644--- a/packages/semantic-take-estimate/src/program.ts+++ b/packages/semantic-take-estimate/src/program.ts@@ -105,7 +105,6 @@ export function materializeEstimatedSemanticTake(policy: SpeechEstimatePolicy,): SemanticTake {verifySynchronizedMedia(media);- if (media.visual === undefined) throw new Error("Estimated SemanticTake requires normalized visual media.");return materializeSemanticTake(narrative,excerpt,diff --git a/packages/studio/src/execute.ts b/packages/studio/src/execute.tsindex 3db93612..dbe7a854 100644--- a/packages/studio/src/execute.ts+++ b/packages/studio/src/execute.ts@@ -16,11 +16,12 @@ export async function executeDeterministic(domain: StudioDomain,planned: BuildState,artifacts: ArtifactStore,+ endpoints: EndpointRegistry = new EndpointRegistry(),): Promise<Executed> {const result = await new NodeDriver({producers: domain.producers,validators: domain.validators,- endpoints: new EndpointRegistry(),+ endpoints,artifacts,}).run(planned);const counts = new Map<string, number>();diff --git a/packages/studio/src/programme.ts b/packages/studio/src/programme.tsindex f5fb8f7c..1c3cd3d9 100644--- a/packages/studio/src/programme.ts+++ b/packages/studio/src/programme.ts@@ -17,6 +17,7 @@ import type { StudioArchive } from "./archive.js";import type { CompiledSource, ServedFile } from "./compile.js";import type { StudioDomain } from "./domain.js";import { executeDeterministic, MemoryArtifactStore } from "./execute.js";+import type { EndpointRegistry } from "@hypit/driver-node";import type { RunPlan } from "./run.js";import type { StudioViewRequirement } from "./studio-preflight.js";import { studioSurfacePreview } from "./surface-preview.js";@@ -111,6 +112,8 @@ export async function preview(input: {readonly compositionRef: string;readonly projections: readonly StudioViewRequirement[];readonly archive?: StudioArchive;+ /** Preview-only endpoint set. Production Studio passes none; preview-mock may pass only local mock media. */+ readonly endpoints?: EndpointRegistry;}): Promise<Preview> {const exportsByRef = new Map(input.source.exports.map((item) => [item.ref, item] as const));const targets = input.outputRefs.flatMap((ref) => {@@ -148,7 +151,7 @@ export async function preview(input: {},};const planned = input.run.plan(input.run.run, targets.map((target) => target.ref));- const executed = await executeDeterministic(input.domain, planned.state, artifacts);+ const executed = await executeDeterministic(input.domain, planned.state, artifacts, input.endpoints);if (executed.unserved.length > 0) {throw new Error(`Studio projection is unresolved: ${executed.unserved.map((item) => item.capability).join(", ")}`,diff --git a/packages/studio/src/studio-preflight.ts b/packages/studio/src/studio-preflight.tsindex db4b8a7e..728a2d5d 100644--- a/packages/studio/src/studio-preflight.ts+++ b/packages/studio/src/studio-preflight.ts@@ -49,11 +49,11 @@ function candidateIsMaterialized(candidate: Candidate | undefined): boolean {&& candidate.root.value.value.kind === "inline";}-function plannedExternalNeeds(base: RunPlan, refs: readonly string[]): readonly string[] {+function plannedExternalNeeds(base: RunPlan, refs: readonly string[], resolved: ReadonlySet<string> = new Set()): readonly string[] {const planned = base.plan(base.run, refs);return unique(plannedNeeds(planned.state).map((need) =>`${need.capability.module.name}@${need.capability.module.version}#${need.capability.name}`,- ));+ ).filter((name) => !resolved.has(name)));}function localName(value: string): string {@@ -93,6 +93,7 @@ export function inspectStudioRun(registry: StudioCompanionRegistry,source: CompiledSource,base: RunPlan,+ resolvedCapabilities: ReadonlySet<string> = new Set(),): StudioInspection {const issues: string[] = [];if (base.targets.length === 0) issues.push("the Run Source has no target; Studio requires Film or Render");@@ -187,7 +188,7 @@ export function inspectStudioRun(}if (derived.length > 0) {- const needs = plannedExternalNeeds(base, derived.map((projection) => projection.ref));+ const needs = plannedExternalNeeds(base, derived.map((projection) => projection.ref), resolvedCapabilities);if (needs.length > 0) {issues.push(`the Studio projection closure requires unresolved capabilities: ${needs.join(", ")}`);} else {diff --git a/packages/video-cli/test/cli.test.ts b/packages/video-cli/test/cli.test.tsindex de627a41..392c28e5 100644--- a/packages/video-cli/test/cli.test.ts+++ b/packages/video-cli/test/cli.test.ts@@ -41,7 +41,10 @@ test("source package selection follows Run and Author imports", async () => {});test("provider-free example plans from installed Source packages", async () => {- const fixture = join(process.cwd(), "examples", "talking-film-graph-check");+ // The examples directory is intentionally kept empty; use the maintained package preview+ // fixture instead. It is a real installed Source package and exercises the same provider-free+ // planning path (semantic track, composition and mux projections).+ const fixture = join(process.cwd(), "packages", "media-track", "preview");let output = "";await runCli(["plan",diff --git a/pnpm-lock.yaml b/pnpm-lock.yamlindex b1e109d5..10c86f77 100644--- a/pnpm-lock.yaml+++ b/pnpm-lock.yaml@@ -108,12 +108,18 @@ importers:'@hypit/minimax-h3':specifier: workspace:*version: link:packages/minimax-h3+ '@hypit/mock-media':+ specifier: workspace:*+ version: link:packages/mock-media'@hypit/nano-banana':specifier: workspace:*version: link:packages/nano-banana'@hypit/narrative':specifier: workspace:*version: link:packages/narrative+ '@hypit/preview-mock':+ specifier: workspace:*+ version: link:packages/preview-mock'@hypit/program-space':specifier: workspace:*version: link:packages/program-space@@ -1639,6 +1645,33 @@ importers:specifier: workspace:*version: link:../text+ packages/mock-media:+ dependencies:+ '@hypit/artifact':+ specifier: workspace:*+ version: link:../artifact+ '@hypit/elaborator':+ specifier: workspace:*+ version: link:../elaborator+ '@hypit/media':+ specifier: workspace:*+ version: link:../media+ '@hypit/program-space':+ specifier: workspace:*+ version: link:../program-space+ '@hypit/protocol':+ specifier: workspace:*+ version: link:../protocol+ '@hypit/run':+ specifier: workspace:*+ version: link:../run+ '@hypit/spatial':+ specifier: workspace:*+ version: link:../spatial+ '@hypit/speech':+ specifier: workspace:*+ version: link:../speech+packages/model-kit:dependencies:'@hypit/artifact':@@ -1705,6 +1738,45 @@ importers:specifier: workspace:*version: link:../protocol+ packages/preview-mock:+ dependencies:+ '@hypit/artifact':+ specifier: workspace:*+ version: link:../artifact+ '@hypit/compiler-node':+ specifier: workspace:*+ version: link:../compiler-node+ '@hypit/driver-node':+ specifier: workspace:*+ version: link:../driver-node+ '@hypit/media':+ specifier: workspace:*+ version: link:../media+ '@hypit/mock-media':+ specifier: workspace:*+ version: link:../mock-media+ '@hypit/program-space':+ specifier: workspace:*+ version: link:../program-space+ '@hypit/protocol':+ specifier: workspace:*+ version: link:../protocol+ '@hypit/provider-media-local':+ specifier: workspace:*+ version: link:../provider-media-local+ '@hypit/semantic-take-estimate':+ specifier: workspace:*+ version: link:../semantic-take-estimate+ '@hypit/spatial':+ specifier: workspace:*+ version: link:../spatial+ '@hypit/speech':+ specifier: workspace:*+ version: link:../speech+ '@hypit/workspace':+ specifier: workspace:*+ version: link:../workspace+packages/program-space:dependencies:'@hypit/markup':@@ -1969,6 +2041,9 @@ importers:'@hypit/media-pipeline':specifier: workspace:*version: link:../media-pipeline+ '@hypit/mock-media':+ specifier: workspace:*+ version: link:../mock-media'@hypit/protocol':specifier: workspace:*version: link:../protocol@@ -2132,6 +2207,9 @@ importers:'@hypit/composition':specifier: workspace:*version: link:../composition+ '@hypit/core':+ specifier: workspace:*+ version: link:../core'@hypit/driver-node':specifier: workspace:*version: link:../driver-node@@ -2153,12 +2231,18 @@ importers:'@hypit/package-loader-node':specifier: workspace:*version: link:../package-loader-node+ '@hypit/preview-mock':+ specifier: workspace:*+ version: link:../preview-mock'@hypit/program-space':specifier: workspace:*version: link:../program-space'@hypit/protocol':specifier: workspace:*version: link:../protocol+ '@hypit/provider-media-local':+ specifier: workspace:*+ version: link:../provider-media-local'@hypit/provider-whisperx-local':specifier: workspace:*version: link:../provider-whisperx-local@@ -2537,6 +2621,9 @@ importers:'@hypit/protocol':specifier: workspace:*version: link:../protocol+ '@hypit/run':+ specifier: workspace:*+ version: link:../run'@hypit/speech':specifier: workspace:*version: link:../speech@@ -3149,6 +3236,8 @@ importers:services/whisperx: {}+ services/yt-dlp: {}+packages:'@algolia/[email protected]':