AI media harness for planning, generating, and editing locally
TypeScript
Keep edit prompts on parent images
Bittia0a1e93e6d17
diff --git a/RELEASE_NOTES.md b/RELEASE_NOTES.mdindex 86e22d4..1d9846a 100644--- a/RELEASE_NOTES.md+++ b/RELEASE_NOTES.md@@ -12,7 +12,7 @@ This alpha update adds Prompt video scenes, agent image drafts, Sol attention an## Fixes and improvements-- Image edits keep the original as the parent and save results as child versions. Selecting a result restores its edit prompt, source and settings for rerunning or creating another variation.+- Image edits keep the original as the parent with its saved prompt and settings. Child results open as normal images ready for further edits; selecting images does not create editing copies.- Whole-image edits now reach every edge without feathering.- Imported still images now have steps, seed and resolution controls. Resolution defaults to the source dimensions rounded down to multiples of 32, with additional sizes matching the source aspect ratio.- Fixed CUDA transformer-loading memory failures with bounded upload buffers, more accurate memory budgeting and automatic retries with more CPU offloading, while preserving precision and output settings.diff --git a/src-tauri/src/project/commands/clips.rs b/src-tauri/src/project/commands/clips.rsindex 2bdbc7f..4fbfe6b 100644--- a/src-tauri/src/project/commands/clips.rs+++ b/src-tauri/src/project/commands/clips.rs@@ -62,7 +62,7 @@ pub(super) fn apply(width: None,height: None,has_audio: None,- image_generation: None,+ image_generation: None, image_editing: None,scene_segments: None,image_draft: None,parent_asset_id: None,diff --git a/src-tauri/src/project/model.rs b/src-tauri/src/project/model.rsindex ef5c56f..6022fd4 100644--- a/src-tauri/src/project/model.rs+++ b/src-tauri/src/project/model.rs@@ -119,6 +119,8 @@ pub(crate) struct ProjectAsset {#[serde(default, skip_serializing_if = "Option::is_none")]pub(crate) image_generation: Option<super::image::ImageGenerationSnapshot>,#[serde(default, skip_serializing_if = "Option::is_none")]+ pub(crate) image_editing: Option<super::image::ImageGenerationSnapshot>,+ #[serde(default, skip_serializing_if = "Option::is_none")]pub(crate) image_draft: Option<bool>,/// The family's primary image; the image bar shows it first, followed by/// the other versions. Choosing a primary keeps the family one level deep.diff --git a/src-tauri/src/project/validation/assets.rs b/src-tauri/src/project/validation/assets.rsindex 248efc8..81da5e6 100644--- a/src-tauri/src/project/validation/assets.rs+++ b/src-tauri/src/project/validation/assets.rs@@ -22,7 +22,11 @@ pub(super) fn validate(config: &mut ProjectConfig) -> Result<(), String> {if asset.image_draft == Some(true) && (asset.kind != "image" || !asset.image_generation.as_ref().is_some_and(|snapshot| snapshot.scene.root_type.as_deref() != Some("image") || snapshot.scene.source_image.is_some())) {return Err("Image drafts require a scene snapshot and image roots require a source.".into());}- if let Some(snapshot) = &mut asset.image_generation {+ if asset.image_editing.as_ref().is_some_and(|snapshot| snapshot.scene.root_type.as_deref() != Some("image")+ || snapshot.scene.source_image.as_ref().map(|source| &source.relative_path) != asset.relative_path.as_ref() || asset.relative_path.is_none()) {+ return Err("Image editing instructions must use this image as their source.".into());+ }+ for snapshot in asset.image_generation.iter_mut().chain(asset.image_editing.iter_mut()) {snapshot.scene.validate()?;if let Some(template) = &snapshot.template { template.validate()?; }if asset.kind != "image"diff --git a/src-tauri/src/tests/images.rs b/src-tauri/src/tests/images.rsindex 3666134..f9a9e0f 100644--- a/src-tauri/src/tests/images.rs+++ b/src-tauri/src/tests/images.rs@@ -4,6 +4,26 @@ fn image_fixture() -> ProjectConfig {serde_json::from_str(include_str!("../../../fixtures/project-v1-image.json")).unwrap()}+#[test]+fn image_parent_editing_instructions_survive_native_save_and_reopen() {+ let mut config = image_fixture();+ let mut snapshot: serde_json::Value = serde_json::from_str(include_str!("../../../fixtures/image-generation-snapshot.json")).unwrap();+ snapshot["scene"]["rootType"] = serde_json::json!("image");+ snapshot["scene"]["sourceImage"] = serde_json::json!({"name":"Original", "relativePath":"media/original.png", "width":640, "height":480});+ snapshot["scene"]["nodes"][0]["description"] = serde_json::json!("Make the sky pink");+ config.assets.push(serde_json::from_value(serde_json::json!({+ "id":"original", "kind":"image", "name":"Original", "relativePath":"media/original.png", "mimeType":"image/png",+ "width":640, "height":480, "createdAt":config.created_at, "imageEditing":snapshot+ })).unwrap());+ let root = tempfile::tempdir().unwrap();+ let created = create_project_in(root.path(), &config).unwrap();+ let opened = read_project(Path::new(&created.folder_path)).unwrap();+ assert_eq!(opened.config.assets, config.assets);+ let mut invalid = opened.config;+ invalid.assets[0].image_editing.as_mut().unwrap().scene.source_image.as_mut().unwrap().relative_path = "media/another.png".into();+ assert!(validate_and_normalize_config(invalid).is_err());+}+#[test]fn image_editing_draft_survives_save_and_reopen() {let mut config = image_fixture();diff --git a/src-tauri/src/tests/media_access.rs b/src-tauri/src/tests/media_access.rsindex 0b9edbe..feade30 100644--- a/src-tauri/src/tests/media_access.rs+++ b/src-tauri/src/tests/media_access.rs@@ -111,7 +111,7 @@ fn external_media_is_readable_only_because_the_project_names_it() {width: None,height: None,has_audio: None,- image_generation: None, scene_segments: None,+ image_generation: None, image_editing: None, scene_segments: None,image_draft: None,parent_asset_id: None,created_at: config.created_at.clone(),@@ -285,7 +285,7 @@ fn a_project_the_user_only_opened_reads_any_media_file_it_names() {width: None,height: None,has_audio: None,- image_generation: None, scene_segments: None,+ image_generation: None, image_editing: None, scene_segments: None,image_draft: None,parent_asset_id: None,created_at: config.created_at.clone(),diff --git a/src-tauri/src/tests/persistence.rs b/src-tauri/src/tests/persistence.rsindex fb25871..10a5e49 100644--- a/src-tauri/src/tests/persistence.rs+++ b/src-tauri/src/tests/persistence.rs@@ -430,7 +430,7 @@ fn a_project_file_only_yields_media_a_hand_edit_cannot_widen() {width: None,height: None,has_audio: None,- image_generation: None, scene_segments: None,+ image_generation: None, image_editing: None, scene_segments: None,image_draft: None,parent_asset_id: None,created_at: config.created_at.clone(),diff --git a/src/components/workspace/ImageEditor.test.tsx b/src/components/workspace/ImageEditor.test.tsxindex ccbd650..7a49ba5 100644--- a/src/components/workspace/ImageEditor.test.tsx+++ b/src/components/workspace/ImageEditor.test.tsx@@ -108,7 +108,7 @@ it.each(["extend", "character-sheet"] as const)("returns from %s settings to nor/* Undo lives in the title bar; inside the editor it is Ctrl+Z. */const undoImageEdit = () => fireEvent.keyDown(screen.getByRole("tree", { name: "Image nodes" }), { key: "z", code: "KeyZ", ctrlKey: true });-it("shows an edited child with its saved prompt and creates another draft on the original when changed", async () => {+it("keeps the prompt on the parent, opens children without drafts, and edits a child's own pixels", async () => {vi.spyOn(persistence, "readMediaFileUrl").mockImplementation(async (_folder, location) => `blob:${location.relativePath}`);vi.stubGlobal("URL", class extends URL { static revokeObjectURL = vi.fn(); });const initial = parseProjectConfig(fixture);@@ -120,24 +120,29 @@ it("shows an edited child with its saved prompt and creates another draft on theimageGeneration: { ...imageGenerationSnapshot(initial, "Compiled edit", defaultGeneratorTemplate().id), usedSeed: 42 } };initial.assets = [original, result];const current = setup(restoreGeneratedImage(initial, result.id));- expect(promptValue(screen.getByLabelText("Edit prompt"))).toBe("Warm up the lighting");+ expect(promptValue(screen.getByLabelText("Edit prompt"))).toBe("");expect(screen.getByLabelText("Seed")).toHaveValue(-1);expect(screen.getByLabelText("Used seed")).toHaveValue("42");const preview = () => document.querySelector<HTMLImageElement>(".image-frame img");await waitFor(() => expect(preview()).toHaveAttribute("src", "blob:media/edited.png"));expect(preview()!.parentElement!.style.getPropertyValue("--image-ratio")).toBe(String(672 / 544));fireEvent.click(screen.getByRole("button", { name: "View Original" }));+ expect(promptValue(screen.getByLabelText("Edit prompt"))).toBe("Warm up the lighting");fireEvent.click(screen.getByRole("button", { name: "View Edited" }));fireEvent.click(screen.getByRole("button", { name: "View Edited" }));expect(current().assets).toEqual([original, result]);- expect(promptValue(screen.getByLabelText("Edit prompt"))).toBe("Warm up the lighting");+ expect(promptValue(screen.getByLabelText("Edit prompt"))).toBe("");typePrompt(screen.getByLabelText("Edit prompt"), "Make it moonlit");- expect(current().assets.slice(0, 2)).toEqual([original, result]);+ expect(current().assets[0]).toEqual(original);+ expect(current().assets[1].imageGeneration).toEqual(result.imageGeneration);expect(current().assets[2]).toMatchObject({ imageDraft: true, parentAssetId: "original", imageGeneration: {- scene: { sourceImage: { relativePath: "media/original.png" }, nodes: [{ description: "Make it moonlit" }] } } });- await waitFor(() => expect(preview()).toHaveAttribute("src", "blob:media/original.png"));+ scene: { sourceImage: { relativePath: "media/edited.png" }, nodes: [{ description: "Make it moonlit" }] } } });+ await waitFor(() => expect(preview()).toHaveAttribute("src", "blob:media/edited.png"));fireEvent.click(screen.getByRole("button", { name: "View Edited" }));+ expect(promptValue(screen.getByLabelText("Edit prompt"))).toBe("Make it moonlit");+ fireEvent.click(screen.getByRole("button", { name: "View Original" }));expect(promptValue(screen.getByLabelText("Edit prompt"))).toBe("Warm up the lighting");+ expect(current().assets).toHaveLength(3);});it("edits imported-image generation settings and restores them with the draft", () => {@@ -156,7 +161,7 @@ it("edits imported-image generation settings and restores them with the draft",const reopened = parseProjectConfig(JSON.parse(JSON.stringify(current())));expect(reopened.imageScene).toEqual(current().imageScene);fireEvent.click(screen.getByRole("button", { name: "View Imported" }));- expect(comboValue(screen.getByLabelText("Resolution"))).toBe("992x800");+ expect(comboValue(screen.getByLabelText("Resolution"))).toBe("672x544");fireEvent.click(screen.getByRole("button", { name: "View Editing Imported" }));expect(screen.getByLabelText("Steps")).toHaveValue(32);expect(screen.getByLabelText("Seed")).toHaveValue(123456);@@ -190,7 +195,8 @@ it.each(["media/photo.png", "references/photo.webp", "references/frames/frame.pnconst draftId = current().assets[1].id;fireEvent.click(screen.getByRole("button", { name: "View Imported" }));expect(current().imageScene?.outputAssetId).toBe("imported");- expect(promptValue(screen.getByLabelText("Edit prompt"))).toBe("");+ expect(promptValue(screen.getByLabelText("Edit prompt"))).toBe("Make the sky pink");+ expect(current().assets).toHaveLength(2);fireEvent.click(screen.getByRole("button", { name: "View Editing Imported" }));expect(current().imageScene?.outputAssetId).toBe(draftId);expect(promptValue(screen.getByLabelText("Edit prompt"))).toBe("Make the sky pink");diff --git a/src/components/workspace/ImageEditor.tsx b/src/components/workspace/ImageEditor.tsxindex 87d2875..6410f54 100644--- a/src/components/workspace/ImageEditor.tsx+++ b/src/components/workspace/ImageEditor.tsx@@ -6,7 +6,7 @@ import { compileImageEdits, editGeneratedImage, imageEditDebugPrompt, imageEditOimport { imageSettings } from "../../lib/imageSettings";import { outputDimensions } from "../../lib/export";import { compileImagePrompt } from "../../lib/imagePrompt";-import { createEmptyImage, imageFamily, imageFamilyRoot, makeImagePrimary, removeImageAsset, restoreGeneratedImage, saveImageDraft } from "../../lib/imageHistory";+import { createEmptyImage, imageEditingSnapshot, imageFamily, imageFamilyRoot, makeImagePrimary, removeImageAsset, restoreGeneratedImage, saveImageDraft } from "../../lib/imageHistory";import { isTauri } from "../../lib/persistence";import { createDraftGenerationJob, isVideoReference, PROJECT_RESOLUTIONS, referenceTypeLabel, type ProjectConfig, type ProjectReference } from "../../lib/project";import { defaultGeneratorTemplate, generationStepsForTemplate, loadDebugOptionsEnabled, loadGeneratorTemplateSettings, MINIMAX_H3_MODEL_TYPE, subscribeDebugOptions, subscribeGeneratorTemplates, templateUsable, type GeneratorTemplate } from "../../lib/settings";@@ -219,7 +219,8 @@ export function ImageEditor({ config, folderPath, onChange: changeConfig, onGenesetImageMenu(output ? { id: output.id, x, y, inFamily: imageFamily(images, output.id).length > 1, source: "canvas" } : null);};const resetImageEditing = (id: string) => {- const snapshot = config.assets.find((asset) => asset.id === id)?.imageGeneration;+ const asset = config.assets.find((asset) => asset.id === id);+ const snapshot = asset && (imageEditingSnapshot(config, asset) ?? asset.imageGeneration);if (!snapshot) return;undo.current = []; redo.current = []; historyChanged((value) => value + 1);pointer.current = null; setDraftBox(null); setDrawKind(null); setRenaming(null);diff --git a/src/lib/imageHistory.test.ts b/src/lib/imageHistory.test.tsindex 434b97d..5c46d68 100644--- a/src/lib/imageHistory.test.ts+++ b/src/lib/imageHistory.test.ts@@ -6,6 +6,29 @@ import snapshotFixture from "../../fixtures/image-generation-snapshot.json";import { createImageEditScene, createImageScene } from "./imageScene";describe("generated image history", () => {+ it("retains the parent's edit instructions after reopening and deleting its children", () => {+ const initial = parseProjectConfig(fixture);+ const source = { name: "Original", relativePath: "media/original.png", width: 640, height: 480 };+ initial.assets = [{ ...source, id: "original", kind: "image", mimeType: "image/png", createdAt: initial.createdAt }];+ initial.imageScene = { ...createImageEditScene(source), outputAssetId: "original" };+ initial.imageScene.nodes[0].description = "Make the sky pink";+ const drafted = saveImageDraft(initial, "generator");+ const draft = drafted.assets.find((asset) => asset.imageDraft)!;+ const completed = completeImageDraft(drafted, draft.id, { ...draft, name: "Edited", relativePath: "media/edited.png" });+ expect(completed.imageScene!.nodes[0].description).toBe("");+ expect(completed.imageScene!.sourceImage?.relativePath).toBe("media/edited.png");+ const reopened = parseProjectConfig(JSON.parse(JSON.stringify(completed)));+ const parent = restoreGeneratedImage({ ...reopened, assets: removeImageAsset(reopened.assets, draft.id) }, "original");+ expect(parent.imageScene!.nodes[0].description).toBe("Make the sky pink");+ expect(parent.imageScene!.sourceImage).toEqual(source);+ expect(saveImageDraft(parent)).toBe(parent);+ expect(parent.assets).toHaveLength(1);+ expect(parent.assets[0].imageGeneration).toBeUndefined();+ const invalid = structuredClone(parent);+ invalid.assets[0].imageEditing!.scene.sourceImage!.relativePath = "media/another.png";+ expect(() => parseProjectConfig(invalid)).toThrow("Image editing instructions must use this image as their source.");+ });+it("keeps a submitted template intact when editing its pending entry and completing in the background", () => {const config = parseProjectConfig(fixture);config.imageScene = createImageScene("Forest");diff --git a/src/lib/imageHistory.ts b/src/lib/imageHistory.tsindex 6b506e3..d129624 100644--- a/src/lib/imageHistory.ts+++ b/src/lib/imageHistory.ts@@ -18,6 +18,13 @@ export function imageGenerationSnapshot(config: ProjectConfig, prompt: string, g});}+/** Recover older parents' instructions from their saved edits until authored again. */+export function imageEditingSnapshot(config: ProjectConfig, asset: ProjectAsset): ImageGenerationSnapshot | undefined {+ return asset.imageEditing ?? (!asset.imageDraft && asset.relativePath ? [...config.assets].reverse().find((candidate) => candidate.id !== asset.id+ && !candidate.imageGeneration?.template && candidate.imageGeneration?.scene.rootType === "image"+ && candidate.imageGeneration.scene.sourceImage?.relativePath === asset.relativePath)?.imageGeneration : undefined) ?? undefined;+}+/** The primary image of `id`'s family: its parent, or itself when it is the* primary (or its parent has since been removed). */export function imageFamilyRoot(assets: readonly ProjectAsset[], id: string | null | undefined): string | undefined {@@ -67,8 +74,8 @@ export function saveImageDraft(config: ProjectConfig, generatorTemplateId?: striif (templateDraft && JSON.stringify({ ...scene, outputAssetId: null }) === JSON.stringify(selected.imageGeneration!.scene)) return config;const source = scene.rootType === "image" ? scene.sourceImage : null;if (!source && !selected?.imageDraft) return config;- const snapshot = imageGenerationSnapshot(config, "", generatorTemplateId || selected?.imageGeneration?.generatorTemplateId || "image-draft");- const saved = selected?.imageGeneration;+ const saved = selected && !selected.imageDraft ? imageEditingSnapshot(config, selected) : selected?.imageGeneration;+ const snapshot = imageGenerationSnapshot(config, "", generatorTemplateId || saved?.generatorTemplateId || selected?.imageGeneration?.generatorTemplateId || "image-draft");// Merely viewing a finished edit (including session autosave) must not create// a draft. Generate explicitly forks it, even when its inputs are unchanged.if (!regenerate && selected && !selected.imageDraft && saved && !saved.template@@ -83,6 +90,9 @@ export function saveImageDraft(config: ProjectConfig, generatorTemplateId?: striconst existing = selected?.imageDraft && !templateDraft ? selected : undefined;const id = existing?.id ?? `image-draft-${crypto.randomUUID()}`;const edited = source && config.assets.find((asset) => asset.kind === "image" && !asset.imageDraft && asset.relativePath === source.relativePath);+ if (edited && JSON.stringify(edited.imageEditing) !== JSON.stringify(snapshot)) {+ config = { ...config, assets: config.assets.map((asset) => asset.id === edited.id ? { ...asset, imageEditing: structuredClone(snapshot) } : asset) };+ }const parentAssetId = existing?.parentAssetId ?? imageFamilyRoot(config.assets, templateDraft ? selected.id : edited?.id);if (existing && existing.parentAssetId === parentAssetId && JSON.stringify(existing.imageGeneration) === JSON.stringify(snapshot)) return config;const asset = { id, kind: "image" as const, ...source, name: existing?.name ?? (source ? `Editing ${source.name}` : "New image"),@@ -129,7 +139,8 @@ export function completeImageDraft(config: ProjectConfig, id: string, result: Prexport function restoreGeneratedImage(config: ProjectConfig, id: string): ProjectConfig {const asset = config.assets.find((candidate) => candidate.id === id && candidate.kind === "image");if (!asset) return config;- const snapshot = asset.imageGeneration;+ const editing = !asset.imageDraft ? imageEditingSnapshot(config, asset) : undefined;+ const snapshot = editing ?? asset.imageGeneration;const source = !snapshot && imageSourceSchema.safeParse(asset);if (source && source.success) {return { ...config, thumbnail: asset.relativePath ?? null,@@ -138,7 +149,7 @@ export function restoreGeneratedImage(config: ProjectConfig, id: string): Projecif (!snapshot) return { ...config, thumbnail: asset.relativePath ?? null,imageScene: { ...(config.imageScene?.rootType === "image" ? createImageScene() : config.imageScene ?? createImageScene(config.brief.prompt)), outputAssetId: id } };const restored = structuredClone(snapshot);- const scene = !asset.imageDraft && restored.template && restored.scene.rootType === "image" && asset.relativePath && asset.width && asset.height+ const scene = !editing && !asset.imageDraft && restored.scene.rootType === "image" && asset.relativePath && asset.width && asset.height? createImageEditScene({ relativePath: asset.relativePath, name: asset.name, width: asset.width, height: asset.height }, restored.scene): restored.scene;const references = new Map(restored.references.map((reference) => [reference.id, reference]));diff --git a/src/lib/project.ts b/src/lib/project.tsindex 26e3976..ea742d1 100644--- a/src/lib/project.ts+++ b/src/lib/project.ts@@ -208,6 +208,8 @@ export const projectAssetSchema = z.object({* Latent paths identify the exact source generations, including branches. */sceneSegments: z.array(sceneMediaSegmentSchema).min(1).nullish(),imageGeneration: imageGenerationSnapshotSchema.nullish(),+ /** Editable instructions belonging to this image, separate from how it was generated. */+ imageEditing: imageGenerationSnapshotSchema.nullish(),imageDraft: z.boolean().nullish(),/** The family's primary image. Always its first image, never another child,* so a family is one level even after choosing a different primary. */@@ -233,6 +235,9 @@ export const projectAssetSchema = z.object({if (asset.imageGeneration && asset.kind !== "image") {context.addIssue({ code: z.ZodIssueCode.custom, path: ["imageGeneration"], message: "Only image assets can store image generation history." });}+ if (asset.imageEditing && (asset.kind !== "image" || asset.imageEditing.scene.rootType !== "image" || !asset.relativePath || asset.imageEditing.scene.sourceImage?.relativePath !== asset.relativePath)) {+ context.addIssue({ code: z.ZodIssueCode.custom, path: ["imageEditing"], message: "Image editing instructions must use this image as their source." });+ }/* Generated scenes and blank image drafts can exist before rendering.* WorkQueue fills their file paths in when generation ends. */if (asset.kind !== "generated" && !asset.imageDraft && !asset.relativePath && !asset.sourcePath) {diff --git a/src/lib/workQueue.test.ts b/src/lib/workQueue.test.tsindex 062a12b..09785c4 100644--- a/src/lib/workQueue.test.ts+++ b/src/lib/workQueue.test.ts@@ -476,8 +476,9 @@ describe("image generation work", () => {await finish(queue, request.jobId);const result = parseProjectConfig(JSON.parse(JSON.stringify(session.getSnapshot().config)));expect(result.assets[1].imageGeneration!.references.map((reference) => reference.id)).toEqual(["Lighting", "Balloon"]);- expect(result.imageScene!.nodes).toEqual(scene.nodes);- expect(result.imageScene!.sourceImage).toEqual(scene.sourceImage);+ expect(result.imageScene!.nodes).toHaveLength(1);+ expect(result.imageScene!.nodes[0].description).toBe("");+ expect(restoreGeneratedImage(result, result.assets[0].id).imageScene!.nodes).toEqual(scene.nodes);});it("submits ordered inpainting as one job, saves a child PNG, and retains its edit recipe", async () => {const { queue } = setup();@@ -509,14 +510,14 @@ describe("image generation work", () => {await finish(queue, request.jobId);expect(invoke).toHaveBeenCalledWith("save_generated_image", { folderPath: record.folderPath, jobId: request.jobId, format: "png" });const result = session.getSnapshot().config;- expect(result.imageScene!.nodes).toEqual(scene.nodes);+ expect(result.imageScene!.nodes).toHaveLength(1);expect(result.assets).toHaveLength(2);expect(result.assets[0]).toMatchObject({ relativePath: "media/generated/source.jpg" });expect(result.assets[1]).toMatchObject({ id: draftId, imageDraft: false, relativePath: "media/generated/edited.png", parentAssetId: result.assets[0].id });expect(result.imageScene!.outputAssetId).toBe(draftId);- expect(result.imageScene).toMatchObject({ rootType: "image", sourceImage: scene.sourceImage });+ expect(result.imageScene).toMatchObject({ rootType: "image", sourceImage: { relativePath: "media/generated/edited.png" } });expect(result.assets[1]).toMatchObject({ mimeType: "image/png", imageGeneration: { scene, prompt: expect.stringContaining("Edit 2 (24, 16, 48, 32)") } });- expect(restoreGeneratedImage(result, draftId).imageScene!.nodes).toEqual(scene.nodes);+ expect(restoreGeneratedImage(result, result.assets[0].id).imageScene!.nodes).toEqual(scene.nodes);expect(releaseRendered).toHaveBeenCalledWith(request.jobId);});it("submits the selected image edit resolution, steps and seed to planning and generation", async () => {@@ -557,12 +558,15 @@ describe("image generation work", () => {await finish(queue, request.jobId);const config = parseProjectConfig(JSON.parse(JSON.stringify(session.getSnapshot().config)));expect(config.assets).toHaveLength(index + 2);- expect(config.assets.slice(0, previous.length)).toEqual(previous);+ expect(config.assets.slice(0, previous.length).map(({ imageEditing: _editing, ...asset }) => asset)).toEqual(previous.map(({ imageEditing: _editing, ...asset }) => asset));expect(config.assets[0]).toMatchObject({ name: "Original", relativePath: "media/source.png", width: 1001, height: 809 });expect(config.assets.slice(1).every((asset) => asset.parentAssetId === config.assets[0].id && !asset.imageDraft)).toBe(true);- expect(config.imageScene).toMatchObject({ seed: -1, sourceImage: { relativePath: "media/source.png" }, outputSize: { width: 672, height: 544 } });- session.update(() => restoreGeneratedImage(config, config.assets[1].id));- expect(session.getSnapshot().config.imageScene!.nodes[0].description).toBe("Warm up the lighting");+ expect(config.imageScene!.nodes[0].description).toBe("");+ expect(config.imageScene!.sourceImage?.relativePath).toBe(`media/edited-${index}.png`);+ session.update(() => restoreGeneratedImage(config, config.assets[0].id));+ expect(session.getSnapshot().config.imageScene).toMatchObject({ seed: -1, sourceImage: { relativePath: "media/source.png" }, outputSize: { width: 672, height: 544 } });+ expect(session.getSnapshot().config.imageScene!.nodes[0].description).toBe(index === 2 ? "Make it moonlit" : "Warm up the lighting");+ expect(session.getSnapshot().config.assets).toHaveLength(index + 2);}});it.each(["browse", "modify", "cancel"])("keeps editing versions available during generation: %s", async (action) => {@@ -595,7 +599,7 @@ describe("image generation work", () => {expect(config.imageScene!.outputAssetId).toBe("original");expect(config.assets).toHaveLength(2);session.update((current) => restoreGeneratedImage(current, draftId));- expect(session.getSnapshot().config.imageScene!.nodes[1].description).toBe("A red balloon");+ expect(session.getSnapshot().config.imageScene!.nodes[0].description).toBe("");} else {expect(config.imageScene!.outputAssetId).not.toBe(draftId);expect(config.assets.filter((asset) => asset.imageDraft)).toHaveLength(1);