Skip to content

AI media harness for planning, generating, and editing locally

TypeScript

Add animal reference presets

Bittid4c75b497196
diff --git a/scripts/generate-reference-icons.mjs b/scripts/generate-reference-icons.mjs
index 95804c3..02facfe 100644
--- a/scripts/generate-reference-icons.mjs
+++ b/scripts/generate-reference-icons.mjs
@@ -138,6 +138,7 @@ function stylePrompt(entry) {
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`,
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),
@@ -208,10 +209,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", "product", "location", "style"].includes(entry.type)) throw new Error(`Reference icon '${entry.id}' has unsupported type '${entry.type}'.`);
+ if (!["character", "animal", "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", "product", "location", "style"].includes(requestedType)) {
+if (requestedType && !["character", "animal", "product", "location", "style"].includes(requestedType)) {
throw new Error(`Unsupported reference icon type '${requestedType}'.`);
}
let entries = requestedId
diff --git a/scripts/reference-icon-catalog.ts b/scripts/reference-icon-catalog.ts
index 9674cae..f4412e0 100644
--- a/scripts/reference-icon-catalog.ts
+++ b/scripts/reference-icon-catalog.ts
@@ -12,7 +12,6 @@ const knownSubjects = new Map(KNOWN_CHARACTERS.map(([name, actor, franchise], in
]));
const catalog = REFERENCE_PRESETS
- .filter((preset) => preset.type === "character" || preset.type === "product" || preset.type === "location" || preset.type === "style")
.map((preset) => ({
id: preset.id,
type: preset.type,
diff --git a/src-tauri/src/agent.rs b/src-tauri/src/agent.rs
index 95883f7..af58a98 100644
--- a/src-tauri/src/agent.rs
+++ b/src-tauri/src/agent.rs
@@ -37,7 +37,7 @@ For a response that makes no edit, return exactly one JSON object: {"kind":"answ
For 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"|"product"|"location"|"style"|"audio",...]}
+- {"op":"ref.add","id":string,"name":string,"text":string,"use":["character"|"animal"|"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}
@@ -70,7 +70,7 @@ Example:
When creating or rewriting scenes, plan reusable visual references before writing the shots:
- Inventory every recurring visible character, location, product, important prop, vehicle, creature, or other identity whose look must remain consistent. Reuse a matching project reference when one already exists; otherwise add a top-level text reference before adding the scenes.
-- A new ref.add command uses a unique stable id, a clear name, complete text when the user supplied enough detail, and the appropriate use value (such as "character", "location", or "product"). Slopus creates it as a text reference and supplies its timestamp. Commands cannot invent paths or image entries; only existing project JSON may describe real files.
+- A new ref.add command uses a unique stable id, a clear name, complete text when the user supplied enough detail, and the appropriate use value (such as "character", "animal", "location", or "product"). Slopus creates it as a text reference and supplies its timestamp. Commands cannot invent paths or image entries; only existing project JSON may describe real files.
- A character reference must establish the character's stable identity in enough physical detail to reproduce them: apparent age, build, face, hair, distinguishing features, clothing, footwear, accessories, and the colours/materials of the outfit when relevant. Keep momentary action, pose, expression, and camera direction in the shot instead.
- A location reference establishes persistent architecture, layout, materials, palette, fixtures, and lighting anchors. A product or prop reference establishes persistent shape, proportions, materials, colours, markings, and branding supplied by the user. Do not fabricate brand details.
- Every shot that visibly contains one of these subjects must cite the same reference in its action with the exact token @[ref:<reference-id>]. Slopus derives the scene's referenceIds from these tokens. Reuse the same id across shots and scenes; do not re-describe or rename the subject independently in each shot.
@@ -396,7 +396,7 @@ pub(crate) fn validate_agent_scene_conventions(
}
if reference.intended_use.is_empty() {
return Err(format!(
- "Agent-created reference '{}' needs an intendedUse such as character, location, or product.",
+ "Agent-created reference '{}' needs an intendedUse such as character, animal, location, or product.",
reference.id
));
}
@@ -512,7 +512,7 @@ pub(crate) fn validate_agent_scene_conventions(
&& reference
.intended_use
.iter()
- .any(|usage| matches!(usage.as_str(), "character" | "location" | "product"))
+ .any(|usage| matches!(usage.as_str(), "character" | "animal" | "location" | "product"))
}) {
if !cited_new_references.contains(reference.id.as_str()) {
return Err(format!(
diff --git a/src-tauri/src/lib.rs b/src-tauri/src/lib.rs
index 9833839..fc66d95 100644
--- a/src-tauri/src/lib.rs
+++ b/src-tauri/src/lib.rs
@@ -869,7 +869,7 @@ fn validate_and_normalize_config(mut config: ProjectConfig) -> Result<ProjectCon
for intent in &reference.intended_use {
if !matches!(
intent.as_str(),
- "character" | "product" | "location" | "style" | "audio"
+ "character" | "animal" | "product" | "location" | "style" | "audio"
) {
return Err(format!("Unsupported reference intended use '{intent}'."));
}
@@ -3571,6 +3571,7 @@ mod tests {
let root = tempfile::tempdir().unwrap();
for (category, subcategory) in [
("character", "Animation"),
+ ("animal", "Pets"),
("product", "Technology"),
("location", "Urban"),
("style", "Cinematic"),
@@ -4738,7 +4739,7 @@ mod tests {
"rejected valid clip status {status}"
);
}
- for intent in ["character", "product", "location", "style", "audio"] {
+ for intent in ["character", "animal", "product", "location", "style", "audio"] {
let mut config = fixture();
config.references[0].intended_use = vec![intent.into()];
assert!(
diff --git a/src/components/workspace/ReferencesView.test.tsx b/src/components/workspace/ReferencesView.test.tsx
index c1fdc2c..cac6e49 100644
--- a/src/components/workspace/ReferencesView.test.tsx
+++ b/src/components/workspace/ReferencesView.test.tsx
@@ -50,8 +50,22 @@ function setup(initial = project()) {
}
describe("Reference type presets", () => {
+ it("adds an animal preset from its searchable subcategory", () => {
+ const state = setup();
+ fireEvent.click(screen.getByRole("button", { name: /Add a reference/ }));
+ const dialog = screen.getByRole("dialog", { name: "Add a reference" });
+ fireEvent.click(within(dialog).getByRole("button", { name: "Animal" }));
+ fireEvent.click(within(dialog).getByRole("button", { name: "Pets" }));
+ fireEvent.change(within(dialog).getByRole("textbox", { name: "Search reference options" }), { target: { value: "retriever" } });
+ fireEvent.click(within(dialog).getByRole("button", { name: /Golden retriever/ }));
+ expect(state.latest().references[0]).toMatchObject({ name: "Golden retriever", intendedUse: ["animal"], subcategory: "Pets", description: "Golden retriever." });
+ expect(screen.getByRole("combobox", { name: "Category" })).toHaveValue("animal");
+ expect(screen.getByRole("textbox", { name: "Prompt" })).toHaveValue("Golden retriever.");
+ });
+
it.each([
["Character", "character", "Animation"],
+ ["Animal", "animal", "Pets"],
["Product", "product", "Technology"],
["Location", "location", "Urban"],
["Style", "style", "Cinematic"],
diff --git a/src/lib/expanded-reference-options.ts b/src/lib/expanded-reference-options.ts
index 9ef735d..7847752 100644
--- a/src/lib/expanded-reference-options.ts
+++ b/src/lib/expanded-reference-options.ts
@@ -3,6 +3,17 @@ export interface OptionGroup {
options: readonly string[];
}
+export const ANIMAL_GROUPS: readonly OptionGroup[] = [
+ { subcategory: "Pets", options: ["Golden retriever", "German shepherd", "Border collie", "Siberian husky", "Tabby cat", "Siamese cat", "Maine coon cat", "Rabbit", "Guinea pig", "Hamster"] },
+ { subcategory: "Farm animals", options: ["Horse", "Pony", "Donkey", "Cow", "Sheep", "Goat", "Pig", "Alpaca", "Llama", "Chicken"] },
+ { subcategory: "Wild mammals", options: ["Lion", "Bengal tiger", "African elephant", "Giraffe", "Zebra", "Gorilla", "Chimpanzee", "Giant panda", "Kangaroo", "Hippopotamus"] },
+ { subcategory: "Forest & Arctic", options: ["Red fox", "Gray wolf", "Brown bear", "Polar bear", "Arctic fox", "Moose", "Reindeer", "Red deer", "Red squirrel", "Hedgehog"] },
+ { subcategory: "Birds", options: ["Bald eagle", "Barn owl", "Peregrine falcon", "Scarlet macaw", "Peacock", "Flamingo", "Toucan", "Hummingbird", "Emperor penguin", "Mute swan"] },
+ { subcategory: "Reptiles & amphibians", options: ["Green iguana", "Chameleon", "Gecko", "Bearded dragon", "King cobra", "Ball python", "Nile crocodile", "Giant tortoise", "Red-eyed tree frog", "Axolotl"] },
+ { subcategory: "Marine life", options: ["Bottlenose dolphin", "Humpback whale", "Orca", "Harbor seal", "Sea otter", "Green sea turtle", "Great white shark", "Manta ray", "Clownfish", "Seahorse"] },
+ { subcategory: "Invertebrates", options: ["Monarch butterfly", "Honeybee", "Ladybug", "Dragonfly", "Praying mantis", "Tarantula", "Octopus", "Moon jellyfish", "Hermit crab", "Starfish"] },
+];
+
export const PRODUCT_GROUPS: readonly OptionGroup[] = [
{ subcategory: "Technology", options: ["Smartphone", "Laptop", "Tablet", "Smartwatch", "Wireless earbuds", "Camera", "Gaming console", "Desktop computer", "Smart speaker", "VR headset"] },
{ subcategory: "Fashion", options: ["Wristwatch", "Sneaker", "Handbag", "Sunglasses", "Jacket", "Dress", "Backpack", "Boot", "Wallet", "Headphones"] },
diff --git a/src/lib/project.ts b/src/lib/project.ts
index 86409f9..14f64de 100644
--- a/src/lib/project.ts
+++ b/src/lib/project.ts
@@ -265,7 +265,7 @@ export const projectReferenceSchema = z.object({
// written definition can carry any number of images, and an image-only
// reference is simply a definition whose description is still blank.
images: z.array(projectReferenceImageSchema).optional(),
- intendedUse: z.array(z.enum(["character", "product", "location", "style", "audio"])).default([]),
+ intendedUse: z.array(z.enum(["character", "animal", "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.ts
index 3161eb4..c021281 100644
--- a/src/lib/reference-presets.test.ts
+++ b/src/lib/reference-presets.test.ts
@@ -3,9 +3,17 @@ import { KNOWN_CHARACTERS } from "./known-characters";
import { LOCATION_GROUPS } from "./expanded-reference-options";
import { composeLocationPrompt, locationSelectionFromPrompt, REFERENCE_PRESETS, type PresetReferenceType } from "./reference-presets";
-const TYPES: PresetReferenceType[] = ["character", "product", "location", "style"];
+const TYPES: PresetReferenceType[] = ["animal", "character", "product", "location", "style"];
describe("reference preset catalog", () => {
+ it("includes distinct animal presets with ready-to-use descriptions", () => {
+ const animals = REFERENCE_PRESETS.filter((preset) => preset.type === "animal");
+ expect(animals).toHaveLength(80);
+ expect(new Set(animals.map((preset) => preset.name)).size).toBe(80);
+ expect(animals.map((preset) => preset.name)).toEqual(expect.arrayContaining(["Golden retriever", "Bengal tiger", "Emperor penguin", "Octopus"]));
+ expect(animals.every((preset) => preset.prompt === `${preset.name}.`)).toBe(true);
+ });
+
it("tracks the upstream known-good characters and keeps the other catalogs unique", () => {
expect(KNOWN_CHARACTERS).toHaveLength(503);
expect(KNOWN_CHARACTERS).toContainEqual(["Ariana Grande", "Ariana Grande", "Real Person / Celebrity"]);
@@ -31,7 +39,7 @@ describe("reference preset catalog", () => {
expect(Math.max(...REFERENCE_PRESETS.map((preset) => preset.prompt.length))).toBeLessThanOrEqual(100);
});
- it("bundles an icon for every concrete visual preset without treating it as a generation reference", () => {
+ it("bundles icons for the existing character, product, location and style presets without treating it as a generation reference", () => {
const visual = REFERENCE_PRESETS.filter((preset) => preset.type === "character" || preset.type === "product" || preset.type === "location" || preset.type === "style");
expect(visual).toHaveLength(810);
expect(visual.every((preset) => typeof preset.icon === "string" && preset.icon.length > 0)).toBe(true);
diff --git a/src/lib/reference-presets.ts b/src/lib/reference-presets.ts
index ee1e97a..b31bd84 100644
--- a/src/lib/reference-presets.ts
+++ b/src/lib/reference-presets.ts
@@ -1,8 +1,8 @@
import { KNOWN_CHARACTERS } from "./known-characters";
-import { LOCATION_GROUPS, LOCATION_SETTING_GROUPS, PRODUCT_GROUPS, STYLE_GROUPS, type OptionGroup } from "./expanded-reference-options";
+import { ANIMAL_GROUPS, LOCATION_GROUPS, LOCATION_SETTING_GROUPS, PRODUCT_GROUPS, STYLE_GROUPS, type OptionGroup } from "./expanded-reference-options";
import type { ProjectReference } from "./project";
-export type ReferenceType = "custom" | "character" | "product" | "location" | "style";
+export type ReferenceType = "custom" | "character" | "animal" | "product" | "location" | "style";
export type PresetReferenceType = Exclude<ReferenceType, "custom">;
export interface ReferencePreset {
@@ -30,6 +30,7 @@ const withIcon = (preset: ReferencePreset): ReferencePreset => ({ ...preset, ico
export const REFERENCE_TYPES: ReadonlyArray<{ id: PresetReferenceType; label: string }> = [
{ id: "character", label: "Character" },
+ { id: "animal", label: "Animal" },
{ id: "product", label: "Product" },
{ id: "location", label: "Location" },
{ id: "style", label: "Style" },
@@ -95,6 +96,7 @@ const optionsAsPresets = (type: PresetReferenceType, groups: readonly OptionGrou
prompt: `${option}.`,
})));
+const animalPresets = optionsAsPresets("animal", ANIMAL_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);
@@ -149,6 +151,7 @@ const curatedCharacterPresets: ReferencePreset[] = ([
export const REFERENCE_PRESETS: readonly ReferencePreset[] = [
...knownCharacterPresets,
+ ...animalPresets,
...productPresets,
...locationPresets,
...stylePresets,
diff --git a/src/lib/referenceIconWork.test.ts b/src/lib/referenceIconWork.test.ts
index 00e5ae2..bc70abc 100644
--- a/src/lib/referenceIconWork.test.ts
+++ b/src/lib/referenceIconWork.test.ts
@@ -14,7 +14,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" | "product" | "location" | "style" = "character"): ProjectReference => ({
+const reference = (id: string, type: "character" | "animal" | "product" | "location" | "style" = "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: {
@@ -171,7 +171,7 @@ 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", "product", "location", "style"].map((type) => referenceIconPrompt(reference("example", type as "character")));
- expect(new Set(prompts).size).toBe(4);
+ const prompts = ["character", "animal", "product", "location", "style"].map((type) => referenceIconPrompt(reference("example", type as "character")));
+ expect(new Set(prompts).size).toBe(5);
for (const prompt of prompts) expect(prompt).toContain("User description for example.");
});
diff --git a/src/lib/referenceIcons.ts b/src/lib/referenceIcons.ts
index c4e8858..0d11e3b 100644
--- a/src/lib/referenceIcons.ts
+++ b/src/lib/referenceIcons.ts
@@ -6,6 +6,7 @@ export const REFERENCE_ICON_STEPS = 30;
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.",
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.",