AI media harness for planning, generating, and editing locally
TypeScript
Add clothes and accessories reference presets
Bitti502811eeb6bf
diff --git a/RELEASE_NOTES.md b/RELEASE_NOTES.mdindex 6e22234..b789a55 100644--- a/RELEASE_NOTES.md+++ b/RELEASE_NOTES.md@@ -4,6 +4,7 @@ This alpha update adds DMAD LoRA support, resumable model downloads, and improve## What's new+- Clothes and Accessories reference categories include common wearable items. Clothes offer optional color and fabric settings.- Video references now offer a Frames mode: select still frames from a clip and use them as image references.- Interrupted weight and LoRA downloads retain their progress and can resume on retry, including after reopening the app.- Reference smart chips in image prompts and video shot descriptions, with reference artwork in the picker.diff --git a/docs/reference-icons.md b/docs/reference-icons.mdindex c87c7f6..b7871fe 100644--- a/docs/reference-icons.md+++ b/docs/reference-icons.md@@ -3,8 +3,8 @@Hover over a preset's icon area in **Add a reference** to reveal its generationbutton. It generates or regenerates only that preset and keeps the picker open.Hovering the button does not highlight or select the reference card.-Built-in icon work follows category order: Character, Animal, Product, Location,-then Style.+Built-in icon work follows category order: Character, Animal, Clothes,+Accessories, Product, Location, then Style.Slopus can close immediately while only reference icons are generating.An icon is published only after the complete JPEG is written and flushed to adiff --git a/scripts/generate-reference-icons.mjs b/scripts/generate-reference-icons.mjsindex f9058fe..603f7b7 100644--- a/scripts/generate-reference-icons.mjs+++ b/scripts/generate-reference-icons.mjs@@ -126,6 +126,8 @@ function promptFor(entry) {const description = {character: `a tight professional headshot portrait of ${entry.subject}, head and shoulders fully visible, facing the camera, natural neutral expression, eyes tack-sharp with clean symmetrical catchlights, realistic skin texture, flattering three-point portrait lighting with a large soft key at 45 degrees, gentle fill, subtle hair light and controlled highlights, simple light gray seamless studio background`,animal: `a clear animal portrait of ${entry.subject}, whole body visible, species-accurate anatomy and distinctive markings, detailed fur, feathers or scales, natural lighting, simple natural background`,+ clothing: `a clear studio photograph of ${entry.subject}, the complete clothing item visible, accurate silhouette and cut, detailed fabric texture and seams, controlled lighting, simple light gray background`,+ accessory: `a clear studio photograph of ${entry.subject}, the complete wearable accessory visible, accurate shape and materials, detailed finish, controlled reflections, simple light gray background`,product: `a professional full product photograph of ${entry.subject}, the entire product fully visible and centered, accurate geometry and materials, tack-sharp edges and fine surface detail, large diffused softbox key light, clean fill and precise rim separation, controlled reflections, simple light gray seamless studio background`,location: `a comprehensive establishing photograph of ${entry.subject}, the full location clearly visible, balanced natural cinematic illumination, crisp foreground, midground and background detail, realistic materials, clean color separation, broad dynamic range with protected highlights and open shadows`,style: stylePrompt(entry),@@ -184,10 +186,10 @@ for (const entry of manifest) {}if (seenIds.has(entry.id)) throw new Error(`Duplicate reference icon id '${entry.id}'.`);if (!entry.name?.trim() || !entry.subject?.trim()) throw new Error(`Reference icon '${entry.id}' needs a name and subject.`);- if (!["character", "animal", "product", "location", "style"].includes(entry.type)) throw new Error(`Reference icon '${entry.id}' has unsupported type '${entry.type}'.`);+ if (!["character", "animal", "clothing", "accessory", "product", "location", "style"].includes(entry.type)) throw new Error(`Reference icon '${entry.id}' has unsupported type '${entry.type}'.`);seenIds.add(entry.id);}-if (requestedType && !["character", "animal", "product", "location", "style"].includes(requestedType)) {+if (requestedType && !["character", "animal", "clothing", "accessory", "product", "location", "style"].includes(requestedType)) {throw new Error(`Unsupported reference icon type '${requestedType}'.`);}let entries = requestedIddiff --git a/src-tauri/assets/agent-system.md b/src-tauri/assets/agent-system.mdindex 8c88ac6..3eccd57 100644--- a/src-tauri/assets/agent-system.md+++ b/src-tauri/assets/agent-system.md@@ -8,7 +8,7 @@ For a response that makes no edit, return exactly one JSON object: {"kind":"answFor edits, return JSONL only: one compact JSON object per line, followed by one final commit line. Do not wrap the lines in an array or return the project document. The complete command vocabulary is:- {"op":"project.set","name"?:string,"prompt"?:string,"targetSeconds"?:integer,"aspectRatio"?:string,"resolution"?:string,"frameRate"?:integer,"backgroundColor"?:string}-- {"op":"ref.add","id":string,"name":string,"text":string,"use":["character"|"animal"|"product"|"location"|"style"|"audio",...]}+- {"op":"ref.add","id":string,"name":string,"text":string,"use":["character"|"animal"|"clothing"|"accessory"|"product"|"location"|"style"|"audio",...]}- {"op":"ref.set","id":string,"name"?:string,"text"?:string,"use"?:string[]}- {"op":"ref.remove","id":string}; update every scene that uses it first- {"op":"scene.add","id":string,"title":string,"seconds":number,"steps"?:integer,"seed"?:integer,"sound"?:string,"music"?:string,"startFrame"?:reference-id,"endFrame"?:reference-id,"usePreviousSceneLastFrame"?:boolean}diff --git a/src-tauri/src/agent/policy.rs b/src-tauri/src/agent/policy.rsindex 67580b3..cb9d706 100644--- a/src-tauri/src/agent/policy.rs+++ b/src-tauri/src/agent/policy.rs@@ -206,7 +206,7 @@ pub(super) fn validate_scene_policy(&& reference.intended_use.iter().any(|usage| {matches!(usage.as_str(),- "character" | "animal" | "location" | "product"+ "character" | "animal" | "clothing" | "accessory" | "location" | "product")})}) {diff --git a/src-tauri/src/project/validation/references.rs b/src-tauri/src/project/validation/references.rsindex e49cbba..e45c768 100644--- a/src-tauri/src/project/validation/references.rs+++ b/src-tauri/src/project/validation/references.rs@@ -148,7 +148,7 @@ pub(super) fn validate_references(references: &mut [ReusableReference]) -> Resulfor intent in &reference.intended_use {if !matches!(intent.as_str(),- "character" | "animal" | "product" | "location" | "style" | "audio"+ "character" | "animal" | "clothing" | "accessory" | "product" | "location" | "style" | "audio") {return Err(format!("Unsupported reference intended use '{intent}'."));}diff --git a/src-tauri/src/tests/references.rs b/src-tauri/src/tests/references.rsindex 6355ae9..1847a76 100644--- a/src-tauri/src/tests/references.rs+++ b/src-tauri/src/tests/references.rs@@ -37,6 +37,8 @@ fn reference_categories_and_subcategories_survive_project_save() {for (category, subcategory) in [("character", "Animation"),("animal", "Pets"),+ ("clothing", "Tops"),+ ("accessory", "Jewelry"),("product", "Technology"),("location", "Urban"),("style", "Cinematic"),diff --git a/src/components/workspace/ReferencesView.test.tsx b/src/components/workspace/ReferencesView.test.tsxindex cfe6c88..586633e 100644--- a/src/components/workspace/ReferencesView.test.tsx+++ b/src/components/workspace/ReferencesView.test.tsx@@ -192,6 +192,8 @@ describe("Reference type presets", () => {it.each([["Character", "character", "Animation"],["Animal", "animal", "Pets"],+ ["Clothes", "clothing", "Tops"],+ ["Accessories", "accessory", "Jewelry"],["Product", "product", "Technology"],["Location", "location", "Urban"],["Style", "style", "Cinematic"],@@ -331,6 +333,47 @@ describe("Reference type presets", () => {expect(screen.getByRole("textbox", { name: "Prompt" })).toHaveValue("A lunar research outpost in winter.");});+ it("adds clothes and restores, updates, and clears their color and fabric settings", () => {+ const state = setup();+ fireEvent.click(screen.getByRole("button", { name: /Add a reference/ }));+ const picker = screen.getByRole("dialog", { name: "Add a reference" });+ fireEvent.click(within(picker).getByRole("button", { name: "Clothes" }));+ fireEvent.click(within(picker).getByRole("tab", { name: "Tops" }));+ fireEvent.click(within(picker).getByRole("button", { name: /T-shirt/ }));+ const settings = screen.getByRole("region", { name: "Clothing settings" });+ expect(settings.closest("aside")).not.toBeNull();+ chooseOption(within(settings).getByRole("combobox", { name: "Color" }), "Navy blue");+ chooseOption(within(settings).getByRole("combobox", { name: "Fabric" }), "Cotton");+ const saved = parseProjectConfig(JSON.parse(JSON.stringify(state.latest())));+ expect(saved.references[0]).toMatchObject({ intendedUse: ["clothing"], subcategory: "Tops", description: "T-shirt, in navy blue, made of cotton.", content: "T-shirt, in navy blue, made of cotton." });+ cleanup();+ const restored = setup(saved);+ expect(comboValue(screen.getByRole("combobox", { name: "Color" }))).toBe("navy-blue");+ expect(comboValue(screen.getByRole("combobox", { name: "Fabric" }))).toBe("cotton");+ choose("Color", "Red");+ choose("Fabric", "Linen");+ expect(restored.latest().references[0].description).toBe("T-shirt, in red, made of linen.");+ choose("Color", "None");+ expect(restored.latest().references[0].description).toBe("T-shirt, made of linen.");+ choose("Fabric", "None");+ expect(restored.latest().references[0].description).toBe("T-shirt.");+ fireEvent.change(screen.getByRole("textbox", { name: "Prompt" }), { target: { value: "A hand-painted concert shirt." } });+ expect(screen.queryByRole("region", { name: "Clothing settings" })).not.toBeInTheDocument();+ expect(restored.latest().references[0].description).toBe("A hand-painted concert shirt.");+ });++ it("finds wearable accessories by subcategory and search", () => {+ const state = setup();+ fireEvent.click(screen.getByRole("button", { name: /Add a reference/ }));+ const picker = screen.getByRole("dialog", { name: "Add a reference" });+ fireEvent.click(within(picker).getByRole("button", { name: "Accessories" }));+ fireEvent.click(within(picker).getByRole("tab", { name: "Eyewear" }));+ fireEvent.change(within(picker).getByRole("textbox", { name: "Search reference options" }), { target: { value: "aviator" } });+ fireEvent.click(within(picker).getByRole("button", { name: /Aviator sunglasses/ }));+ expect(parseProjectConfig(state.latest()).references[0]).toMatchObject({ intendedUse: ["accessory"], subcategory: "Eyewear", name: "Aviator sunglasses", description: "Aviator sunglasses." });+ expect(screen.queryByRole("region", { name: "Clothing settings" })).not.toBeInTheDocument();+ });+it("creates locations directly and restores, updates, and clears their saved settings in the inspector", () => {const state = setup();fireEvent.click(screen.getByRole("button", { name: /Add a reference/ }));diff --git a/src/components/workspace/ReferencesView.tsx b/src/components/workspace/ReferencesView.tsxindex 1bba18b..35990c5 100644--- a/src/components/workspace/ReferencesView.tsx+++ b/src/components/workspace/ReferencesView.tsx@@ -5,6 +5,8 @@ import { isReferenceDescribed, projectItemPath, referenceImages, type ProjectConimport { activeReferenceRefmods, isVideoReference } from "../../lib/project";import {composeLocationPrompt,+ composeClothingPrompt,+ clothingSelectionFromPrompt,locationSelectionFromPrompt,REFERENCE_PRESETS,REFERENCE_TYPES,@@ -17,7 +19,7 @@ import {type PresetReferenceType,type ReferenceType,} from "../../lib/reference-presets";-import { LOCATION_SETTING_GROUPS } from "../../lib/expanded-reference-options";+import { CLOTHING_SETTING_GROUPS, LOCATION_SETTING_GROUPS } from "../../lib/expanded-reference-options";import { isTauri } from "../../lib/persistence";import { useShortcut } from "../../lib/commands";import { revealInExplorer } from "../../lib/nativeShell";@@ -131,6 +133,9 @@ export function ReferencesView({ config, folderPath, onChange, onRegenerateIcon,const selectedLocation = useMemo(() => selected && referenceType(selected) === "location"? locationSelectionFromPrompt(selected.description): undefined, [selected]);+ const selectedClothing = useMemo(() => selected && referenceType(selected) === "clothing"+ ? clothingSelectionFromPrompt(selected.description)+ : undefined, [selected]);const selectedPresetIcon = selectedImages.length === 0 && hasPresetIcon(selectedPreset) ? selectedPreset : undefined;const usedBy = (id: string | undefined) => config.generationJobs.filter((job) => job.referenceIds.includes(id ?? ""));const jobs = useMemo(() => usedBy(selectedId), [config.generationJobs, selectedId]);@@ -632,6 +637,22 @@ export function ReferencesView({ config, folderPath, onChange, onRegenerateIcon,</PropRow>)}</section></PropSection>}+ {selectedClothing && <PropSection title="Clothes" persistKey="references.clothing">+ <section className="reference-location-settings" aria-label="Clothing settings">+ {CLOTHING_SETTING_GROUPS.map((group) => <PropRow key={group.id} label={group.label}>+ <ComboBox+ aria-label={group.label}+ disabled={hasRefmods}+ value={selectedClothing.settings[group.id] ?? ""}+ options={[{ value: "", label: "None" }, ...group.options.map((option) => ({ value: option.id, label: option.label }))]}+ onChange={(value) => {+ const prompt = composeClothingPrompt(selectedClothing.preset, { ...selectedClothing.settings, [group.id]: value || undefined });+ update(selected.id, { description: prompt, content: prompt });+ }}+ />+ </PropRow>)}+ </section>+ </PropSection>}<PropSection title="Classification" persistKey="references.classification"><section className="reference-type" aria-label="Reference classification"><PropRow label="Category">diff --git a/src/lib/builtinIconWork.test.ts b/src/lib/builtinIconWork.test.tsindex 11c6971..6eff249 100644--- a/src/lib/builtinIconWork.test.ts+++ b/src/lib/builtinIconWork.test.ts@@ -94,7 +94,7 @@ it("regenerates existing icons on request and publishes only after the final frait("generates all built-ins in category order even when enqueued in reverse order", async () => {const { work, session } = setup();await work.cancel();- const categories = ["character", "animal", "product", "location", "style"] as const;+ const categories = ["character", "animal", "clothing", "accessory", "product", "location", "style"] as const;const reversed = [...categories].reverse().map((type) => ({ id: `ordered-${type}`, name: type, prompt: `A ${type}.`, type, subcategory: "Test" }));work.enqueueBuiltins(session, reversed);for (const type of categories) {diff --git a/src/lib/expanded-reference-options.ts b/src/lib/expanded-reference-options.tsindex 7847752..a2536cc 100644--- a/src/lib/expanded-reference-options.ts+++ b/src/lib/expanded-reference-options.ts@@ -27,6 +27,52 @@ export const PRODUCT_GROUPS: readonly OptionGroup[] = [{ subcategory: "Packaging", options: ["Shipping box", "Gift box", "Paper pouch", "Glass jar", "Metal tin", "Pump bottle", "Cardboard tube", "Takeaway cup", "Resealable bag", "Display carton"] },];+export const CLOTHING_GROUPS: readonly OptionGroup[] = [+ { subcategory: "Tops", options: ["T-shirt", "Polo shirt", "Button-up shirt", "Blouse", "Tank top", "Crop top", "Sweater", "Cardigan", "Hoodie", "Sweatshirt", "Turtleneck", "Vest"] },+ { subcategory: "Bottoms", options: ["Jeans", "Trousers", "Chinos", "Cargo pants", "Shorts", "Skirt", "Pleated skirt", "Leggings", "Joggers"] },+ { subcategory: "Dresses & one-pieces", options: ["Casual dress", "Sundress", "Maxi dress", "Cocktail dress", "Evening gown", "Wedding dress", "Jumpsuit", "Romper", "Overalls"] },+ { subcategory: "Outerwear", options: ["Jacket", "Bomber jacket", "Biker jacket", "Blazer", "Trench coat", "Overcoat", "Parka", "Puffer jacket", "Raincoat", "Windbreaker", "Poncho"] },+ { subcategory: "Suits & uniforms", options: ["Two-piece suit", "Three-piece suit", "Tuxedo", "School uniform", "Military uniform", "Police uniform", "Medical scrubs", "Chef's uniform", "Work coveralls"] },+ { subcategory: "Activewear & swimwear", options: ["Tracksuit", "Sports jersey", "Sports bra", "Running shorts", "Yoga pants", "Leotard", "One-piece swimsuit", "Bikini", "Swimming trunks", "Wetsuit"] },+ { subcategory: "Underwear & sleepwear", options: ["Pajamas", "Nightgown", "Bathrobe", "Undershirt", "Bra", "Briefs", "Boxer shorts", "Socks", "Tights"] },+ { subcategory: "Footwear", options: ["Sneakers", "Running shoes", "Dress shoes", "Loafers", "Ankle boots", "Knee-high boots", "Hiking boots", "Sandals", "High heels", "Ballet flats", "Slippers", "Flip-flops"] },+];++export const ACCESSORY_GROUPS: readonly OptionGroup[] = [+ { subcategory: "Eyewear", options: ["Glasses", "Reading glasses", "Round glasses", "Sunglasses", "Aviator sunglasses", "Cat-eye sunglasses", "Sports sunglasses", "Goggles"] },+ { subcategory: "Jewelry", options: ["Necklace", "Pendant necklace", "Choker", "Chain necklace", "Stud earrings", "Hoop earrings", "Drop earrings", "Ring", "Wedding ring", "Bracelet", "Bangle", "Anklet", "Brooch", "Cufflinks", "Wristwatch"] },+ { subcategory: "Headwear", options: ["Baseball cap", "Beanie", "Fedora", "Bucket hat", "Beret", "Sun hat", "Cowboy hat", "Visor", "Headscarf", "Hijab", "Turban"] },+ { subcategory: "Bags", options: ["Handbag", "Shoulder bag", "Crossbody bag", "Tote bag", "Backpack", "Clutch bag", "Waist bag", "Messenger bag", "Briefcase", "Wallet"] },+ { subcategory: "Belts & neckwear", options: ["Belt", "Suspenders", "Necktie", "Bow tie", "Scarf", "Bandana", "Shawl", "Pocket square"] },+ { subcategory: "Hair accessories", options: ["Headband", "Hair clip", "Barrette", "Scrunchie", "Hair tie", "Hair ribbon", "Hairpin", "Tiara"] },+ { subcategory: "Other accessories", options: ["Gloves", "Mittens", "Earmuffs", "Headphones", "Earbuds", "Umbrella", "Walking cane", "Pocket watch"] },+];++export interface ClothingSettingGroup {+ id: "color" | "fabric";+ label: string;+ options: ReadonlyArray<{ id: string; label: string; prompt: string }>;+}++export const CLOTHING_SETTING_GROUPS: readonly ClothingSettingGroup[] = [+ { id: "color", label: "Color", options: [+ ["black", "Black"], ["white", "White"], ["gray", "Gray"], ["charcoal", "Charcoal"],+ ["cream", "Cream"], ["beige", "Beige"], ["tan", "Tan"], ["brown", "Brown"],+ ["red", "Red"], ["burgundy", "Burgundy"], ["orange", "Orange"], ["yellow", "Yellow"],+ ["mustard", "Mustard"], ["green", "Green"], ["olive", "Olive"], ["teal", "Teal"],+ ["blue", "Blue"], ["navy-blue", "Navy blue"], ["light-blue", "Light blue"],+ ["purple", "Purple"], ["lavender", "Lavender"], ["pink", "Pink"], ["gold", "Gold"], ["silver", "Silver"],+ ].map(([id, label]) => ({ id, label, prompt: `in ${label.toLowerCase()}` })) },+ { id: "fabric", label: "Fabric", options: [+ ["cotton", "Cotton"], ["linen", "Linen"], ["denim", "Denim"], ["wool", "Wool"],+ ["cashmere", "Cashmere"], ["silk", "Silk"], ["satin", "Satin"], ["velvet", "Velvet"],+ ["corduroy", "Corduroy"], ["tweed", "Tweed"], ["fleece", "Fleece"], ["jersey", "Jersey"],+ ["chiffon", "Chiffon"], ["lace", "Lace"], ["tulle", "Tulle"], ["canvas", "Canvas"],+ ["polyester", "Polyester"], ["nylon", "Nylon"], ["spandex", "Spandex"],+ ["leather", "Leather"], ["faux-leather", "Faux leather"], ["suede", "Suede"],+ ].map(([id, label]) => ({ id, label, prompt: `made of ${label.toLowerCase()}` })) },+];+export const LOCATION_GROUPS: readonly OptionGroup[] = [{ subcategory: "Urban", options: ["City alley", "Downtown avenue", "Rooftop", "Subway platform", "Street market", "City square", "Parking garage", "Pedestrian bridge", "Apartment street", "Train station"] },{ subcategory: "Interiors", options: ["Hotel lobby", "Modern kitchen", "Artist studio", "Library", "Corner café", "Penthouse", "Warehouse loft", "Recording studio", "Museum gallery", "Home office"] },diff --git a/src/lib/project.ts b/src/lib/project.tsindex 94fd83e..82bdeff 100644--- a/src/lib/project.ts+++ b/src/lib/project.ts@@ -332,7 +332,7 @@ export const projectReferenceSchema = z.object({durationSeconds: z.number().finite().min(2).max(15),includeAudio: z.boolean(),}).optional(),- intendedUse: z.array(z.enum(["character", "animal", "product", "location", "style", "audio"])).default([]),+ intendedUse: z.array(z.enum(["character", "animal", "clothing", "accessory", "product", "location", "style", "audio"])).default([]),subcategory: z.string().optional(),// Generated library artwork is not an image conditioning attachment.iconRelativePath: projectRelativePathSchema.optional(),diff --git a/src/lib/reference-presets.test.ts b/src/lib/reference-presets.test.tsindex b538758..c0033bb 100644--- a/src/lib/reference-presets.test.ts+++ b/src/lib/reference-presets.test.ts@@ -1,11 +1,38 @@import { describe, expect, it } from "vitest";import { KNOWN_CHARACTERS } from "./known-characters";-import { LOCATION_GROUPS } from "./expanded-reference-options";-import { composeLocationPrompt, hasPresetIcon, locationSelectionFromPrompt, REFERENCE_PRESETS, type PresetReferenceType } from "./reference-presets";+import { CLOTHING_SETTING_GROUPS, LOCATION_GROUPS } from "./expanded-reference-options";+import { clothingSelectionFromPrompt, composeClothingPrompt, composeLocationPrompt, hasPresetIcon, locationSelectionFromPrompt, REFERENCE_PRESETS, selectedReferencePreset, type PresetReferenceType } from "./reference-presets";-const TYPES: PresetReferenceType[] = ["animal", "character", "product", "location", "style"];+const TYPES: PresetReferenceType[] = ["animal", "character", "clothing", "accessory", "product", "location", "style"];describe("reference preset catalog", () => {+ it("offers common clothing and accessories without multiplying items by color or fabric", () => {+ const clothes = REFERENCE_PRESETS.filter((preset) => preset.type === "clothing");+ const accessories = REFERENCE_PRESETS.filter((preset) => preset.type === "accessory");+ expect(clothes.map((preset) => preset.name)).toEqual(expect.arrayContaining(["T-shirt", "Jeans", "Casual dress", "Jacket", "Two-piece suit", "Sneakers"]));+ expect(accessories.map((preset) => preset.name)).toEqual(expect.arrayContaining(["Glasses", "Sunglasses", "Necklace", "Ring", "Wristwatch", "Handbag"]));+ for (const presets of [clothes, accessories]) {+ expect(new Set(presets.map((preset) => preset.name)).size).toBe(presets.length);+ expect(presets.every((preset) => preset.prompt === `${preset.name}.`)).toBe(true);+ }+ });++ it("restores clothing colors and fabrics from saved prompts and keeps the base preset for icons", () => {+ const shirt = REFERENCE_PRESETS.find((preset) => preset.type === "clothing" && preset.name === "T-shirt")!;+ expect(composeClothingPrompt(shirt, { color: "navy-blue", fabric: "cotton" })).toBe("T-shirt, in navy blue, made of cotton.");+ for (const group of CLOTHING_SETTING_GROUPS) {+ for (const option of group.options) {+ const settings = { [group.id]: option.id };+ expect(clothingSelectionFromPrompt(composeClothingPrompt(shirt, settings))).toEqual({ preset: shirt, settings });+ }+ }+ const prompt = composeClothingPrompt(shirt, { color: "navy-blue", fabric: "cotton" });+ expect(clothingSelectionFromPrompt(prompt)?.settings).toEqual({ color: "navy-blue", fabric: "cotton" });+ expect(selectedReferencePreset({ id: "shirt", name: "My shirt", kind: "text", description: prompt, intendedUse: ["clothing"], createdAt: "2026-10-03T12:00:00Z" })).toEqual(shirt);+ expect(composeClothingPrompt(shirt, {})).toBe("T-shirt.");+ expect(clothingSelectionFromPrompt("T-shirt, with a hand-painted logo.")).toBeUndefined();+ expect(clothingSelectionFromPrompt("T-shirt, in red, in blue.")).toBeUndefined();+ });it("includes distinct animal presets with ready-to-use descriptions", () => {const animals = REFERENCE_PRESETS.filter((preset) => preset.type === "animal");expect(animals).toHaveLength(80);diff --git a/src/lib/reference-presets.ts b/src/lib/reference-presets.tsindex 6505c8b..6bebc51 100644--- a/src/lib/reference-presets.ts+++ b/src/lib/reference-presets.ts@@ -1,9 +1,9 @@import { KNOWN_CHARACTERS } from "./known-characters";-import { ANIMAL_GROUPS, LOCATION_GROUPS, LOCATION_SETTING_GROUPS, PRODUCT_GROUPS, STYLE_GROUPS, type OptionGroup } from "./expanded-reference-options";+import { ACCESSORY_GROUPS, ANIMAL_GROUPS, CLOTHING_GROUPS, CLOTHING_SETTING_GROUPS, LOCATION_GROUPS, LOCATION_SETTING_GROUPS, PRODUCT_GROUPS, STYLE_GROUPS, type OptionGroup } from "./expanded-reference-options";import type { ProjectReference } from "./project";import { hasBuiltinIcon } from "./builtinReferenceIcons";-export type ReferenceType = "custom" | "character" | "animal" | "product" | "location" | "style";+export type ReferenceType = "custom" | "character" | "animal" | "clothing" | "accessory" | "product" | "location" | "style";export type PresetReferenceType = Exclude<ReferenceType, "custom">;export interface ReferencePreset {@@ -34,6 +34,8 @@ export const hasPresetIcon = (preset: ReferencePreset | undefined): boolean => Bexport const REFERENCE_TYPES: ReadonlyArray<{ id: PresetReferenceType; label: string }> = [{ id: "character", label: "Character" },{ id: "animal", label: "Animal" },+ { id: "clothing", label: "Clothes" },+ { id: "accessory", label: "Accessories" },{ id: "product", label: "Product" },{ id: "location", label: "Location" },{ id: "style", label: "Style" },@@ -100,19 +102,24 @@ const optionsAsPresets = (type: PresetReferenceType, groups: readonly OptionGrou})));const animalPresets = optionsAsPresets("animal", ANIMAL_GROUPS).map(withIcon);+const clothingPresets = optionsAsPresets("clothing", CLOTHING_GROUPS).map(withIcon);+const accessoryPresets = optionsAsPresets("accessory", ACCESSORY_GROUPS).map(withIcon);const productPresets = optionsAsPresets("product", PRODUCT_GROUPS).map(withIcon);const locationPresets = optionsAsPresets("location", LOCATION_GROUPS).map(withIcon);const stylePresets = optionsAsPresets("style", STYLE_GROUPS).map(withIcon);export type LocationSettings = Partial<Record<(typeof LOCATION_SETTING_GROUPS)[number]["id"], string>>;+export type ClothingSettings = Partial<Record<(typeof CLOTHING_SETTING_GROUPS)[number]["id"], string>>;export interface LocationSelection {preset: ReferencePreset;settings: LocationSettings;}-export function composeLocationPrompt(preset: ReferencePreset, settings: LocationSettings): string {- const qualifiers = LOCATION_SETTING_GROUPS.flatMap((group) => {+type SettingGroup<K extends string> = { id: K; options: ReadonlyArray<{ id: string; prompt: string }> };++function composePresetPrompt<K extends string>(preset: ReferencePreset, settings: Partial<Record<K, string>>, groups: readonly SettingGroup<K>[]): string {+ const qualifiers = groups.flatMap((group) => {const option = group.options.find((candidate) => candidate.id === settings[group.id]);return option ? [option.prompt] : [];});@@ -121,27 +128,36 @@ export function composeLocationPrompt(preset: ReferencePreset, settings: Locatio/** Recovers picker state from its prompt, avoiding UI-only fields in portable* project JSON. Only a prompt this picker itself can compose is recognized. */-export function locationSelectionFromPrompt(prompt: string): LocationSelection | undefined {- for (const preset of [...locationPresets].sort((left, right) => right.name.length - left.name.length)) {+function selectionFromPrompt<K extends string>(prompt: string, presets: ReferencePreset[], groups: readonly SettingGroup<K>[]): { preset: ReferencePreset; settings: Partial<Record<K, string>> } | undefined {+ for (const preset of [...presets].sort((left, right) => right.name.length - left.name.length)) {const base = preset.name;if (prompt === `${base}.`) return { preset, settings: {} };if (!prompt.startsWith(`${base}, `) || !prompt.endsWith(".")) continue;const qualifiers = prompt.slice(base.length + 2, -1).split(", ");- const settings: LocationSettings = {};+ const settings: Partial<Record<K, string>> = {};let lastGroup = -1;let valid = true;for (const qualifier of qualifiers) {- const groupIndex = LOCATION_SETTING_GROUPS.findIndex((group) => group.options.some((option) => option.prompt === qualifier));- const option = groupIndex >= 0 ? LOCATION_SETTING_GROUPS[groupIndex].options.find((candidate) => candidate.prompt === qualifier) : undefined;+ const groupIndex = groups.findIndex((group) => group.options.some((option) => option.prompt === qualifier));+ const option = groupIndex >= 0 ? groups[groupIndex].options.find((candidate) => candidate.prompt === qualifier) : undefined;if (!option || groupIndex <= lastGroup) { valid = false; break; }- settings[LOCATION_SETTING_GROUPS[groupIndex].id] = option.id;+ settings[groups[groupIndex].id] = option.id;lastGroup = groupIndex;}- if (valid && composeLocationPrompt(preset, settings) === prompt) return { preset, settings };+ if (valid && composePresetPrompt(preset, settings, groups) === prompt) return { preset, settings };}return undefined;}+export const composeLocationPrompt = (preset: ReferencePreset, settings: LocationSettings): string =>+ composePresetPrompt(preset, settings, LOCATION_SETTING_GROUPS);+export const locationSelectionFromPrompt = (prompt: string): LocationSelection | undefined =>+ selectionFromPrompt(prompt, locationPresets, LOCATION_SETTING_GROUPS);+export const composeClothingPrompt = (preset: ReferencePreset, settings: ClothingSettings): string =>+ composePresetPrompt(preset, settings, CLOTHING_SETTING_GROUPS);+export const clothingSelectionFromPrompt = (prompt: string) =>+ selectionFromPrompt(prompt, clothingPresets, CLOTHING_SETTING_GROUPS);+const curatedCharacterPresets: ReferencePreset[] = ([{ id: "character-alice", type: "character", subcategory: "Literature & legend", name: "Alice in Wonderland", prompt: "Alice in her blue dress and white apron." },{ id: "character-dracula", type: "character", subcategory: "Literature & legend", name: "Count Dracula", prompt: "Count Dracula in formal black evening wear." },@@ -155,6 +171,8 @@ const curatedCharacterPresets: ReferencePreset[] = ([export const REFERENCE_PRESETS: readonly ReferencePreset[] = [...knownCharacterPresets,...animalPresets,+ ...clothingPresets,+ ...accessoryPresets,...productPresets,...locationPresets,...stylePresets,@@ -164,7 +182,8 @@ export const REFERENCE_PRESETS: readonly ReferencePreset[] = [const presetForReference = (reference: ProjectReference): ReferencePreset | undefined => {const intended = reference.intendedUse.length === 1 ? reference.intendedUse[0] : undefined;return REFERENCE_PRESETS.find((preset) => preset.type === intended && preset.prompt === reference.description)- ?? (intended === "location" ? locationSelectionFromPrompt(reference.description)?.preset : undefined);+ ?? (intended === "location" ? locationSelectionFromPrompt(reference.description)?.preset : undefined)+ ?? (intended === "clothing" ? clothingSelectionFromPrompt(reference.description)?.preset : undefined);};export function referenceType(reference: ProjectReference): ReferenceType {diff --git a/src/lib/referenceIconWork.test.ts b/src/lib/referenceIconWork.test.tsindex 8895be3..7f58a1e 100644--- a/src/lib/referenceIconWork.test.ts+++ b/src/lib/referenceIconWork.test.ts@@ -3,7 +3,7 @@ import { listen } from "@tauri-apps/api/event";import { afterEach, beforeEach, expect, it, vi } from "vitest";import { releaseRendered, saveGeneratedScene } from "./generatedVideo";import { createProjectConfig, parseProjectConfig, referenceImages, type ProjectRecord, type ProjectReference } from "./project";-import { REFERENCE_PRESETS } from "./reference-presets";+import { REFERENCE_PRESETS, REFERENCE_TYPES, type PresetReferenceType } from "./reference-presets";import { referenceIconPrompt } from "./referenceIcons";import { loadReferenceIconAutomation, saveReferenceIconAutomation, saveReferenceIconGeneratorId } from "./referenceIconSettings";import { createGeneratorTemplate, loadGeneratorTemplateSettings, saveGeneratorTemplateSettings } from "./settings";@@ -17,7 +17,7 @@ vi.mock("./timelineThumbnails", () => ({ purgeTimelineThumbnails: vi.fn(async ()vi.mock("./runtime", () => ({ enqueueSlopfabGeneration: vi.fn(), resolveSlopfabPlan: vi.fn(), cancelSlopfabGeneration: vi.fn(), saveReferenceIcon: vi.fn() }));const handlers = new Map<string, (event: { payload: any }) => void>();let stop: () => void;-const reference = (id: string, type: "character" | "animal" | "product" | "location" | "style" = "character"): ProjectReference => ({+const reference = (id: string, type: PresetReferenceType = "character"): ProjectReference => ({id, kind: "text", name: id, description: `User description for ${id}.`, intendedUse: [type], createdAt: "2026-09-07T00:00:00.000Z",});const project = (name: string, references: ProjectReference[] = []): ProjectRecord => ({ folderPath: `C:/${name}`, config: {@@ -322,8 +322,8 @@ it("continues after a failed icon and retries persistence without generating aga});it("uses a distinct composition for every reference type and preserves the user's prompt", () => {- const prompts = ["character", "animal", "product", "location", "style"].map((type) => referenceIconPrompt(reference("example", type as "character")));- expect(new Set(prompts).size).toBe(5);+ const prompts = REFERENCE_TYPES.map(({ id }) => referenceIconPrompt(reference("example", id)));+ expect(new Set(prompts).size).toBe(REFERENCE_TYPES.length);for (const prompt of prompts) expect(prompt).toContain("User description for example.");});diff --git a/src/lib/referenceIcons.ts b/src/lib/referenceIcons.tsindex d3d7b08..e06e24f 100644--- a/src/lib/referenceIcons.ts+++ b/src/lib/referenceIcons.ts@@ -8,6 +8,8 @@ export const REFERENCE_ICON_STEPS = 20;const COMPOSITIONS = {character: "A clear head-and-shoulders character portrait. Emphasize recognizable facial features, hair, clothing, and personality against a simple background.",animal: "A clear portrait of the animal with its whole body visible. Emphasize species-accurate anatomy, distinctive markings, fur, feathers, or scales and a recognizable silhouette against a simple natural background.",+ clothing: "A clear view of the complete clothing item against a simple background. Emphasize its silhouette, cut, color, fabric texture, seams, and defining details.",+ accessory: "A clear close view of the complete wearable accessory against a simple background. Emphasize its shape, materials, finish, and defining details.",product: "A clean hero view of the product. Show its complete silhouette, materials, colors, and defining details with controlled lighting and an uncluttered background.",location: "An establishing view of the location. Show its defining architecture or landscape, atmosphere, lighting, and spatial character in a readable composition.",style: "A representative scene demonstrating the visual style. Make its palette, medium, textures, lighting, and composition immediately recognizable.",