AI media harness for planning, generating, and editing locally
TypeScript
Allow extending saved image drafts
Bitti5cbef3442122
diff --git a/RELEASE_NOTES.md b/RELEASE_NOTES.mdindex 32ca017..cd93731 100644--- a/RELEASE_NOTES.md+++ b/RELEASE_NOTES.md@@ -21,6 +21,7 @@ Changes since 0.3.2.## Fixes and improvements+- Fixed Extend rejecting editing drafts that already have a saved source image.- YuE2 now defaults to six flow steps with DPM++ 2M. The previous Midpoint solver remains available in music's Advanced settings, and saved generator templates using the old 32-step default upgrade once to six steps.- On first launch after updating, each recent project gets a one-time cleanup of orphaned generated media, latents and caches. Other projects receive the cleanup when first opened; files still referenced by the project are preserved.- Saving now deletes unused files from replaced video takes and removed video, image and music generations, including latents and derived caches. Files still used by timeline clips, references or other generations are preserved; saved deletions cannot be undone.diff --git a/src/lib/extendWork.test.ts b/src/lib/extendWork.test.tsindex 2be6b53..4e5c5bd 100644--- a/src/lib/extendWork.test.ts+++ b/src/lib/extendWork.test.ts@@ -90,6 +90,36 @@ it.each([false, true])("extends a frozen source and saves a child with a durableexpect(releaseRendered).toHaveBeenCalledWith(jobId);});+it("extends the saved pixels of an editing draft without replacing its pending edits", async () => {+ const { queue, session } = setup();+ session.edit((config) => restoreGeneratedImage(config, "source"));+ session.edit((config) => ({ ...config, imageScene: { ...config.imageScene!,+ nodes: config.imageScene!.nodes.map((node) => ({ ...node, description: "Add snow" })) } }));+ const before = structuredClone(session.getSnapshot().config);+ const draft = before.assets.find((asset) => asset.id === before.imageScene!.outputAssetId)!;+ expect(draft).toMatchObject({ imageDraft: true, relativePath: "media/source.png", parentAssetId: "root" });++ queue.enqueueExtendImage(session, template, draft.id, options());+ const request = await submitted();+ expect(invoke).toHaveBeenCalledWith("prepare_extend_image", { folderPath: "C:/Extend", jobId: request.jobId,+ sourceId: draft.id, bounds: options().bounds, output: { width: 960, height: 576 } });+ emit("framesReady", request.jobId);+ await waitFor(() => expect(queue.getSnapshot()[0].status).toBe("completed"));+ const saved = session.getSnapshot().config;+ expect(saved.assets.slice(0, before.assets.length)).toEqual(before.assets);+ expect(saved.assets.at(-1)).toMatchObject({ imageDraft: false, parentAssetId: "root", ...result,+ imageGeneration: { template: { kind: "extend", sourceId: draft.id } } });+});++it.each([false, true])("rejects images without saved pixels (draft: %s)", (imageDraft) => {+ const { queue, session } = setup();+ session.update((config) => ({ ...config, assets: config.assets.map((asset) => asset.id === "source"+ ? { ...asset, imageDraft, relativePath: undefined, sourcePath: undefined } : asset) }));+ expect(() => queue.enqueueExtendImage(session, template, "source", options())).toThrow("Select a saved image to extend.");+ expect(queue.getSnapshot()).toHaveLength(0);+ expect(enqueueSlopfabGeneration).not.toHaveBeenCalled();+});+it("passes prompt reference images and refmods to the extension", async () => {const { queue, session } = setup();session.update((config) => ({ ...config, references: [{ id: "trees", name: "Trees", kind: "image", description: "Tall pines", relativePath: "references/trees.png", intendedUse: [], createdAt: config.createdAt,diff --git a/src/lib/workQueue.ts b/src/lib/workQueue.tsindex bdaae0f..e46011d 100644--- a/src/lib/workQueue.ts+++ b/src/lib/workQueue.ts@@ -447,7 +447,8 @@ export class WorkQueue {if (!templateSupportsOutpainting(template)) throw new Error("Choose a generator that supports image editing for Zoom.");if (template.mode === "animate") throw new Error("Choose a prompt generator for Zoom.");const current = session.getSnapshot().config;- const source = current.assets.find((asset) => asset.id === sourceId && asset.kind === "image" && !asset.imageDraft);+ // Editing drafts retain saved source pixels that the Zoom canvas displays.+ const source = current.assets.find((asset) => asset.id === sourceId && asset.kind === "image");if (!source || (!source.relativePath && !source.sourcePath)) throw new Error("Select a saved image to extend.");const projectKey = projectQueueKey(session.record);if (this.items.some((item) => item.projectKey === projectKey && item.kind === "image" && item.imageAssetId === sourceId && isWorkActive(item))) return;