AI media harness for planning, generating, and editing locally
TypeScript
Use timestamps in scene generation prompts
Bitti9f2b2ef49329
diff --git a/RELEASE_NOTES.md b/RELEASE_NOTES.mdindex 9cc936c..1393b5e 100644--- a/RELEASE_NOTES.md+++ b/RELEASE_NOTES.md@@ -32,6 +32,7 @@ This alpha update adds LAN generation workers, Linux support, expanded color gra## Fixes and improvements+- Scene generation prompts now mark shot times as `[Shot 2] At 00:03.500,`.- Still-image resolution and aspect ratio are saved separately from video project settings. Editing or selecting an image no longer changes the canvas used for video generation and continuation.- Zoom the timeline video preview up to 400% with the zoom menu, buttons, or Ctrl+wheel, and scroll to inspect details. Choose Fit to see the whole frame again.- Video scenes offer a separate audio step count. Audio follows the video step count by default, with optional overrides for local and worker generation.diff --git a/src/components/ProjectWorkspace.test.ts b/src/components/ProjectWorkspace.test.tsindex b4fa3aa..d59da4b 100644--- a/src/components/ProjectWorkspace.test.ts+++ b/src/components/ProjectWorkspace.test.ts@@ -801,8 +801,8 @@ describe("project workspace timecode", () => {openDebugPrompt();const compiled = document.querySelector(".compiled-prompt__text")!.textContent!;expect(compiled).toContain("[Shot 1] Live-action, cinematic, A quiet product film.");- expect(compiled).toContain("[Shot 2] (cut at 3s) she stops at the doorway.");- expect(compiled).toContain("[Shot 3] (cut at 6.5s) the door opens");+ expect(compiled).toContain("[Shot 2] At 00:03.000, she stops at the doorway.");+ expect(compiled).toContain("[Shot 3] At 00:06.500, the door opens");expect(compiled.indexOf("[Shot 2]")).toBeLessThan(compiled.indexOf("[Shot 3]"));// And the whole thing is still a project that can be saved.expect(parseProjectConfig(next)).toBeTruthy();@@ -1131,8 +1131,8 @@ describe("project workspace timecode", () => {"The target video is in a live-action, cinematic style.","[Shot 1] <Subject 1> walks towards the camera on <Subject 2>. The shot features <Subject 1> and <Subject 2>, matching the definitions above. Camera movement: push in, slow speed.",// Shot 2 names nobody, so nothing claims it features anyone.- "[Shot 2] (cut at 4.5s) Medium close-up, she stops at a doorway and looks up.",- "[Shot 3] (cut at 9s) the door opens and light spills across <Subject 2>. The shot features <Subject 2>, matching the definitions above.",+ "[Shot 2] At 00:04.500, Medium close-up, she stops at a doorway and looks up.",+ "[Shot 3] At 00:09.000, the door opens and light spills across <Subject 2>. The shot features <Subject 2>, matching the definitions above.","","overall_soundscape:","Rain on cobbles, distant traffic, her boots on stone.",diff --git a/src/lib/project.test.ts b/src/lib/project.test.tsindex 86451dc..610dea2 100644--- a/src/lib/project.test.ts+++ b/src/lib/project.test.ts@@ -822,19 +822,19 @@ describe("scenes and the shots inside them", () => {id: "scene-three", title: "Three shots", now, durationSeconds: 9,shots: [// Deliberately out of order in the array: the START TIMES decide.- shot("b", 3, "she stops at the doorway"),+ shot("b", 3.5, "she stops at the doorway"),shot("a", 0, "she walks towards the camera"),shot("c", 6.5, "the door opens"),],});const compiled = compileGenerationJobPrompt(job, []);expect(compiled).toContain("[Shot 1] Live-action, cinematic, she walks towards the camera.");- expect(compiled).toContain("[Shot 2] (cut at 3s) she stops at the doorway.");- expect(compiled).toContain("[Shot 3] (cut at 6.5s) the door opens");+ expect(compiled).toContain("[Shot 2] At 00:03.500, she stops at the doorway.");+ expect(compiled).toContain("[Shot 3] At 00:06.500, the door opens");// In order, and only shot 1 is timestamp-free (base guide §4.2).expect(compiled.indexOf("[Shot 1]")).toBeLessThan(compiled.indexOf("[Shot 2]"));expect(compiled.indexOf("[Shot 2]")).toBeLessThan(compiled.indexOf("[Shot 3]"));- expect(compiled).not.toContain("[Shot 1] (cut");+ expect(compiled).not.toContain("[Shot 1] At ");// The mirror is the user's own lines and nothing else.expect(job.creativeBrief).toBe("she walks towards the camera\n\nshe stops at the doorway\n\nthe door opens");expect(sceneBriefText(sceneShots(job))).toBe(job.creativeBrief);@@ -892,7 +892,7 @@ describe("scenes and the shots inside them", () => {// the street.expect(compiled).toContain("<Subject 1> (appears in [Shot 1]): fully_preserved");expect(compiled).toContain("<Subject 2> (appears in [Shot 1], [Shot 3]): fully_preserved");- expect(compiled).toContain("[Shot 2] (cut at 4.5s) Medium close-up, she stops at a doorway and looks up.\n");+ expect(compiled).toContain("[Shot 2] At 00:04.500, Medium close-up, she stops at a doorway and looks up.\n");// The scene's own sound and music replace the two default lines.expect(compiled).toContain("overall_soundscape:\nRain on cobbles, distant traffic, her boots on stone.");expect(compiled).toContain("non_diegetic_music:\nLow sustained cello");diff --git a/src/lib/project.ts b/src/lib/project.tsindex 393889d..1b13a62 100644--- a/src/lib/project.ts+++ b/src/lib/project.ts@@ -1107,6 +1107,14 @@ export function formatSceneSeconds(seconds: number): string {return Number.isInteger(rounded) ? String(rounded) : rounded.toFixed(1);}+/** Generation prompts use minute:second timestamps with millisecond precision. */+function scenePromptTimestamp(seconds: number): string {+ const milliseconds = Math.round(seconds * 1000);+ const minutes = String(Math.floor(milliseconds / 60_000)).padStart(2, "0");+ const remainder = ((milliseconds % 60_000) / 1000).toFixed(3).padStart(6, "0");+ return `${minutes}:${remainder}`;+}+/** The shots of a job, whatever era the file is from. A job written before* scenes existed becomes ONE shot holding the words and tags it already had —* no words are added and none are dropped. */@@ -1310,7 +1318,7 @@ function compileCharacterReplaceSegments(job: GenerationJob, references: Projectframe("subject_definitions:\n"), ...definitions,frame(`\nsummary:\n[video editing + reference generation${audioVideos.length ? " + audio reuse" : ""}] The target video is an edited version of ${videos.map((reference) => videoLabel(reference.id)).join(", ") || "the selected source videos"}. Replace the selected character in each shot with its assigned replacement character.\n\nretention_analysis:\n${retention.join("\n")}\n\ndetailed_description:\nRetain the visual style of each source video.\n`),...shots.flatMap((shot, index): PromptSegment[] => {- const timestamp = `${String(Math.floor(shot.startSeconds / 60)).padStart(2, "0")}:${(shot.startSeconds % 60).toFixed(3).padStart(6, "0")}`;+ const timestamp = scenePromptTimestamp(shot.startSeconds);const sourceAudio = audioVideos.find((reference) => reference.id === shot.videoReferenceId);return [frame(`${index ? "\n" : ""}[Shot ${index + 1}] ${index ? `At ${timestamp}, ` : ""}`), ...replacement(shot),...(sourceAudio ? [frame(` Reuse ${audioLabel(sourceAudio.id)} in sync with this shot.`)] : [frame(" Do not reuse the source soundtrack.")])];@@ -1413,7 +1421,7 @@ export function compileScenePromptSegments(scene: ScenePrompt, references: Proje/** The `[Shot N]` marker. Shot 1 never carries a timestamp (base guide §4.2);* every later shot carries the cut it starts on (docs/architecture.md). */const marker = (shot: CompiledShot): string =>- shot.index === 0 ? "[Shot 1] " : `[Shot ${shot.index + 1}] (cut at ${formatSceneSeconds(shot.startSeconds)}s) `;+ shot.index === 0 ? "[Shot 1] " : `[Shot ${shot.index + 1}] At ${scenePromptTimestamp(shot.startSeconds)}, `;// Sentences the settings contribute after the description. The field name is// Slopus's, the terms inside it are the user's — hence three segments per