AI media harness for planning, generating, and editing locally
TypeScript
Remove duplicate source conditioning from Extend
Bitticebdc5112370
diff --git a/RELEASE_NOTES.md b/RELEASE_NOTES.mdindex 4607a06..d723df2 100644--- a/RELEASE_NOTES.md+++ b/RELEASE_NOTES.md@@ -40,7 +40,7 @@ This alpha update adds LAN generation workers, Linux support, expanded color gra- The timeline playhead follows playback without waiting for editor updates.- Character sheets give side and back views explicit orientation instructions, keeping reference identity and clothing without copying the front-facing pose.- Extend bounding box edges gently snap to nearby original image borders when drawing, moving or resizing. Box dimensions use 32-pixel increments and stay within the maximum generation resolution.-- Extend uses the original image as its reference instead of stretched edge padding, requests a wider scene, and fully regenerates the new area through the outer edges.+- Extend uses the placed original in its inpainting canvas without a separately resized copy as a reference, preventing a duplicate scene beneath the preserved image. New areas regenerate through the outer edges.- Removing a reference from a scene's last prompt citation now removes it from generation inputs and “Used by.” References selected as frame or motion inputs remain active.- Copy and paste effect settings between matching effects from their **…** menus, including bypass state and LUT data.- Add voice reference chips directly in a shot's Speech field. Voice guidance stays separate from the words spoken.diff --git a/src/lib/extendImage.test.ts b/src/lib/extendImage.test.tsindex a099b3a..5187f70 100644--- a/src/lib/extendImage.test.ts+++ b/src/lib/extendImage.test.ts@@ -40,6 +40,29 @@ it("regenerates every new pixel to the outer edge in all directions", () => {}});+it("uses the positioned canvas as context and reserves picture labels only for cited references", () => {+ const config = createProjectConfig({ name: "Extend", prompt: "", aspectRatio: "1:1", resolution: "768p", targetDurationSeconds: 15 });+ const source = { id: "source", name: "Source", kind: "image" as const, mimeType: "image/png", width: 768, height: 768, createdAt: config.createdAt };+ const options = { bounds: { x: 0, y: 0, width: 1152, height: 1152 }, prompt: "", steps: 20, seed: 0 };+ const compile = (prompt: string) => compileExtendImage(config, source, "cache/canvas.png", { ...options, prompt });+ const withoutReferences = compile("");+ expect(withoutReferences.prompt).toMatch(/^integrated_multimodal_description:/);+ expect(withoutReferences.prompt).not.toContain("<Picture");+ expect(withoutReferences.prompt).toContain("Keep the existing scene at its current size and position");+ expect(withoutReferences.edits.every((edit) => edit.prompt === withoutReferences.prompt)).toBe(true);+ config.references = [{ id: "mood", name: "Mood", kind: "text", content: "Misty woodland", description: "", intendedUse: [], createdAt: config.createdAt }];+ expect(compile("@[ref:mood]").prompt).not.toContain("<Picture");+ for (let index = 1; index <= 9; index++) config.references.push({+ id: `ref-${index}`, name: `Tree ${index}`, kind: "image", relativePath: `references/${index}.png`, description: "", intendedUse: [], createdAt: config.createdAt,+ });+ const withReferences = compile(config.references.map((reference) => `@[ref:${reference.id}]`).join(" "));+ expect(withReferences.references).toHaveLength(10);+ for (let index = 1; index <= 9; index++) {+ expect(withReferences.prompt).toContain(`<Subject ${index + 1}> is Tree ${index}, providing appearance from <Picture ${index}>`);+ }+ expect(withReferences.prompt).not.toContain("<Picture 10>");+});+it("keeps selection and output on the generation grid without increasing the source pixel count", () => {const config = createProjectConfig({ name: "Extend", prompt: "", aspectRatio: "16:9", resolution: "2048p", targetDurationSeconds: 15 });for (const source of [{ width: 400, height: 300 }, { width: 3648, height: 2048 }, { width: 2048, height: 3648 }, { width: 8192, height: 8192 }]) {diff --git a/src/lib/extendImage.ts b/src/lib/extendImage.tsindex cda99d3..b19de54 100644--- a/src/lib/extendImage.ts+++ b/src/lib/extendImage.ts@@ -90,7 +90,7 @@ export function compileExtendImage(config: ProjectConfig, source: ProjectAsset,if (!Number.isSafeInteger(options.seed) || options.seed < -1) throw new Error("Seed must be -1 for random or a non-negative safe integer.");const scene = createImageEditScene({ relativePath: sourceRelativePath, name: source.name, ...output });scene.steps = options.steps; scene.seed = options.seed;- scene.nodes[0].description = "Expand the field of view beyond the original image. Continue the environment, objects, textures, perspective and lighting into the new space with natural new detail. The original scene remains in its placed area within the larger composition. " + options.prompt.trim();+ scene.nodes[0].description = "Fill the masked area beyond the edges of the existing image in the canvas. Continue the environment, objects, textures, perspective and lighting seamlessly into this new space with natural new detail. Keep the existing scene at its current size and position; do not repeat, enlarge or reframe it in the new area. " + options.prompt.trim();const compiled = compileImagePrompt({ ...config, settings: { ...config.settings, defaultLook: null }, imageScene: scene }, { sourceTreatment: "outpaint" });// The rectangular editor needs a little original context at each seam.// The native finalizer restores the downscaled source pixels after generation.diff --git a/src/lib/extendWork.test.ts b/src/lib/extendWork.test.tsindex 7d377ee..38a9f39 100644--- a/src/lib/extendWork.test.ts+++ b/src/lib/extendWork.test.ts@@ -55,10 +55,11 @@ it.each([false, true])("extends a frozen source and saves a child with a durableconst request = await submitted();const { jobId } = request;expect(request).toMatchObject({ stillImage: true, frames: 1, seed: 0, steps: 25, canvasWidth: 128, canvasHeight: 64,- imageEdit: { sourceRelativePath: `cache/extend-images/${jobId}/canvas.png` }, referencePaths: [`C:/Extend/cache/extend-images/${jobId}/original.png`] });+ imageEdit: { sourceRelativePath: `cache/extend-images/${jobId}/canvas.png` }, referencePaths: [] });expect(request.imageEdit!.edits).toHaveLength(4);expect(request.imageEdit!.edits.every((edit) => edit.feather === 0)).toBe(true);- expect(request.prompt).toContain("expands the scene in <Picture 1> beyond its original borders");+ expect(request.prompt).toContain("Fill the masked area beyond the edges of the existing image in the canvas");+ expect(request.prompt).not.toContain("<Picture");expect(request.prompt).not.toContain("composition anchor");expect(request.prompt).toContain("Continue the forest");expect(request.prompt).not.toContain("Changed");@@ -84,8 +85,9 @@ it("passes prompt reference images and refmods to the extension", async () => {refmods: [{ id: "forest", name: "Forest", relativePath: "references/forest.safetensors", strength: 1, copies: 1 }] }] }));queue.enqueueExtendImage(session, template, "source", { ...options(), prompt: "More @[ref:trees]" });const request = await submitted();- expect(request.referencePaths).toHaveLength(2);- expect(request.referencePaths[1]).toBe("C:/Extend/references/trees.png");+ expect(request.referencePaths).toEqual(["C:/Extend/references/trees.png"]);+ expect(request.prompt).toContain("<Subject 1> is Trees, providing appearance from <Picture 1>");+ expect(request.prompt).not.toContain("<Picture 2>");expect(request.refmods).toEqual([{ path: "C:/Extend/references/forest.safetensors", strength: 1, copies: 1 }]);expect(request.prompt).not.toContain("@[ref:");emit("framesReady", request.jobId);diff --git a/src/lib/imagePrompt.ts b/src/lib/imagePrompt.tsindex 0cfe68e..82e7730 100644--- a/src/lib/imagePrompt.ts+++ b/src/lib/imagePrompt.ts@@ -13,11 +13,13 @@ export function compileImagePrompt(config: ProjectConfig, options: { referenceTrif (isVideoReference(reference) || reference.kind === "audio") throw new Error(`Still images accept image and text references; the prompt cites the ${reference.kind} reference '${reference.name}'.`);return reference;});- // An inpainting source is also an explicit composition anchor. The caller- // submits it before the selected reference pictures, even with no subjects.+ // Ordinary edits submit the source before the selected reference pictures.+ // Outpainting uses only the positioned inpainting canvas for source context;+ // submitting the original as a separate picture would lose that placement.const editing = scene.rootType === "image" && Boolean(scene.sourceImage);const outpainting = editing && options.sourceTreatment === "outpaint";- let picture = editing ? 1 : 0;+ const sourcePicture = editing && !outpainting;+ let picture = sourcePicture ? 1 : 0;const subjects = references.flatMap((reference) => {const labels = referenceImages(reference).map(() => `<Picture ${++picture}>`);const definition = referenceDefinition(reference);@@ -41,9 +43,12 @@ export function compileImagePrompt(config: ProjectConfig, options: { referenceTrreturn index < 0 ? references.find((reference) => reference.id === part.value)!.name : label(index);}).join("");const visual = { style: cite(parts.style), composition: cite(parts.composition) };+ const style = outpainting+ ? "The still image continues the visual medium, lighting, palette and perspective of the existing image in the canvas."+ : editing ? "The still image retains the visual medium, lighting, palette and perspective of <Picture 1>." : visual.style;const audio = ["overall_soundscape: N/A", "non_diegetic_music: N/A"];- if (!subjects.length && !editing) return {- prompt: [`integrated_multimodal_description: [Shot 1] ${visual.style}\n${visual.composition}`, ...audio].join("\n\n"), references,+ if (!subjects.length && !sourcePicture) return {+ prompt: [`integrated_multimodal_description: [Shot 1] ${style}\n${visual.composition}`, ...audio].join("\n\n"), references,};const definitions = subjects.map((subject, index) => `${label(index)} is ${subject.name}, providing ${subject.role}${subject.source}. ${subject.description}`);const retention = subjects.map((subject, index) => {@@ -52,20 +57,15 @@ export function compileImagePrompt(config: ProjectConfig, options: { referenceTr? `${label(index)} (appears in [Shot 1]): partially_preserved - ${transformation}`: `${label(index)} (appears in [Shot 1]): fully_preserved - retain the referenced ${subject.role} of ${subject.name} while following the requested composition and styling.`;});- if (editing) {- definitions.unshift(outpainting- ? "<Picture 1> shows the original scene before its field of view is expanded, providing the subject, environment, perspective, lighting and visual style. It does not show the complete output framing."- : "<Picture 1> is the original source image and composition anchor for the edited still keyframe in [Shot 1], providing the framing, perspective, environment, lighting and visual style.");- retention.unshift(outpainting- ? "<Picture 1> ([Shot 1] expanded scene): partially_preserved - preserve the existing scene within its placed area and generate a natural continuation beyond it. Expand the framing with new objects and scene detail consistent with the original perspective and lighting."- : "<Picture 1> ([Shot 1] edited keyframe): partially_preserved - retain its composition and visual characteristics except for the described change. Preserve all other content, including any previously completed edits.");+ if (sourcePicture) {+ definitions.unshift("<Picture 1> is the original source image and composition anchor for the edited still keyframe in [Shot 1], providing the framing, perspective, environment, lighting and visual style.");+ retention.unshift("<Picture 1> ([Shot 1] edited keyframe): partially_preserved - retain its composition and visual characteristics except for the described change. Preserve all other content, including any previously completed edits.");}const summary = outpainting- ? "[reference generation] A single still image expands the scene in <Picture 1> beyond its original borders. The new space contains a coherent continuation of the scene."+ ? "[keyframe completion + reference generation] A single still image fills the masked extension of the existing canvas with a coherent continuation of the scene.": editing? `[keyframe completion${subjects.length ? " + reference generation" : ""}] The target is a single edited still keyframe based on <Picture 1>. Apply the described change while preserving all other content.${subjects.length ? ` Use ${subjects.map((_, index) => label(index)).join(", ")} for the specified reference attributes.` : ""}`: `[reference generation] A single still image uses ${subjects.map((_, index) => label(index)).join(", ")} in the requested composition.`;- const style = editing ? "The still image retains the visual medium, lighting, palette and perspective of <Picture 1>." : visual.style;return { prompt: [`subject_definitions:\n${definitions.join("\n")}`,`summary:\n${summary}`,diff --git a/src/lib/workQueue.ts b/src/lib/workQueue.tsindex f20627a..c9dd0b7 100644--- a/src/lib/workQueue.ts+++ b/src/lib/workQueue.ts@@ -308,9 +308,10 @@ export class WorkQueue {const id = `extend-${crypto.randomUUID()}`;const sourceRelativePath = `cache/extend-images/${id}/canvas.png`;const compiled = compileExtendImage(config, source, sourceRelativePath, options);- // Reference only real scene content, never the ungenerated canvas padding.- const referencePaths = [projectItemPath(session.record.folderPath, { relativePath: `cache/extend-images/${id}/original.png` })!,- ...compiled.references.flatMap((reference) => referenceImages(reference).map((image) => projectItemPath(session.record.folderPath, image)!))];+ // The inpainting canvas already supplies the original at its selected size+ // and position. A separate reference is resized independently by the model+ // and can reproduce the whole original scene inside the extension.+ const referencePaths = compiled.references.flatMap((reference) => referenceImages(reference).map((image) => projectItemPath(session.record.folderPath, image)!));const request: SlopfabGenerationRequest = { jobId: id, stillImage: true, frames: 1, prompt: compiled.prompt,canvasWidth: compiled.layout.output.width, canvasHeight: compiled.layout.output.height, steps: generationStepsWithLoras(options.steps, config), seed: imageGenerationSeed(options.seed),referencePaths, refmods: referenceRefmodInputs(session.record.folderPath, compiled.references),