AI media harness for planning, generating, and editing locally
TypeScript
Queue dependent scenes and cancel linked generations together
Bitti2c8445dd52c0
diff --git a/RELEASE_NOTES.md b/RELEASE_NOTES.mdindex d6d5292..11cdb79 100644--- a/RELEASE_NOTES.md+++ b/RELEASE_NOTES.md@@ -25,6 +25,7 @@ Changes since 0.3.2.- Video cards match Shot sizing, show the opening playback frame and open scenes on click; playback shares Timeline's prepared players. Returning to the Video tab restores the open video.- Editing generated music creates a separate draft; cards distinguish drafts from playable songs.- Single Shot uses previous latents only as its starting anchor, fresh noise for the middle and a generated ending anchor, avoiding repeated source imagery.+- Dependent scenes can queue behind active sources; cancelling any linked generation cancels the whole pending group.- Updated First/Last Frame Fast to the eight-step FastH3 Omni model and corrected Omni and First/Last Frame weight fallbacks.- Image edits preserve source images, prompts and settings; queued results get separate entries, and whole-image edits disable feathering.- Imported images now expose steps, seed and resolution; new images use generator step defaults, and renamed image roots retain their names.diff --git a/src/components/workspace/GeneratorView.test.tsx b/src/components/workspace/GeneratorView.test.tsxindex c8ee9b3..f55d8c1 100644--- a/src/components/workspace/GeneratorView.test.tsx+++ b/src/components/workspace/GeneratorView.test.tsx@@ -169,6 +169,21 @@ it.each(["prompt", "single-shot"] as const)("queues a starting %s scene before Sexpect(submissions[1].request.previousSceneId).toBe("start");});+it.each(["queued", "generating", "ready", "draft", "failed"] as const)("allows Single Shot to wait for a source that is %s", (status) => {+ const initial = project();+ initial.generationJobs = [+ { ...createDraftGenerationJob("Start", { id: "start" }), status },+ { ...createDraftGenerationJob("Next", { id: "next", sceneType: "single-shot" }), continuationSceneId: "start" },+ ];+ const submitted = vi.fn();+ render(<GeneratorView config={initial} folderPath="C:/project" runtime={readyRuntime} selectedJobId="next" onChange={vi.fn()} onGenerate={submitted} onOpenTimeline={() => {}} />);+ const generate = within(screen.getByRole("complementary", { name: "Scene: Next" })).getByRole("button", { name: "Generate" });+ if (["draft", "failed"].includes(status)) { expect(generate).toBeDisabled(); return; }+ expect(generate).toBeEnabled(); fireEvent.click(generate);+ expect(submitted.mock.calls[0][0]).toHaveLength(1);+ expect(submitted.mock.calls[0][0][0].request.previousSceneId).toBe("start");+});+it("persists Long Shot boundary controls and inherits the scene type for new scenes", () => {const initial = project();initial.generationJobs.push(createDraftGenerationJob("Keep walking", { id: "third" }));diff --git a/src/components/workspace/GeneratorView.tsx b/src/components/workspace/GeneratorView.tsxindex fe5662f..2dc67c5 100644--- a/src/components/workspace/GeneratorView.tsx+++ b/src/components/workspace/GeneratorView.tsx@@ -6,7 +6,7 @@ export { templateSceneBlocker } from "../../lib/sceneGeneration";import type { GenerationSubmission } from "../../lib/workQueue";import { loadLoras, subscribeLoras } from "../../lib/loras";import { refreshDownloadedLoras } from "../../lib/weightDownloads";-import { continuationBlocker, continuationSceneId, isVideoTransition, sceneGenerationSteps, sceneTypeFor } from "../../lib/project";+import { continuationBlocker, continuationSceneId, isVideoTransition, sceneGenerationPending, sceneGenerationSteps, sceneTypeFor } from "../../lib/project";import { Add16, Delete16, GridView16, GridView16Filled, ListView16, ListView16Filled, Scene16, Scene32, Sparkle16, Stop14, Wand16 } from "../ui/icons";import { invoke } from "@tauri-apps/api/core";import { useEffect, useMemo, useRef, useState, useSyncExternalStore, type ReactNode } from "react";@@ -448,8 +448,8 @@ export function GeneratorView({ config, sceneIds, toolbarStart, folderPath, runtif (job.status === "ready") return "Saving this scene.";const source = config.generationJobs.find((candidate) => candidate.id === continuationSceneId(job, config.generationJobs));return continuationBlocker(job, config.generationJobs)- ?? longShotBlocker(job, config)- ?? (source && (!source.latentRelativePath || source.status !== "completed") ? "Generate the selected source scene first, or use Generate all." : null)+ ?? longShotBlocker(job, config, true, true)+ ?? (source && !sceneGenerationPending(source) && (!source.latentRelativePath || source.status !== "completed") ? "Generate or queue the selected source scene first, or use Generate all." : null)?? templateSceneBlocker(sceneTypeFor(job), templateFor(job)) ?? sendBlocker(job, config.references, config);};diff --git a/src/lib/agentGeneration.ts b/src/lib/agentGeneration.tsindex af02fb7..d7b1842 100644--- a/src/lib/agentGeneration.ts+++ b/src/lib/agentGeneration.ts@@ -4,7 +4,7 @@ import { compileImagePrompt } from "./imagePrompt";import { compileImageEdits } from "./imageEditing";import { imageScenePrompt } from "./imageScene";import { longShotBlocker } from "./longShot";-import { continuationBlocker, continuationSceneId, generationAssetId, sceneGenerationSnapshot, sceneTypeFor } from "./project";+import { continuationBlocker, continuationSceneId, generationAssetId, sceneGenerationPending, sceneGenerationSnapshot, sceneTypeFor } from "./project";import type { ProjectSession } from "./projectSession";import { sceneGenerationRequest, sendBlocker, templateSceneBlocker } from "./sceneGeneration";import { generatorPathFields, loadGeneratorTemplateSettings, templateSupportsMusic, templateUsable } from "./settings";@@ -128,15 +128,15 @@ export async function generateAgentScene(queue: WorkQueue, session: ProjectSessi}const source = config.generationJobs.find((candidate) => candidate.id === continuationSceneId(job, config.generationJobs));const blocker = continuationBlocker(job, config.generationJobs)- ?? longShotBlocker(job, config)- ?? (source && (!source.latentRelativePath || source.status !== "completed") ? "Generate the selected source scene first." : null)+ ?? longShotBlocker(job, config, true, true)+ ?? (source && !sceneGenerationPending(source) && (!source.latentRelativePath || source.status !== "completed") ? "Generate or queue the selected source scene first." : null)?? templateSceneBlocker(sceneTypeFor(job), template) ?? sendBlocker(job, config.references, config);if (blocker) throw new Error(blocker);const request = sceneGenerationRequest(job, config, session.record.folderPath, template.defaultSteps, template);const [id] = queue.enqueue(session, [{ job, request, snapshot: sceneGenerationSnapshot(job, request) }], template);if (!id) throw new Error("This scene is already queued.");- // Stop affects only the work this agent started. Encoding already in progress- // is allowed to finish safely, but the stopped agent will not resume.+ // Stop cancels this run and its linked generation group. Encoding already in+ // progress is allowed to finish safely, but the stopped agent will not resume.const cancel = () => { void queue.cancel(id).catch(() => undefined); };signal.addEventListener("abort", cancel, { once: true });try {diff --git a/src/lib/longShot.test.ts b/src/lib/longShot.test.tsindex 1ca2c50..5fd16e4 100644--- a/src/lib/longShot.test.ts+++ b/src/lib/longShot.test.ts@@ -35,6 +35,17 @@ it("alternates within consecutive runs and blocks missing, failed and short anchexpect(longShotPosition(config.generationJobs[3], config.generationJobs)?.bridge).toBe(false);});+it("allows queued Long Shot anchors while retaining readiness and compatibility checks", () => {+ const config = project(), bridge = config.generationJobs[1], source = config.generationJobs[2];+ source.status = "queued"; source.latentRelativePath = null; source.outputRelativePath = null;+ expect(longShotBlocker(bridge, config)).toContain("Generate");+ expect(longShotBlocker(bridge, config, true, true)).toBeNull();+ source.status = "failed";+ expect(longShotBlocker(bridge, config, true, true)).toContain("Generate");+ source.status = "generating"; source.latentUpscale = true;+ expect(longShotBlocker(bridge, config, true, true)).toContain("Latent upscale");+});+it("continues the last scene from the joined archive and invalidates it when a following anchor is added", () => {const config = project();const fifth = config.generationJobs.pop()!;diff --git a/src/lib/longShot.ts b/src/lib/longShot.tsindex 64026b8..da5809b 100644--- a/src/lib/longShot.ts+++ b/src/lib/longShot.ts@@ -1,4 +1,4 @@-import { sceneSiblings, generationAssetId, sceneDurationSeconds, sceneOutputFrames, type GenerationJob, type ProjectAsset, type ProjectConfig, type SceneGenerationInput, type SceneMediaSegment } from "./project";+import { sceneGenerationPending, sceneSiblings, generationAssetId, sceneDurationSeconds, sceneOutputFrames, type GenerationJob, type ProjectAsset, type ProjectConfig, type SceneGenerationInput, type SceneMediaSegment } from "./project";export const LONG_SHOT_CONTEXT = 22;export const bridgeGapFrames = (frames: number) => Math.max(12, Math.ceil((frames - 12) / 17) * 17 + 12);@@ -22,19 +22,20 @@ export function longShotDependencies(job: GenerationJob, jobs: readonly Generatireturn position?.left ? [position.left, position.right].filter((source): source is GenerationJob => !!source) : [];}-export function longShotBlocker(job: GenerationJob, config: ProjectConfig, requireCompleted = true): string | null {+export function longShotBlocker(job: GenerationJob, config: ProjectConfig, requireCompleted = true, allowPending = false): string | null {const position = longShotPosition(job, sceneSiblings(job, config));if (!position?.left) return null;const neighbors: [GenerationJob, number][] = [[position.left, position.continuation ? 0 : job.bridgeLeftMargin ?? 17]];if (position.right) neighbors.push([position.right, job.bridgeRightMargin ?? 17]);for (const [source, margin] of neighbors) {- if (requireCompleted && (source.status !== "completed" || !source.latentRelativePath || !source.outputRelativePath))+ const needsOutput = requireCompleted && !(allowPending && sceneGenerationPending(source));+ if (needsOutput && (source.status !== "completed" || !source.latentRelativePath || !source.outputRelativePath))return `Generate “${source.title}” first, or use Generate all. ${position.continuation ? "The previous clip needs saved latents." : "Both neighboring clips need saved latents."}`;const sourceAsset = config.assets.find((asset) => asset.id === generationAssetId(source.id));- if (requireCompleted && (sourceAsset?.sceneSegments?.length ?? 0) > 1)+ if (needsOutput && (sourceAsset?.sceneSegments?.length ?? 0) > 1)return `Regenerate “${source.title}” as a fresh Long Shot anchor first.`;const plannedFrames = Math.max(22, Math.ceil((sceneDurationSeconds(source) * 24 - 5) / 17) * 17 + 5);- const frames = requireCompleted ? sceneOutputFrames(source, config) : Math.max(sceneOutputFrames(source, config) ?? 0, plannedFrames);+ const frames = needsOutput ? sceneOutputFrames(source, config) : requireCompleted ? plannedFrames : Math.max(sceneOutputFrames(source, config) ?? 0, plannedFrames);if (frames != null && frames < margin + LONG_SHOT_CONTEXT) return `“${source.title}” needs at least ${margin + LONG_SHOT_CONTEXT} frames for this bridge. Reduce its editable margin or lengthen the source.`;if (!!source.latentUpscale !== !!job.latentUpscale) return "Use the same Latent upscale setting for the bridge and both neighboring clips.";}diff --git a/src/lib/project.ts b/src/lib/project.tsindex 0d15091..f49c606 100644--- a/src/lib/project.ts+++ b/src/lib/project.ts@@ -1081,6 +1081,8 @@ export function continuationSceneId(job: GenerationJob, jobs: readonly Generatioreturn undefined;}+export const sceneGenerationPending = (job: GenerationJob) => ["queued", "generating", "ready"].includes(job.status);+export function continuationBlocker(job: GenerationJob, jobs: readonly GenerationJob[]): string | null {if (job.sceneType === "single-shot" && !job.continuationSceneId) return null;if (job.sceneType !== "continue" && job.sceneType !== "single-shot" && !job.usePreviousSceneLastFrame) return null;diff --git a/src/lib/workQueue.test.ts b/src/lib/workQueue.test.tsindex d79120e..f61873f 100644--- a/src/lib/workQueue.test.ts+++ b/src/lib/workQueue.test.ts@@ -311,6 +311,72 @@ it("rejects a queued final Long Shot continuation when a following anchor is addexpect(queue.getSnapshot().find((item) => item.id === ids[1])?.error).toContain("neighbors changed");});+it.each(["source", "child", "grandchild", "branch"])("cancelling %s cancels its queued dependency group without touching unrelated work", async (cancelScene) => {+ const { queue, first, second } = setup();+ queue.enqueue(second, [submission(second)]);+ first.update((config) => ({ ...config, generationJobs: ["source", "child", "grandchild", "branch", "unrelated"].map((id) => ({ ...config.generationJobs[0], id })) }));+ const enqueue = (id: string, previousSceneId?: string) => queue.enqueue(first, [{ ...submission(first),+ job: first.getSnapshot().config.generationJobs.find((job) => job.id === id)!, request: { ...submission(first).request, previousSceneId } }])[0];+ const ids = [enqueue("source"), enqueue("child", "source"), enqueue("grandchild", "child"), enqueue("branch", "source")];+ const unrelated = enqueue("unrelated");+ await waitFor(() => expect(enqueueSlopfabGeneration).toHaveBeenCalledOnce());+ // Editing the draft after submission must not change the captured group.+ first.update((config) => ({ ...config, generationJobs: [...config.generationJobs].reverse() }));+ await queue.cancel(queue.getSnapshot().find((item) => item.sceneId === cancelScene)!.id);+ expect(queue.getSnapshot().filter((item) => ids.includes(item.id)).map((item) => item.status)).toEqual(Array(4).fill("cancelled"));+ expect(queue.getSnapshot().find((item) => item.id === unrelated)?.status).toBe("queued");+ expect(queue.getSnapshot()[0].status).toBe("generating");+ expect(cancelSlopfabGeneration).not.toHaveBeenCalled();+});++it("cancelling a dependent also stops its generating source", async () => {+ const { queue, first } = setup();+ const [sourceId] = queue.enqueue(first, [submission(first)]);+ await waitFor(() => expect(enqueueSlopfabGeneration).toHaveBeenCalledOnce());+ const source = submission(first);+ const child = { ...source.job, id: "child" };+ first.update((config) => ({ ...config, generationJobs: [...config.generationJobs, child] }));+ const [childId] = queue.enqueue(first, [{ ...source, job: child, request: { ...source.request, previousSceneId: source.job.id } }]);+ await queue.cancelScenes(first, [child.id]);+ expect(cancelSlopfabGeneration).toHaveBeenCalledWith(sourceId);+ expect(queue.getSnapshot().find((item) => item.id === childId)?.status).toBe("cancelled");+ emit("slopfab-job", { jobId: sourceId, state: "cancelled", detail: "Stopped" });+ await waitFor(() => expect(queue.getSnapshot().every((item) => item.status === "cancelled")).toBe(true));+ expect(enqueueSlopfabGeneration).toHaveBeenCalledOnce();+});++it("merges both Long Shot anchor groups when cancelling a bridge", async () => {+ const { queue, first, second } = setup();+ queue.enqueue(second, [submission(second)]);+ first.update((config) => ({ ...config, generationJobs: ["left", "bridge", "right"].map((id) => ({ ...config.generationJobs[0], id, sceneType: "long-shot" as const })) }));+ const config = first.getSnapshot().config;+ for (const index of [0, 2, 1]) {+ const job = config.generationJobs[index], request = sceneGenerationRequest(job, config, first.record.folderPath, 8);+ queue.enqueue(first, [{ job, request, snapshot: sceneGenerationSnapshot(job, request) }]);+ }+ await queue.cancelScenes(first, ["bridge"]);+ expect(queue.getSnapshot().slice(1).map((item) => item.status)).toEqual(["cancelled", "cancelled", "cancelled"]);+});++it("cancels a source saving video safely when its queued dependent is cancelled", async () => {+ const { queue, first } = setup();+ let encoded!: (saved: Awaited<ReturnType<typeof saveGeneratedScene>>) => void;+ vi.mocked(saveGeneratedScene).mockImplementationOnce(() => new Promise((resolve) => { encoded = resolve; }));+ const source = submission(first), child = { ...source.job, id: "child" };+ first.update((config) => ({ ...config, generationJobs: [...config.generationJobs, child] }));+ const [sourceId] = queue.enqueue(first, [source]);+ await waitFor(() => expect(enqueueSlopfabGeneration).toHaveBeenCalledOnce());+ emit("slopfab-job", { jobId: sourceId, state: "framesReady" });+ await waitFor(() => expect(saveGeneratedScene).toHaveBeenCalledOnce());+ const [childId] = queue.enqueue(first, [{ ...source, job: child, request: { ...source.request, previousSceneId: source.job.id } }]);+ await queue.cancel(childId);+ expect(queue.getSnapshot()[0]).toMatchObject({ status: "encoding", cancelling: true });+ encoded({ relativePath: "media/result.mp4", bytes: 100, note: null });+ await waitFor(() => expect(queue.getSnapshot().every((item) => item.status === "cancelled")).toBe(true));+ expect(first.getSnapshot().config.generationJobs[0].outputRelativePath).toBeFalsy();+ expect(enqueueSlopfabGeneration).toHaveBeenCalledOnce();+});+it("releases a cancelled queued snapshot before the running job finishes", async () => {const { queue, first, second } = setup();const [running] = queue.enqueue(first, [submission(first)]);@@ -1107,8 +1173,9 @@ describe("application work queue", () => {first.update((config) => ({ ...config, generationJobs: [config.generationJobs[0], { ...config.generationJobs[0], id: "linked", sceneType: "continue", continuationSceneId: config.generationJobs[0].id }] }));const source = submission(first);const linked = { ...submission(first), job: first.getSnapshot().config.generationJobs[1], request: { ...source.request, previousSceneId: source.job.id, continuationFrom: "start" as const, continuationOverlapFrames: 39, referencePaths: ["subject.png"] } };- queue.enqueue(first, [source, linked]);+ queue.enqueue(first, [source]);await waitFor(() => expect(enqueueSlopfabGeneration).toHaveBeenCalledTimes(1));+ queue.enqueue(first, [linked]);first.update((config) => ({ ...config, generationJobs: [...config.generationJobs].reverse() }));expect(saveSceneLastFrame).not.toHaveBeenCalled();await finish(queue, queue.getSnapshot()[0].id);diff --git a/src/lib/workQueue.ts b/src/lib/workQueue.tsindex 8e34cdd..9500ad3 100644--- a/src/lib/workQueue.ts+++ b/src/lib/workQueue.ts@@ -20,7 +20,7 @@ import { describeDiagnosticError, writeDiagnostic } from "./diagnostics";import { GenerationTimingEstimator, type CompletedGenerationTiming, type GenerationTimingProgress } from "./generationTiming";import { releaseRendered, saveGeneratedScene } from "./generatedVideo";import { isTauri, saveProject } from "./persistence";-import { continuationBlocker, generationAssetId, generationLatentPath, GENERATION_FRAME_RATE, sceneOutputFrames, sceneGenerationSnapshot, type SceneInput, type GenerationJob, type ProjectRecord, type ProjectConfig } from "./project";+import { continuationBlocker, generationAssetId, generationLatentPath, GENERATION_FRAME_RATE, sceneSiblings, sceneOutputFrames, sceneGenerationSnapshot, type SceneInput, type GenerationJob, type ProjectRecord, type ProjectConfig } from "./project";import { ProjectSession, type ProjectWriter } from "./projectSession";import { cancelSlopfabGeneration, enqueueSlopfabGeneration, resolveSlopfabPlan, type SlopfabGenerationRequest } from "./runtime";import { generationStepsWithLoras, withEngineSettings } from "./settings";@@ -30,7 +30,7 @@ import { ReferenceIconWork } from "./referenceIconWork";import { prepareReferenceVideos, releaseReferenceVideos } from "./referenceVideo";import { prepareReferenceAudios, releaseReferenceAudios } from "./referenceAudio";import { joinedSceneSegments, sceneArchiveSegments } from "./continuationMedia";-import { bridgedSceneSegments, longShotBlocker, longShotContinuationInputs, longShotInputs } from "./longShot";+import { bridgedSceneSegments, longShotBlocker, longShotContinuationInputs, longShotInputs, longShotPosition } from "./longShot";import type { SceneMediaSegment } from "./project";import { exportReferenceRefmod, refmodExportBlocker, refmodExportRequest, type RefmodExportTarget } from "./refmodExport";@@ -46,6 +46,8 @@ function imageGenerationSeed(seed: number): number {return (high & 0x1fffff) * 0x100000000 + low;}export interface WorkItem {+ /** Exact video runs linked while their sources were still in flight. */+ generationGroupId?: string;imageAssetId?: string | null;imageDraftId?: string;kind?: "reference-icons" | "image" | "refmod" | "music";@@ -242,7 +244,7 @@ export class WorkQueue {...generationSigmaShiftsWithLoras(submission.request, config) });this.work.set(id, { id, session, sceneId: submission.job.id, sceneInput: sceneInput(captured), request, config, snapshot: submission.snapshot, cancelled: false, submitted: false, done, finish });this.items = [...this.items, {- id, projectKey, folderPath: session.record.folderPath, projectName: config.name,+ id, generationGroupId: id, projectKey, folderPath: session.record.folderPath, projectName: config.name,sceneId: submission.job.id, title: submission.job.title, submittedAt: new Date().toISOString(),status: "queued", progress: 0, detail: "Waiting to generate", error: null, completionAt: null,cancelling: false, needsSave: false,@@ -250,6 +252,19 @@ export class WorkQueue {}];this.updateScene(this.work.get(id)!, { status: "queued", stage: "queued", progress: 0, error: null, generationSnapshot: submission.snapshot, generatorTemplateId: captured.generatorTemplateId, steps: captured.steps, seed: captured.seed });}+ // Link after the whole batch is present, including sources submitted in+ // earlier calls. Group IDs survive completed-work cleanup and draft edits.+ for (const id of ids) {+ const work = this.work.get(id)!;+ const job = work.config.generationJobs.find((job) => job.id === work.sceneId)!;+ const sources = new Set([work.request.previousSceneId, work.request.latentBridge?.leftSceneId,+ work.request.latentBridge?.rightSceneId, longShotPosition(job, sceneSiblings(job, work.config))?.previousBridge?.id]);+ const group = this.items.find((item) => item.id === id)!.generationGroupId!;+ const groups = new Set(this.items.filter((item) => item.projectKey === projectKey && !item.kind && isWorkActive(item)+ && sources.has(item.sceneId)).map((item) => item.generationGroupId));+ this.items = this.items.map((item) => item.projectKey === projectKey && item.generationGroupId && groups.has(item.generationGroupId)+ ? { ...item, generationGroupId: group } : item);+ }this.publish();if (this.items.some((item) => item.status === "queued" && item.kind !== "reference-icons")) this.icons.yieldToVideo();void this.pump();@@ -618,10 +633,22 @@ export class WorkQueue {}async cancel(id: string): Promise<void> {if (this.icons.owns(id)) { await this.icons.cancel(); return; }+ const item = this.items.find((candidate) => candidate.id === id);+ if (!item || !isWorkActive(item)) return;+ const linked = this.items.filter((candidate) => candidate.id === id || (item.generationGroupId+ && candidate.projectKey === item.projectKey && candidate.generationGroupId === item.generationGroupId && isWorkActive(candidate)));+ await Promise.all(linked.map((candidate) => this.cancelOne(candidate.id)));+ }+ private async cancelOne(id: string): Promise<void> {const item = this.items.find((candidate) => candidate.id === id);const work = this.work.get(id);- if (!item || !work || !isWorkActive(item) || item.status === "encoding" || item.cancelling) return;+ if (!item || !work || !isWorkActive(item) || (item.status === "encoding" && item.kind) || item.cancelling) return;work.cancelled = true;+ if (item.status === "encoding") {+ // Finish the in-flight file write safely, but do not start linked work.+ this.patch(id, { cancelling: true, detail: "Cancelling after the current save" });+ return;+ }if (item.status === "queued" || item.status === "preparing") {this.cancelled(work);if (item.status === "queued") this.work.delete(id);@@ -787,6 +814,7 @@ export class WorkQueue {this.updateScene(work, { progress }, false);},});+ if (work.cancelled) { this.cancelled(work); return; }const assetId = generationAssetId(work.sceneId);const totalFrames = saved.durationMs ? Math.round(saved.durationMs * GENERATION_FRAME_RATE / 1000) : work.outputFrames ?? work.request.frames;const sceneSegments = work.request.latentBridge@@ -804,6 +832,7 @@ export class WorkQueue {work.session.update(sceneResultUpdate(work.sceneId, version, saved.note));try {await work.session.save();+ if (work.cancelled) { this.cancelled(work); return; }this.patch(work.id, { status: "completed", progress: 1, detail: "Video saved", error: saved.note });} catch (reason) {this.patch(work.id, { status: "failed", progress: 1, needsSave: true, detail: "Video created; project save failed", error: describeDiagnosticError(reason) });