AI media harness for planning, generating, and editing locally
TypeScript
Unify video and image workspaces
Bitti7dcab8c26051
diff --git a/RELEASE_NOTES.md b/RELEASE_NOTES.mdindex afca6af..cd73342 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+- Every project now includes Video and Image tabs. Older video and image projects keep their saved content, and Export supports both output types.- 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.diff --git a/docs/architecture.md b/docs/architecture.mdindex 898434d..ceb9d2d 100644--- a/docs/architecture.md+++ b/docs/architecture.md@@ -21,7 +21,7 @@ project-folder/The JSON document is versioned and includes project metadata, canvas settings, ordered timeline tracks and clips, reusable references, generation jobs, agent conversation, and provider settings. Runtime-only state never belongs in the file.-The top-level `generationType` identifies the project's purpose independently of its media assets. Its values are `video`, `image`, `3d`, `music`, and `speech`. New projects currently write `"generationType": "video"`; the other values are reserved for future generation workflows and do not enable those workflows yet. Both the frontend and native storage preserve this field when reading and saving. Schema version 1 files without it default to `video` and gain the explicit field on their next save. Explicit null or unrecognized values are rejected.+Every project provides Timeline, Video, Image, References, and Export tabs. Video scenes and the image composition coexist in one file, and Export offers both media types. The top-level `generationType` is a legacy preference retained for compatibility: older image projects initially open the Image tab; other projects open Timeline. New projects write `"generationType": "video"`, but this does not restrict image editing or generation. Both frontend and native storage preserve the field and its historical values (`video`, `image`, `3d`, `music`, `speech`). Schema version 1 files without it default to `video` and gain the explicit field on their next save. Explicit null or unrecognized values are rejected. Agent requests use the active Video/Image context to select instructions without changing the saved preference.## Agent boundarydiff --git a/src-tauri/assets/agent-image.md b/src-tauri/assets/agent-image.mdindex ee40e9d..5683489 100644--- a/src-tauri/assets/agent-image.md+++ b/src-tauri/assets/agent-image.md@@ -19,7 +19,7 @@ Example: add a grouped title, then refine its typography without replacing other{"op":"image.node.set","id":"headline-text","colors":["#FF0000"],"description":"Bold red condensed lettering with subtle shadow"}{"op":"commit","summary":"Added a grouped red headline."}-Use the actual root ID in the current document; image-root is the default. Commands apply transactionally: a missing target, cycle, invalid placement, duplicate ID, or invalid setting rejects the whole batch. Generated images, assets, outputAssetId, file paths and provider settings cannot be edited with these commands. There are no generation commands: the user controls Generate in the Editor.+Use the actual root ID in the current document; image-root is the default. Commands apply transactionally: a missing target, cycle, invalid placement, duplicate ID, or invalid setting rejects the whole batch. Generated images, assets, outputAssetId, file paths and provider settings cannot be edited with these commands. There are no generation commands: the user controls Generate in the Image tab.For an explicitly requested complete composition replacement, the older full-authoring command remains available:{"op":"image.set","nodes":[...],"background":"environment description","style":{"mode":"photo","aesthetics":"","lighting":"","medium":"","detail":"camera/lens or art style"},"steps":20,"seed":-1,"referenceIds":[]}@@ -29,4 +29,4 @@ All fields are required; copy unchanged authored fields from imageScene in the cUse exactly one root with parentId null. Other nodes have kind group, object, text or background, and parentId naming an existing node. IDs must be unique and the tree connected and acyclic. Objects, groups and text may carry box {"x":100,"y":100,"width":400,"height":600} in 0–1000 image coordinates; extents must be positive and stay within the image. Box null means automatic placement. A group's description provides context to its children. Text nodes use text for the exact lettering and description for appearance. Colors are hex #RRGGBB strings (up to 16). Names are short tree labels; put visual instructions in description. At most 500 nodes. Style mode is photo or art, steps 2–1000, seed -1 for random or a nonnegative safe integer. Bounding-box coordinates and color palettes are omitted from H3 prompts. In image-root editing, boxes still define the inpainting area.-Use project.set for project name, resolution and aspectRatio. Use ref.add/ref.set for reusable descriptions, then cite each one in a description or the background as @[ref:<id>] with its reference ID, e.g. "@[ref:ref-mara] holds the lantern". Only the references cited this way are passed to generation; referenceIds is no longer used to choose them. Cite only existing image/text references. Remove its citations before ref.remove. Do not create scene.*, shot.* or clip.* commands for image projects. Preserve the current image composition unless asked to change it. Never invent files or claim to have generated an image: the user runs Generate in the Editor.+Use project.set for project name, resolution and aspectRatio. Use ref.add/ref.set for reusable descriptions, then cite each one in a description or the background as @[ref:<id>] with its reference ID, e.g. "@[ref:ref-mara] holds the lantern". Only the references cited this way are passed to generation; referenceIds is no longer used to choose them. Cite only existing image/text references. Remove its citations before ref.remove. The Image tab is active: preserve the project's video scenes and timeline, and do not create scene.*, shot.* or clip.* commands unless the user explicitly asks to edit video. Preserve the current image composition unless asked to change it. Never invent files or claim to have generated an image: the user runs Generate in the Image tab.diff --git a/src-tauri/src/project/commands/images.rs b/src-tauri/src/project/commands/images.rsindex f29053b..31f387d 100644--- a/src-tauri/src/project/commands/images.rs+++ b/src-tauri/src/project/commands/images.rs@@ -1,7 +1,7 @@use super::{batch::ensure_any, patch::Patch, types::ProjectCommand};use crate::project::{image::{ImageBox, ImageNode, ImageScene, ImageStyle},- GenerationType, ProjectConfig,+ ProjectConfig,};use serde::{Deserialize, Serialize};use std::collections::HashSet;@@ -136,9 +136,6 @@ pub(super) fn apply(command: &ProjectCommand,timestamp: &str,) -> Result<(), String> {- if project.generation_type != GenerationType::Image {- return Err("Image commands require an image project.".into());- }let mut scene = project.image_scene.clone()diff --git a/src-tauri/src/project/model.rs b/src-tauri/src/project/model.rsindex ebb4c75..5f88a7e 100644--- a/src-tauri/src/project/model.rs+++ b/src-tauri/src/project/model.rs@@ -1,7 +1,8 @@use super::{references::*, scenes::*, timeline::*};use serde::{Deserialize, Serialize};use std::collections::BTreeMap;-/// Project purpose, not the types of media it contains. Missing values are video.+/// Legacy project preference. Both video and image tools are available for every+/// project; keep reading and writing this field so old documents round-trip.#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]#[serde(rename_all = "lowercase")]pub(crate) enum GenerationType {diff --git a/src-tauri/src/tests/images.rs b/src-tauri/src/tests/images.rsindex 86464cb..0759ed1 100644--- a/src-tauri/src/tests/images.rs+++ b/src-tauri/src/tests/images.rs@@ -165,6 +165,26 @@ fn image_tree_survives_folder_creation_save_and_reopen() {assert_eq!(roundtrip.image_scene, config.image_scene);}+#[test]+fn image_and_video_content_coexist_after_save_and_reopen_for_both_legacy_types() {+ for generation_type in [GenerationType::Video, GenerationType::Image] {+ let root = tempfile::tempdir().unwrap();+ let mut config = created_fixture();+ config.generation_type = generation_type;+ config.image_scene = image_fixture().image_scene;+ let created = create_project_in(root.path(), &config).unwrap();+ let folder = Path::new(&created.folder_path);+ let mut opened = read_project(folder).unwrap();+ opened.config.image_scene.as_mut().unwrap().nodes[2].text = "Film poster".into();+ write_project(folder, &opened.config).unwrap();+ let reopened = read_project(folder).unwrap();+ assert_eq!(reopened.config.image_scene, opened.config.image_scene);+ assert_eq!(reopened.config.timeline, config.timeline);+ assert_eq!(reopened.config.generation_jobs, opened.config.generation_jobs);+ assert_eq!(reopened.config.generation_type, config.generation_type);+ }+}+#[test]fn image_generation_history_survives_native_save_and_reopen_and_validates_snapshots() {let mut snapshot: serde_json::Value = serde_json::from_str(include_str!("../../../fixtures/image-generation-snapshot.json")).unwrap();@@ -218,7 +238,7 @@ fn invalid_image_hierarchies_and_bounds_are_rejected() {}#[test]-fn agent_image_edits_preserve_outputs_and_reject_video_projects_or_invalid_trees() {+fn agent_image_edits_preserve_outputs_and_work_in_video_projects_but_reject_invalid_trees() {use crate::project::commands::{execute_commands_at, ProjectCommand};let mut config = image_fixture();config.image_scene.as_mut().unwrap().output_asset_id = Some("generated-picture".into());@@ -240,7 +260,11 @@ fn agent_image_edits_preserve_outputs_and_reject_video_projects_or_invalid_trees.as_deref(),Some("generated-picture"));- assert!(execute_commands_at(&created_fixture(), &[parsed], &config.updated_at).is_err());+ let video = created_fixture();+ let mixed = execute_commands_at(&video, &[parsed], &config.updated_at).unwrap();+ assert_eq!(mixed.image_scene.as_ref().unwrap().background, "A moonlit ocean");+ assert_eq!(mixed.timeline, video.timeline);+ assert_eq!(mixed.generation_jobs, video.generation_jobs);command["nodes"][1]["parentId"] = serde_json::json!("missing");let parsed: ProjectCommand = serde_json::from_value(command).unwrap();assert!(execute_commands_at(&config, &[parsed], &config.updated_at).is_err());@@ -299,12 +323,12 @@ fn granular_image_commands_edit_subtrees_without_touching_generated_outputs() {scene.nodes.iter().find(|node| node.id == "title"),Some(¤t.image_scene.as_ref().unwrap().nodes[2]));- for command in &commands {- assert!(- execute_commands_at(&created_fixture(), &[command.clone()], ¤t.updated_at)- .is_err()- );- }+ let mut video = current.clone();+ video.generation_type = GenerationType::Video;+ let mixed = execute_commands_at(&video, &commands, ¤t.updated_at).unwrap();+ assert_eq!(mixed.image_scene.as_ref(), Some(&scene));+ assert_eq!(mixed.timeline, video.timeline);+ assert_eq!(mixed.generation_jobs, video.generation_jobs);}#[test]diff --git a/src/App.test.tsx b/src/App.test.tsxindex 0a5e5d4..0118104 100644--- a/src/App.test.tsx+++ b/src/App.test.tsx@@ -83,15 +83,15 @@ describe("project library controls", () => {// One click selects, like a GridView item; it does not open.fireEvent.click(card);expect(card).toHaveAttribute("aria-selected", "true");- expect(screen.queryByRole("tab", { name: "Editor" })).toBeNull();+ expect(screen.queryByRole("tab", { name: "Image" })).toBeNull();fireEvent.doubleClick(card);- expect(await screen.findByRole("tab", { name: "Editor" })).toHaveAttribute("aria-selected", "true");+ expect(await screen.findByRole("tab", { name: "Image" })).toHaveAttribute("aria-selected", "true");fireEvent.click(screen.getByRole("button", { name: "Back to project library" }));const again = await screen.findByRole("option", { name: "Saved illustration" });// The tile that was opened is still the selected one, and Enter opens it.expect(again).toHaveAttribute("aria-selected", "true");fireEvent.keyDown(again, { key: "Enter" });- expect(await screen.findByRole("tab", { name: "Editor" })).toHaveAttribute("aria-selected", "true");+ expect(await screen.findByRole("tab", { name: "Image" })).toHaveAttribute("aria-selected", "true");});it("uses a named New Project form with a default Look instead of a length", async () => {@@ -99,7 +99,7 @@ describe("project library controls", () => {await screen.findByText("Northern Light — Brand Film");fireEvent.click(screen.getByRole("button", { name: "New project" }));expect(screen.getByRole("dialog", { name: "New project" })).not.toBeNull();- expect(screen.getByRole("textbox", { name: "Project name" })).toHaveValue("Untitled video");+ expect(screen.getByRole("textbox", { name: "Project name" })).toHaveValue("Untitled project");expect(screen.queryByRole("textbox", { name: "Describe your video" })).toBeNull();expect(screen.queryByText("What do you want to make?")).toBeNull();expect(screen.queryByText(/Add reference images/)).toBeNull();@@ -296,7 +296,7 @@ describe("project library controls", () => {fireEvent.click(screen.getByRole("button", { name: "Create project" }));expect(await screen.findByRole("complementary", { name: "Agent" })).toBeVisible();- expect(screen.getAllByText("Untitled video").length).toBeGreaterThan(0);+ expect(screen.getAllByText("Untitled project").length).toBeGreaterThan(0);expect(screen.queryByText("First scene")).toBeNull();});diff --git a/src/App.tsx b/src/App.tsxindex 3ff0885..93d7fbf 100644--- a/src/App.tsx+++ b/src/App.tsx@@ -203,7 +203,7 @@ function App() {const showLibraryHeading = projects.length > 0;- const openProject = (project: ProjectRecord, view: ProjectView = "timeline") => {+ const openProject = (project: ProjectRecord, view: ProjectView = project.config.generationType === "image" ? "editor" : "timeline") => {setWorkQueueOpen(false);setSelectedKey(projectQueueKey(project));setActiveProjectInitialView(view);diff --git a/src/WorkQueue.integration.test.tsx b/src/WorkQueue.integration.test.tsxindex 483011a..ca6c15f 100644--- a/src/WorkQueue.integration.test.tsx+++ b/src/WorkQueue.integration.test.tsx@@ -4,6 +4,7 @@ import { act, cleanup, fireEvent, render, screen, waitFor, within } from "@testiimport { listen } from "@tauri-apps/api/event";import { afterEach, beforeEach, expect, it, vi } from "vitest";import App from "./App";+import { markReleaseNotesSeen } from "./lib/releaseNotes";import { saveGeneratedScene } from "./lib/generatedVideo";import { listRecentProjects, saveProject } from "./lib/persistence";import { createProjectConfig, type ProjectRecord } from "./lib/project";@@ -27,6 +28,7 @@ vi.mock("./lib/runtime", async (original) => ({const handlers = new Map<string, (event: { payload: unknown }) => void>();beforeEach(() => {vi.clearAllMocks(); localStorage.clear(); handlers.clear();+ markReleaseNotesSeen();vi.spyOn(HTMLMediaElement.prototype, "load").mockImplementation(() => undefined);vi.mocked(listen).mockImplementation((async (name: string, handler: (event: { payload: unknown }) => void) => { handlers.set(name, handler); return () => handlers.delete(name); }) as unknown as typeof listen);vi.mocked(saveProject).mockImplementation(async (record) => record);@@ -74,7 +76,7 @@ it("keeps the application queue alive while switching projects and saves resultsvi.mocked(listRecentProjects).mockResolvedValue({ projects: [first, second], unreadable: [] });render(<App />);fireEvent.doubleClick(await screen.findByRole("option", { name: "First project" }));- fireEvent.click(screen.getByRole("tab", { name: "Generator" }));+ fireEvent.click(screen.getByRole("tab", { name: "Video" }));fireEvent.click(screen.getByRole("button", { name: /^Generate all$/i }));await waitFor(() => expect(enqueueSlopfabGeneration).toHaveBeenCalledTimes(1));const workId = vi.mocked(enqueueSlopfabGeneration).mock.calls[0][0].jobId;@@ -99,7 +101,7 @@ it("keeps the application queue alive while switching projects and saves resultsexpect(enqueueSlopfabGeneration).toHaveBeenCalledTimes(1);fireEvent.click(screen.getByRole("button", { name: "Back to project library" }));fireEvent.doubleClick(screen.getByRole("option", { name: "First project" }));- fireEvent.click(screen.getByRole("tab", { name: "Generator" }));+ fireEvent.click(screen.getByRole("tab", { name: "Video" }));expect(screen.getByRole("region", { name: "First scene" })).toHaveTextContent(/finished/i);});diff --git a/src/components/ImageProject.integration.test.tsx b/src/components/ImageProject.integration.test.tsxindex 39a5d67..0ff3437 100644--- a/src/components/ImageProject.integration.test.tsx+++ b/src/components/ImageProject.integration.test.tsx@@ -6,7 +6,7 @@ import { afterEach, expect, it, vi } from "vitest";import { ProjectWorkspace } from "./ProjectWorkspace";import { PromptComposer } from "./PromptComposer";import { choose } from "./workspace/comboTestUtils";-import { createProjectConfig, parseProjectConfig, type ProjectRecord } from "../lib/project";+import { createProjectConfig, parseProjectConfig, type CreateProjectInput, type ProjectRecord } from "../lib/project";import { executeAgentCommands } from "../lib/runtime";import { imageScenePrompt } from "../lib/imageScene";import { EMPTY_ENGINE_SETTINGS, saveDebugOptionsEnabled, saveGeneratorTemplateSettings } from "../lib/settings";@@ -14,6 +14,7 @@ import { imageGenerationSnapshot } from "../lib/imageHistory";import { WorkQueue } from "../lib/workQueue";import * as runtime from "../lib/runtime";import fixture from "../../fixtures/project-v1-image.json";+import videoFixture from "../../fixtures/project-v1-complete.json";import { invoke } from "@tauri-apps/api/core";import * as persistence from "../lib/persistence";@@ -108,7 +109,7 @@ it("disables image export until a generated image is selected, and says why", ()expect(within(screen.getByRole("tablist", { name: "Project views" })).getByRole("tab", { name: /Export/ })).toHaveAttribute("aria-selected", "true");const button = screen.getByRole("button", { name: "Export…" });expect(button).toBeDisabled();- expect(button).toHaveAttribute("data-tooltip", "Generate an image in the Editor first.");+ expect(button).toHaveAttribute("data-tooltip", "Generate an image in the Image tab first.");expect(screen.getByText("No image to export yet")).toBeInTheDocument();});@@ -163,26 +164,23 @@ it("shows the full image prompt at the end of the inspector only when debug is eexpect(screen.queryByRole("dialog", { name: "Debug prompt" })).not.toBeInTheDocument();});-it("offers image and video projects when creating a folder project", async () => {- const submit = vi.fn(async () => undefined);+it("creates one project without a separate image or video type", async () => {+ const submit = vi.fn(async (_input: CreateProjectInput) => undefined);render(<PromptComposer busy={false} onCreate={submit} onClose={vi.fn()} />);- fireEvent.click(screen.getByRole("radio", { name: "Image project" }));- expect(screen.getByLabelText("Project name")).toHaveValue("Untitled image");- choose("Resolution", "2720 × 1536");- // Video offers the same larger sizes, so switching keeps the choice.- fireEvent.click(screen.getByRole("radio", { name: "Video project" }));- expect(screen.getByRole("combobox", { name: "Resolution" })).toHaveTextContent("2720 × 1536");- fireEvent.click(screen.getByRole("radio", { name: "Image project" }));+ expect(screen.queryByRole("radiogroup", { name: "Project type" })).not.toBeInTheDocument();+ expect(screen.getByLabelText("Project name")).toHaveValue("Untitled project");choose("Resolution", "3648 × 2048");fireEvent.click(screen.getByRole("button", { name: /Create project/ }));- await waitFor(() => expect(submit).toHaveBeenCalledWith(expect.objectContaining({ generationType: "image", resolution: "2048p" })));+ await waitFor(() => expect(submit).toHaveBeenCalledWith(expect.objectContaining({ resolution: "2048p" })));+ expect(submit.mock.calls[0][0]).not.toHaveProperty("generationType");});-it("opens the three-tab image workspace and saves hierarchy/inspector edits through the project session", async () => {+it("opens a legacy image project on Image with all five tabs and saves composition edits", async () => {const save = vi.fn(async () => undefined);render(<ProjectWorkspace project={record()} onBack={vi.fn()} onSave={save} />);const navigation = within(screen.getByRole("tablist", { name: "Project views" }));- expect(navigation.getAllByRole("tab").map((tab) => tab.textContent)).toEqual(["Editor", "References", "Export"]);+ expect(navigation.getAllByRole("tab").map((tab) => tab.textContent)).toEqual(["Timeline", "Video", "Image", "References", "Export"]);+ expect(navigation.getByRole("tab", { name: "Image" })).toHaveAttribute("aria-selected", "true");fireEvent.contextMenu(screen.getByRole("button", { name: "Image" }));fireEvent.click(screen.getByRole("menuitem", { name: "New Text" }));fireEvent.change(screen.getByLabelText("Text to render"), { target: { value: "Hello world" } });@@ -194,9 +192,9 @@ it("opens the three-tab image workspace and saves hierarchy/inspector edits throexpect(saved.config.imageScene?.nodes.at(-1)).toMatchObject({ kind: "text", text: "Hello world", description: "Large blue letters", parentId: "image-root" });expect(parseProjectConfig(saved.config).imageScene).toEqual(saved.config.imageScene);fireEvent.click(navigation.getByRole("tab", { name: /References/ }));- fireEvent.click(navigation.getByRole("tab", { name: /Editor/ }));+ fireEvent.click(navigation.getByRole("tab", { name: "Image" }));expect(screen.getByRole("tree", { name: "Image nodes" })).toBeInTheDocument();- fireEvent.keyDown(document.body, { key: "3", code: "Digit3", ctrlKey: true });+ fireEvent.keyDown(document.body, { key: "5", code: "Digit5", ctrlKey: true });expect(navigation.getByRole("tab", { name: /Export/ })).toHaveAttribute("aria-selected", "true");expect(screen.getByRole("region", { name: "Image preview" })).toBeInTheDocument();});@@ -207,10 +205,43 @@ it("keeps the video tabs and applies image agent commands without changing generconst next = await executeAgentCommands(image, [{ op: "image.set", ...authored, background: "A moonlit ocean" }]);expect(next.imageScene?.background).toBe("A moonlit ocean");const video = createProjectConfig({ name: "Film", prompt: "", aspectRatio: "16:9", resolution: "768p", targetDurationSeconds: 60 });- await expect(executeAgentCommands(video, [{ op: "image.set", ...authored }])).rejects.toThrow("image project");+ const mixed = await executeAgentCommands(video, [{ op: "image.set", ...authored }]);+ expect(mixed.imageScene?.nodes).toEqual(authored.nodes);+ expect(mixed.timeline).toEqual(video.timeline);+ expect(mixed.generationJobs).toEqual(video.generationJobs);render(<ProjectWorkspace project={{ folderPath: "D:/Film", config: video }} onBack={vi.fn()} onSave={vi.fn()} />);const navigation = within(screen.getByRole("tablist", { name: "Project views" }));expect(navigation.getByRole("tab", { name: /Timeline/ })).toBeInTheDocument();- expect(navigation.getByRole("tab", { name: /Generator/ })).toBeInTheDocument();- expect(navigation.queryByRole("tab", { name: /Editor/ })).not.toBeInTheDocument();+ expect(navigation.getByRole("tab", { name: "Video" })).toBeInTheDocument();+ expect(navigation.getByRole("tab", { name: "Image" })).toBeInTheDocument();+});++it("adds and reopens an image in an older video project while preserving its video content", async () => {+ const project = { folderPath: "D:/Legacy film", config: parseProjectConfig(videoFixture) };+ const save = vi.fn(async (_record: ProjectRecord) => undefined);+ const workspace = render(<ProjectWorkspace project={project} onBack={vi.fn()} onSave={save} />);+ const navigation = () => within(screen.getByRole("tablist", { name: "Project views" }));+ expect(navigation().getByRole("tab", { name: "Timeline" })).toHaveAttribute("aria-selected", "true");+ fireEvent.keyDown(document.body, { key: "3", code: "Digit3", ctrlKey: true });+ expect(navigation().getByRole("tab", { name: "Image" })).toHaveAttribute("aria-selected", "true");+ fireEvent.contextMenu(screen.getByRole("button", { name: "Image" }));+ fireEvent.click(screen.getByRole("menuitem", { name: "New Text" }));+ fireEvent.change(screen.getByLabelText("Text to render"), { target: { value: "Film poster" } });+ fireEvent.click(screen.getByRole("button", { name: "Save" }));+ await waitFor(() => expect(save).toHaveBeenCalledOnce());+ const saved = save.mock.calls[0][0];+ expect(saved.config.timeline).toEqual(project.config.timeline);+ expect(saved.config.generationJobs).toEqual(project.config.generationJobs);+ workspace.unmount();+ render(<ProjectWorkspace project={{ ...saved, config: parseProjectConfig(JSON.parse(JSON.stringify(saved.config))) }} onBack={vi.fn()} onSave={save} />);+ fireEvent.click(navigation().getByRole("tab", { name: "Image" }));+ fireEvent.click(within(screen.getByRole("tree", { name: "Image nodes" })).getByRole("button", { name: "Text" }));+ expect(screen.getByLabelText("Text to render")).toHaveValue("Film poster");+ fireEvent.click(navigation().getByRole("tab", { name: "Export" }));+ const exportTypes = within(screen.getByRole("tablist", { name: "Export type" }));+ expect(exportTypes.getByRole("tab", { name: "Image" })).toHaveAttribute("aria-selected", "true");+ fireEvent.click(exportTypes.getByRole("tab", { name: "Video" }));+ expect(exportTypes.getByRole("tab", { name: "Video" })).toHaveAttribute("aria-selected", "true");+ fireEvent.click(exportTypes.getByRole("tab", { name: "Image" }));+ expect(screen.getByRole("region", { name: "Image preview" })).toBeInTheDocument();});diff --git a/src/components/ProjectCard.tsx b/src/components/ProjectCard.tsxindex ecdf69b..d1ee61b 100644--- a/src/components/ProjectCard.tsx+++ b/src/components/ProjectCard.tsx@@ -70,9 +70,9 @@ export const ProjectCard = forwardRef(function ProjectCard(}).reduce<number | null>((first, clip) => first === null ? clip.startMs : Math.min(first, clip.startMs), null);const firstClip = firstVisualMs === null ? null : visibleClipAt(config.timeline.tracks, firstVisualMs, assetsById);- const firstAsset = config.generationType === "image" ? config.assets.find((asset) => asset.id === config.imageScene?.outputAssetId) : firstClip ? config.assets.find((asset) => asset.id === firstClip.assetId) : undefined;+ const firstAsset = firstClip ? config.assets.find((asset) => asset.id === firstClip.assetId) : config.assets.find((asset) => asset.id === config.imageScene?.outputAssetId);const posterTimeMs = firstClip?.sourceStartMs ?? 0;- const image = config.generationType === "image";+ const image = !firstClip && Boolean(config.imageScene);const Glyph = image ? Image32 : Film32;const meta = `Edited ${relativeDate(config.updatedAt)} · ${image ? "Image" : durationLabel(config.brief.targetDurationSeconds)}`;const prompt = config.brief.prompt.trim();diff --git a/src/components/ProjectWorkspace.test.ts b/src/components/ProjectWorkspace.test.tsindex a890713..7df354b 100644--- a/src/components/ProjectWorkspace.test.ts+++ b/src/components/ProjectWorkspace.test.ts@@ -128,7 +128,7 @@ describe("project workspace timecode", () => {// The views are tabs in the title bar; the agent is not one of them.const tabs = screen.getByRole("tablist", { name: "Project views" });- expect(within(tabs).getAllByRole("tab").map((tab) => tab.textContent?.trim())).toEqual(["Timeline", "Generator", "References", "Export"]);+ expect(within(tabs).getAllByRole("tab").map((tab) => tab.textContent?.trim())).toEqual(["Timeline", "Video", "Image", "References", "Export"]);expect(within(tabs).getByRole("tab", { name: "Timeline" })).toHaveAttribute("aria-selected", "true");const panel = document.getElementById(within(tabs).getByRole("tab", { name: "Timeline" }).getAttribute("aria-controls")!);expect(panel).toHaveAttribute("role", "tabpanel");@@ -152,7 +152,7 @@ describe("project workspace timecode", () => {// Ctrl+2 switches to the second view.fireEvent.keyDown(document.body, { key: "2", code: "Digit2", ctrlKey: true });- expect(within(tabs).getByRole("tab", { name: "Generator" })).toHaveAttribute("aria-selected", "true");+ expect(within(tabs).getByRole("tab", { name: "Video" })).toHaveAttribute("aria-selected", "true");expect(within(pane).getByRole("textbox", { name: "Ask Slop about this generation queue" })).toBeInTheDocument();});@@ -175,8 +175,8 @@ describe("project workspace timecode", () => {expect(bar).toHaveTextContent(/Saved/);const tabs = screen.getByRole("tablist", { name: "Project views" });- fireEvent.click(within(tabs).getByRole("tab", { name: "Generator" }));- const generatorBar = screen.getByRole("region", { name: "Generator status" });+ fireEvent.click(within(tabs).getByRole("tab", { name: "Video" }));+ const generatorBar = screen.getByRole("region", { name: "Video status" });expect(generatorBar).toBe(bar);expect(within(generatorBar).getByRole("status")).toHaveTextContent(/scene/);expect(generatorBar).not.toHaveTextContent("references");@@ -259,7 +259,7 @@ describe("project workspace timecode", () => {expect(screen.getByRole("dialog", { name: "Save changes to “Edited”?" })).toBeInTheDocument();});- it("counts running generations on the Generator tab, and returns to the library without a generation warning", () => {+ it("counts running generations on the Video tab, and returns to the library without a generation warning", () => {const config = createProjectConfig({ name: "Ceramic lamp", prompt: "A quiet product film", aspectRatio: "16:9", resolution: "1080p", targetDurationSeconds: 30 });const now = new Date().toISOString();config.generationJobs = [@@ -268,7 +268,7 @@ describe("project workspace timecode", () => {];const onBack = vi.fn();render(createElement(ProjectWorkspace, { project: { folderPath: "C:\\Ceramic Lamp", config }, initialView: "export", onBack, onSave: async () => undefined }));- const generator = screen.getByRole("tab", { name: "Generator" });+ const generator = within(screen.getByRole("tablist", { name: "Project views" })).getByRole("tab", { name: "Video" });expect(generator.querySelector(".ui-badge")?.textContent).toBe("3");fireEvent.click(screen.getByRole("button", { name: "Back to project library" }));expect(onBack).toHaveBeenCalledTimes(1);@@ -516,7 +516,7 @@ describe("project workspace timecode", () => {typePrompt(line(), "a slow push across the launch pad");fireEvent.click(screen.getByRole("tab", { name: "Timeline" }));await screen.findByRole("heading", { name: "Timeline", level: 2 });- fireEvent.click(screen.getByRole("tab", { name: "Generator" }));+ fireEvent.click(screen.getByRole("tab", { name: "Video" }));await screen.findByRole("toolbar", { name: "Generator" });/* The trip unmounted the generator, so the panel is back on the scene andthe card is where the words have to have survived. */diff --git a/src/components/ProjectWorkspace.tsx b/src/components/ProjectWorkspace.tsxindex 4cbf0c1..c0e5d2b 100644--- a/src/components/ProjectWorkspace.tsx+++ b/src/components/ProjectWorkspace.tsx@@ -63,7 +63,7 @@ const writeAgentPane = (open: boolean) => {};const VIEW_LABELS: Record<ShownView, string> = {- timeline: "Timeline", generator: "Generator", references: "References", export: "Export", editor: "Editor",+ timeline: "Timeline", generator: "Video", references: "References", export: "Export", editor: "Image",};const AGENT_PANE_MIN = 280;@@ -84,7 +84,7 @@ function useWindowWidth(): number {/* The project window.- [←] [icon] Project name Timeline Generator References Export [↶][↷] [Save] [Agent][Queue][⚙] [– □ ×]+ [←] [icon] Project name Timeline Video Image References Export [↶][↷] [Save] [Agent][Queue][⚙] [– □ ×]─────────────────────────────────────────────────────────────────────────────────────────────────────InfoBars (save failed, export failed)┌ the view ─────────────────────────────────────────┐┃┌ Agent ──────────┐@@ -93,7 +93,7 @@ function useWindowWidth(): number {The title bar is the caption AND the app's header (i-frame-1): Back, theproject name (click for project settings), Save, Undo/Redo, the view- switcher as a SelectorBar (tabs, not links; Ctrl+1…4), and the pane and+ switcher as a SelectorBar (tabs, not links; Ctrl+1…5), and the pane andapp buttons. The agent is a docked pane on the right with a Splitter;Ctrl+Shift+A or the title-bar button shows and hides it, and both its widthand whether it is open are remembered.@@ -103,7 +103,7 @@ function useWindowWidth(): number {through session.edit() and are undo steps; background work (generationresults, icons, measurements) is not (see projectSession.ts). Text fieldskeep their own native undo — the shortcuts do not fire in them. */-export function ProjectWorkspace({ project, initialView = "timeline", runtime = null, onBack, onSave, workQueue, onGeneratorRuntimeChange, titleBarActions, active = true }: {+export function ProjectWorkspace({ project, initialView, runtime = null, onBack, onSave, workQueue, onGeneratorRuntimeChange, titleBarActions, active = true }: {project: ProjectRecord;initialView?: ProjectView;/** What is installed on this computer, probed once at startup by App. Null@@ -128,11 +128,15 @@ export function ProjectWorkspace({ project, initialView = "timeline", runtime =const session = useMemo(() => queue.project(project), [queue, project.folderPath, project.config.id]);const { config, saving, dirty, saveError, canUndo, canRedo, savedAt } = useSyncExternalStore(session.subscribe, session.getSnapshot);const items = useSyncExternalStore(queue.subscribe, queue.getSnapshot);- const imageProject = config.generationType === "image";- const [view, setView] = useState<ShownView>(() => {- if (imageProject) return initialView === "references" || initialView === "export" ? initialView : "editor";- return initialView === "agent" || initialView === "editor" ? "timeline" : initialView;- });+ // Legacy project types choose only the initial view; every project has both editors.+ const openingView = initialView === "agent" ? "timeline" : initialView ?? (config.generationType === "image" ? "editor" : "timeline");+ const [view, setShownView] = useState<ShownView>(openingView);+ const [mediaMode, setMediaMode] = useState<"video" | "image">(() => openingView === "editor" || ((openingView === "references" || openingView === "export") && config.generationType === "image") ? "image" : "video");+ const setView = (next: ShownView) => {+ if (next === "editor") setMediaMode("image");+ else if (next === "generator" || next === "timeline") setMediaMode("video");+ setShownView(next);+ };const [agentOpen, setAgentOpenState] = useState(() => initialView === "agent" || readAgentPane());const [agentBusy, setAgentBusy] = useState(false);const setAgentOpen = (open: boolean) => { setAgentOpenState(open); writeAgentPane(open); };@@ -190,7 +194,7 @@ export function ProjectWorkspace({ project, initialView = "timeline", runtime =const lengthMs = useMemo(() => videoDurationMs(config), [config]);const sequenceFormat = `${frameWidth}×${frameHeight} · ${config.settings.frameRate} fps · ${formatSequenceLength(lengthMs)}`;- const views: ShownView[] = imageProject ? ["editor", "references", "export"] : ["timeline", "generator", "references", "export"];+ const views: ShownView[] = ["timeline", "generator", "editor", "references", "export"];const running = config.generationJobs.filter(isGenerationOngoing).length;const toggleAgent = () => {const open = !agentOpen;@@ -204,7 +208,7 @@ export function ProjectWorkspace({ project, initialView = "timeline", runtime =useShortcut("Ctrl+S", () => { if (dirty && !saving) void save(); }, { enabled: idle, allowInInput: true });useShortcut("Ctrl+Z", () => { session.undo(); }, { enabled: idle });useShortcut(["Ctrl+Y", "Ctrl+Shift+Z"], () => { session.redo(); }, { enabled: idle });- useShortcut(["Ctrl+1", "Ctrl+2", "Ctrl+3", "Ctrl+4"], (event) => {+ useShortcut(["Ctrl+1", "Ctrl+2", "Ctrl+3", "Ctrl+4", "Ctrl+5"], (event) => {const next = views[Number(event.code?.replace("Digit", "") || event.key) - 1];if (!next) return false;setView(next);@@ -282,19 +286,23 @@ export function ProjectWorkspace({ project, initialView = "timeline", runtime =<ProjectStatusSlot.Provider value={statusSlot}><div className={`project-body${agentOpen ? " project-body--agent" : ""}`} style={agentPane.style}><div id={`${panelId}-view`} role="tabpanel" aria-label={VIEW_LABELS[view]} className={`project-content project-content--${view}`}>- {view === "editor" && imageProject && <ImageEditor config={config} folderPath={project.folderPath} onChange={changeConfig} onGenerate={(template) => queue.enqueueImage(session, template)} onCancel={(id) => queue.cancel(id)} workItems={projectItems.filter((item) => item.kind === "image")} />}- {view === "timeline" && <TimelineView config={config} openSceneId={selectedGenerationJobId} folderPath={project.folderPath} generationCompletionTimes={generationCompletionTimes} onChange={changeConfig} onMeasured={recordMeasurement} onOpenGenerator={(jobId) => { setSelectedGenerationJobId(jobId); setView(imageProject ? "editor" : "generator"); }} />}+ {view === "editor" && <ImageEditor config={config} folderPath={project.folderPath} onChange={changeConfig} onGenerate={(template) => queue.enqueueImage(session, template)} onCancel={(id) => queue.cancel(id)} workItems={projectItems.filter((item) => item.kind === "image")} />}+ {view === "timeline" && <TimelineView config={config} openSceneId={selectedGenerationJobId} folderPath={project.folderPath} generationCompletionTimes={generationCompletionTimes} onChange={changeConfig} onMeasured={recordMeasurement} onOpenGenerator={(jobId) => { setSelectedGenerationJobId(jobId); setView("generator"); }} />}{view === "generator" && <GeneratorView onGenerate={(submissions) => queue.enqueue(session, submissions)} onCancelGeneration={(ids) => queue.cancelScenes(session, ids)} cancellingJobIds={cancellingJobIds} config={config} folderPath={project.folderPath} generationCompletionTimes={generationCompletionTimes} runtime={runtime?.slopfab ?? null} onRuntimeChange={onGeneratorRuntimeChange} onChange={changeConfig} selectedJobId={selectedGenerationJobId} onSelectedJobChange={setSelectedGenerationJobId} onOpenTimeline={() => setView("timeline")} />}{view === "references" && <ReferencesView config={config} folderPath={project.folderPath} onChange={changeConfig} onRegenerateIcon={(id) => queue.regenerateReferenceIcon(session, id)} onGenerateBuiltinIcons={() => queue.generateBuiltinReferenceIcons(session)} onRegenerateBuiltinIcon={(id) => queue.regenerateBuiltinReferenceIcon(session, id)} pendingBuiltinIconIds={queue.pendingBuiltinIconIds()} pendingIconIds={new Set(config.references.filter((reference) => queue.isReferenceIconPending(session, reference.id)).map((reference) => reference.id))} onOpenGenerator={(jobId) => { setSelectedGenerationJobId(jobId); setView("generator"); }} />}- {view === "export" && (imageProject- ? <ImageExportView config={config} folderPath={project.folderPath} />- : <ExportView config={config} folderPath={project.folderPath} onClose={() => setView("timeline")} />)}+ {view === "export" && <div className="project-export">+ <SelectorBar aria-label="Export type" className="project-export__types" value={mediaMode} onChange={setMediaMode} items={[{ value: "video", label: "Video" }, { value: "image", label: "Image" }]} />+ {mediaMode === "image"+ ? <ImageExportView config={config} folderPath={project.folderPath} />+ : <ExportView config={config} folderPath={project.folderPath} onClose={() => setView("timeline")} />}+ </div>}</div>{agentOpen && <Splitter {...agentPane.splitterProps} reverse aria-label="Resize agent pane" aria-controls={`${panelId}-agent`} />}{/* Kept mounted while hidden, so a running turn and the conversationsurvive the pane being closed. */}<aside ref={agentPaneRef} id={`${panelId}-agent`} className="project-agent-pane" aria-label="Agent" hidden={!agentOpen}><AgentDock+ mode={mediaMode}context={view === "editor" ? "this image composition" : view === "timeline" ? "the edit" : view === "generator" ? "this generation queue" : view === "references" ? "project references" : "this export"}record={{ ...project, config }}providers={runtime?.providers ?? CHECKING_PROVIDERS}@@ -321,7 +329,7 @@ export function ProjectWorkspace({ project, initialView = "timeline", runtime =aria-label={`${VIEW_LABELS[view]} status`}className="project-status"end={<>- {!imageProject && <span className="project-status__format" {...tooltipProps("Sequence format: frame size, frame rate and length")}>{sequenceFormat}</span>}+ {mediaMode === "video" && <span className="project-status__format" {...tooltipProps("Sequence format: frame size, frame rate and length")}>{sequenceFormat}</span>}<spanclassName={`project-status__save project-status__save--${saving ? "saving" : dirty ? "unsaved" : "saved"}`}{...tooltipProps(!saving && !dirty && savedAt !== null ? `Saved ${new Date(savedAt).toLocaleString()}` : undefined)}diff --git a/src/components/PromptComposer.tsx b/src/components/PromptComposer.tsxindex 45366ce..2363245 100644--- a/src/components/PromptComposer.tsx+++ b/src/components/PromptComposer.tsx@@ -4,7 +4,7 @@ import { useShortcut } from "../lib/commands";import type { AspectRatio, CreateProjectInput, ProjectConfig, Resolution } from "../lib/project";import { PROJECT_RESOLUTIONS } from "../lib/project";import { SHOT_TAG_GROUPS } from "../lib/shot-tags";-import { ComboBox, ContentDialog, InfoBar, RadioGroup } from "./ui";+import { ComboBox, ContentDialog, InfoBar } from "./ui";interface PromptComposerProps {busy: boolean;@@ -24,16 +24,15 @@ interface PromptComposerProps {const DEFAULT_RESOLUTION: Resolution = "768p";const LOOKS = SHOT_TAG_GROUPS.find((group) => group.id === "visualStyle")!.options;-const folderName = (path?: string) => path?.replace(/[\\/]+$/, "").split(/[\\/]/).at(-1) || "Untitled video";+const folderName = (path?: string) => path?.replace(/[\\/]+$/, "").split(/[\\/]/).at(-1) || "Untitled project";/* New project, and the same form as Project settings for an open project.- A standard 548px ContentDialog on a solid layer: the project type as two- radio buttons, the folder as a read-only path with Browse…, the name, and+ A standard 548px ContentDialog on a solid layer: the folder as a read-only+ path with Browse…, the name, andthe format. [Create] [Cancel] in the footer; Enter creates, Esc cancels.Errors — a folder that is not empty, a failed save — are an InfoBar in thebody rather than red text beside the button. */export function PromptComposer({ busy, onCreate: onSubmit, onClose, project, error, folderPath, folderError, checkingFolder, onChooseFolder }: PromptComposerProps) {- const [generationType, setGenerationType] = useState<"video" | "image">(project?.generationType === "image" ? "image" : "video");const [name, setName] = useState(project?.name ?? folderName(folderPath));const previousFolderName = useRef(folderName(folderPath));useEffect(() => {@@ -63,7 +62,6 @@ export function PromptComposer({ busy, onCreate: onSubmit, onClose, project, errconst submit = async () => {if (blocked) return;await onSubmit({- generationType,name: name.trim(),prompt: project?.brief.prompt ?? "",aspectRatio,@@ -88,22 +86,6 @@ export function PromptComposer({ busy, onCreate: onSubmit, onClose, project, errclassName="composer"><div className="composer__form">- {!project && (- <RadioGroup- label="Project type"- orientation="horizontal"- value={generationType}- disabled={busy}- onChange={(type) => {- setGenerationType(type);- if (!folderPath && (name === "Untitled video" || name === "Untitled image")) setName(`Untitled ${type}`);- }}- options={[- { value: "video", label: "Video project" },- { value: "image", label: "Image project" },- ]}- />- )}{!project && folderPath && (<div className="composer__field"><label htmlFor={`${id}-folder`}>Project folder</label>diff --git a/src/components/workspace/AgentDock.test.tsx b/src/components/workspace/AgentDock.test.tsxindex cafe1b2..ac88795 100644--- a/src/components/workspace/AgentDock.test.tsx+++ b/src/components/workspace/AgentDock.test.tsx@@ -50,6 +50,18 @@ afterEach(() => {});describe("Slop output panel", () => {+ it.each(["video", "image"] as const)("uses the active %s tab for agent instructions without changing the saved project type", async (mode) => {+ const record = project();+ record.config.generationType = mode === "image" ? "video" : "image";+ const original = structuredClone(record.config);+ vi.mocked(runAgentTurn).mockResolvedValue({ result: { kind: "commands", summary: "Done", commands: [] }, events: [], messages: [] });+ render(<AgentDock context="this project" record={record} mode={mode} providers={providers} onPromptStart={vi.fn()} onCommands={async () => undefined} />);+ fireEvent.change(screen.getByRole("textbox", { name: "Ask Slop about this project" }), { target: { value: "Make it warmer" } });+ fireEvent.click(screen.getByRole("button", { name: "Send to Slop" }));+ await waitFor(() => expect(runAgentTurn).toHaveBeenCalledOnce());+ expect(vi.mocked(runAgentTurn).mock.calls[0][0].config.generationType).toBe(mode);+ expect(record.config).toEqual(original);+ });it("grows the prompt box with its text up to six lines, then scrolls", async () => {// jsdom lays nothing out: report 20px per line of text as the content height.const spy = vi.spyOn(HTMLTextAreaElement.prototype, "scrollHeight", "get").mockImplementation(function (this: HTMLTextAreaElement) {diff --git a/src/components/workspace/AgentDock.tsx b/src/components/workspace/AgentDock.tsxindex e5ab857..57574e5 100644--- a/src/components/workspace/AgentDock.tsx+++ b/src/components/workspace/AgentDock.tsx@@ -34,9 +34,11 @@ interface AgentActivity {* workspace. `onClose` wires the header's close button to it; without it the* button is not shown. `expanded` is accepted for compatibility and no longer* changes the layout: the pane is always the full conversation. */-export function AgentDock({ context, record, providers, onPromptStart, onCommands, onClose, onBusyChange }: {+export function AgentDock({ context, record, mode = record.config.generationType === "image" ? "image" : "video", providers, onPromptStart, onCommands, onClose, onBusyChange }: {context: string;record: ProjectRecord;+ /** Active editor context; legacy project types no longer restrict capabilities. */+ mode?: "video" | "image";providers: ProviderStatus[];/** @deprecated The dock is always a pane now; kept so callers need not change. */expanded?: boolean;@@ -132,7 +134,7 @@ export function AgentDock({ context, record, providers, onPromptStart, onCommand? [selected.detail, providerNextStep(selected)].filter(Boolean).join(" "): null;const placeholder = ready- ? record.config.generationType === "image" ? "Ask Slop to compose an image or refine the layout" : `Ask Slop about ${context}`+ ? mode === "image" ? "Ask Slop to compose an image or refine the layout" : `Ask Slop about ${context}`: blockedDetail ?? "No agent provider is available";const providerStatusLabel = requestId && selected? `${selected.label} status: Processing`@@ -152,7 +154,9 @@ export function AgentDock({ context, record, providers, onPromptStart, onCommandsetLastPrompt(clean);setActivity([]);try {- const response = await runAgentTurn(record, provider, clean, id, sessionMessages);+ // The native agent uses this legacy field to select its instructions.+ // Override only the request snapshot, never the saved project document.+ const response = await runAgentTurn({ ...record, config: { ...record.config, generationType: mode } }, provider, clean, id, sessionMessages);if (response.result.kind === "commands") await onCommands(response.result.commands);setSessionMessages(response.messages);setPendingPrompt(null);diff --git a/src/components/workspace/ImageExportView.tsx b/src/components/workspace/ImageExportView.tsxindex d897987..5a01d79 100644--- a/src/components/workspace/ImageExportView.tsx+++ b/src/components/workspace/ImageExportView.tsx@@ -40,7 +40,7 @@ export function ImageExportView({ config, folderPath }: { config: ProjectConfig;const desktop = isTauri();/* Why there is nothing to export, in the order the user can fix it. */- const blocker = !output?.relativePath ? "Generate an image in the Editor first."+ const blocker = !output?.relativePath ? "Generate an image in the Image tab first.": draft ? "This image is still a draft. Generate it before exporting.": !desktop ? "Exporting is available in the Slopus desktop app.": null;diff --git a/src/lib/imageCommands.test.ts b/src/lib/imageCommands.test.tsindex 9630799..02337a9 100644--- a/src/lib/imageCommands.test.ts+++ b/src/lib/imageCommands.test.ts@@ -41,11 +41,14 @@ describe("image agent commands", () => {expect(cleared.nodes[2].box).toEqual(scene.nodes[2].box);});- it("initializes an older image project without imageScene and rejects image edits in video projects", async () => {+ it.each(["video", "image"] as const)("initializes an older %s project without imageScene", async (generationType) => {const project = parseProjectConfig(projectFixture);+ project.generationType = generationType;project.imageScene = undefined;const updated = await executeAgentCommands(project, [{ op: "image.node.add", id: "subject", parent: "image-root", kind: "object", name: "Subject" }]);expect(updated.imageScene?.nodes[0]).toEqual(createImageScene(project.brief.prompt).nodes[0]);- for (const command of cases.commands) await expect(executeAgentCommands({ ...project, generationType: "video" }, [imageCommandSchema.parse(command)])).rejects.toThrow("image project");+ expect(updated.imageScene?.nodes[1]).toMatchObject({ id: "subject", kind: "object" });+ expect(updated.generationJobs).toEqual(project.generationJobs);+ expect(updated.timeline).toEqual(project.timeline);});});diff --git a/src/lib/imageHistory.ts b/src/lib/imageHistory.tsindex 9c1bbe1..8071c5d 100644--- a/src/lib/imageHistory.ts+++ b/src/lib/imageHistory.ts@@ -46,7 +46,7 @@ export function removeImageAsset(assets: readonly ProjectAsset[], id: string): P/** Keep the editable version in history without creating another image file. */export function saveImageDraft(config: ProjectConfig, generatorTemplateId?: string): ProjectConfig {const scene = config.imageScene;- if (config.generationType !== "image" || !scene) return config;+ if (!scene) return config;const selected = config.assets.find((asset) => asset.id === scene.outputAssetId);const source = scene.rootType === "image" ? scene.sourceImage : null;if (!source && !selected?.imageDraft) return config;diff --git a/src/lib/project.ts b/src/lib/project.tsindex 82bdeff..c200336 100644--- a/src/lib/project.ts+++ b/src/lib/project.ts@@ -9,7 +9,7 @@ export const PROJECT_FILE_NAME = "slopus.json";* ever written. */export const LEGACY_PROJECT_FILE_NAMES = ["polstudio.json", "pols.json", "polstudio.project.json"] as const;export const CURRENT_SCHEMA_VERSION = 1 as const;-/** Project purpose, independent of the kinds of media it contains. */+/** Legacy preference retained for old projects, not a restriction on media tools. */export const generationTypeSchema = z.enum(["video", "image", "3d", "music", "speech"]);export type GenerationType = z.infer<typeof generationTypeSchema>;export const DEFAULT_GENERATION_STEPS = 20;diff --git a/src/lib/runtime.ts b/src/lib/runtime.tsindex e39962f..3d91b4f 100644--- a/src/lib/runtime.ts+++ b/src/lib/runtime.ts@@ -313,7 +313,6 @@ function executeDemoCommands(config: ProjectConfig, commands: ProjectCommand[]):for (const command of commands) {switch (command.op) {case "image.set": case "image.configure": case "image.node.add": case "image.node.set": case "image.node.move": case "image.node.duplicate": case "image.node.remove": {- if (next.generationType !== "image") throw new Error(`${command.op} requires an image project.`);const scene = applyImageCommand(next.imageScene ?? createImageScene(next.brief.prompt), command);for (const id of scene.referenceIds) if (!next.references.some((reference) => reference.id === id && ["image", "text"].includes(reference.kind))) throw new Error(`Image reference '${id}' must name an existing image or text reference.`);for (const id of actionReferenceIds(imageScenePromptText(scene))) if (!next.references.some((reference) => reference.id === id && ["image", "text"].includes(reference.kind))) throw new Error(`The image cites '@[ref:${id}]', which must name an existing image or text reference.`);diff --git a/src/lib/workQueue.test.ts b/src/lib/workQueue.test.tsindex cc77567..52355cf 100644--- a/src/lib/workQueue.test.ts+++ b/src/lib/workQueue.test.ts@@ -58,6 +58,21 @@ const finish = async (queue: WorkQueue, id: string) => {describe("image generation work", () => {const template: GeneratorTemplate = { id: "image-test", name: "MiniMax H3", modelType: "minimax-h3", defaultSteps: 20, attention: "sage2", paths: { ...EMPTY_ENGINE_SETTINGS, transformer: "C:/h3.safetensors" } };const imageProject = (): ProjectRecord => ({ folderPath: "C:/Image", config: createProjectConfig({ name: "Poster", prompt: "An ocean poster", generationType: "image", aspectRatio: "1:1", resolution: "768p", targetDurationSeconds: 60 }) });+ it("generates an image in a video project and preserves its video scenes", async () => {+ const { queue, first } = setup();+ const original = first.getSnapshot().config;+ vi.mocked(invoke).mockResolvedValue({ relativePath: "media/generated/poster.jpg", width: 768, height: 768 });+ queue.enqueueImage(first, template);+ await waitFor(() => expect(enqueueSlopfabGeneration).toHaveBeenCalledOnce());+ const request = vi.mocked(enqueueSlopfabGeneration).mock.calls[0][0];+ expect(request).toMatchObject({ stillImage: true, frames: 1 });+ await finish(queue, request.jobId);+ const reopened = parseProjectConfig(JSON.parse(JSON.stringify(first.getSnapshot().config)));+ expect(reopened.imageScene?.outputAssetId).toBeTruthy();+ expect(reopened.assets.some((asset) => asset.relativePath === "media/generated/poster.jpg")).toBe(true);+ expect(reopened.generationJobs).toEqual(original.generationJobs);+ expect(reopened.timeline).toEqual(original.timeline);+ });it.each([-1, 0, Number.MAX_SAFE_INTEGER])("saves the exact submitted image seed without changing the authored seed (%s)", async (seed) => {const { queue, saved } = setup();const record = imageProject();diff --git a/src/lib/workQueue.ts b/src/lib/workQueue.tsindex d90ae79..a9d3f95 100644--- a/src/lib/workQueue.ts+++ b/src/lib/workQueue.ts@@ -217,7 +217,6 @@ export class WorkQueue {if (template.mode === "animate") throw new Error("Choose a MiniMax H3 prompt template for images.");session.update((config) => saveImageDraft(config, template.id));const current = session.getSnapshot().config;- if (current.generationType !== "image") throw new Error("Open an image project to generate images.");const scene = current.imageScene ?? createImageScene(current.brief.prompt);const edit = scene.rootType === "image" ? compileImageEdits(current) : null;if (!imageScenePrompt(scene)) throw new Error("Describe the image or add an object before generating.");diff --git a/src/styles/workspace.css b/src/styles/workspace.cssindex 651e342..85d6f5f 100644--- a/src/styles/workspace.css+++ b/src/styles/workspace.css@@ -170,6 +170,18 @@background: var(--layer);}+.project-export {+ display: grid;+ grid-template-rows: auto minmax(0, 1fr);+ height: 100%;+ min-height: 0;+}++.project-export__types {+ padding: var(--space-1) var(--space-3);+ border-bottom: 1px solid var(--stroke-divider);+}+.project-agent-pane > * {flex: 1 1 auto;min-height: 0;