AI media harness for planning, generating, and editing locally
TypeScript
Add inspector generation controls
Bitti7d4e035a735c
diff --git a/src/components/workspace/GeneratorView.test.tsx b/src/components/workspace/GeneratorView.test.tsxindex 388a042..9fce2d2 100644--- a/src/components/workspace/GeneratorView.test.tsx+++ b/src/components/workspace/GeneratorView.test.tsx@@ -32,6 +32,34 @@ beforeEach(() => {});afterEach(cleanup);+it("generates only the scene open in the inspector", () => {+ const state = setup();+ fireEvent.click(screen.getByRole("button", { name: "Select scene Second scene" }));+ const panel = within(screen.getByRole("complementary", { name: "Scene: Second scene" }));+ fireEvent.click(panel.getByRole("button", { name: "Generate" }));+ expect(state.latest().generationJobs.map((job) => job.status)).toEqual(["draft", "queued"]);+ expect(panel.getByRole("button", { name: "Cancel" })).toBeEnabled();+});++it.each(["queued", "generating"] as const)("cancels only the %s scene open in the inspector", (status) => {+ const initial = project();+ initial.generationJobs.forEach((job) => { job.status = status; });+ setup(initial);+ fireEvent.click(screen.getByRole("button", { name: "Select scene Second scene" }));+ const panel = within(screen.getByRole("complementary", { name: "Scene: Second scene" }));+ fireEvent.click(panel.getByRole("button", { name: "Cancel" }));+ expect(cancelSlopfabGeneration).toHaveBeenCalledExactlyOnceWith("scene-second");+ expect(panel.getByRole("button", { name: "Cancelling…" })).toBeDisabled();+});++it("disables inspector generation while the scene is being saved", () => {+ const initial = project();+ initial.generationJobs[0].status = "ready";+ setup(initial);+ const panel = within(screen.getByRole("complementary", { name: "Scene: First scene" }));+ expect(panel.getByRole("button", { name: "Generate" })).toBeDisabled();+});+it("defaults to Prompt and switches frame conditioning off and back on without losing selections", () => {const initial = project();initial.references = [{ id: "still", kind: "image", name: "Still", description: "", intendedUse: [], sourcePath: "C:/still.png", createdAt: initial.createdAt }];diff --git a/src/components/workspace/GeneratorView.tsx b/src/components/workspace/GeneratorView.tsxindex ce4fa64..268ea5a 100644--- a/src/components/workspace/GeneratorView.tsx+++ b/src/components/workspace/GeneratorView.tsx@@ -447,6 +447,9 @@ export function GeneratorView({ config, folderPath, runtime = null, generationCo|| jobs.some((source) => (source.id === continuationSceneId(job, jobs) || longShotDependencies(job, jobs).includes(source)) && ["queued", "generating", "ready"].includes(source.status)))).map((job) => job.id));const selectedIndicator = selected && changedJobIds.has(selected.id) ? "changed" : selected?.status;+ const selectedCancellable = selected?.status === "queued" || selected?.status === "generating";+ const selectedCancelling = Boolean(selected && cancellingJobIds.has(selected.id));+ const selectedBlocker = selected && !selectedCancellable ? generationBlocker(selected) : null;/* --- Keyboard ------------------------------------------------------------Scoped to the Generator, so the same keys can mean something else on the@@ -671,15 +674,25 @@ export function GeneratorView({ config, folderPath, runtime = null, generationCo/></div>- {debugEnabled && !animate && <div className="debug-prompt">- <button+ <div className="inspector-actions">+ {debugEnabled && !animate && <buttontype="button"className="secondary-button debug-prompt__toggle"aria-expanded={showDebugPrompt}aria-haspopup="dialog"onClick={() => setShowDebugPrompt(true)}- >Debug prompt</button>- </div>}+ >Debug prompt</button>}+ <button+ type="button"+ className="primary-button"+ data-tooltip={selectedCancellable ? `Cancel ${selected.title}` : selectedBlocker ?? `Generate ${selected.title}`}+ disabled={selectedCancellable ? selectedCancelling : Boolean(selectedBlocker)}+ onClick={() => generateScene(selected)}+ >+ {selectedCancellable ? <Stop14 aria-hidden="true" /> : <Sparkle16 aria-hidden="true" />}+ {selectedCancellable ? selectedCancelling ? "Cancelling…" : "Cancel" : "Generate"}+ </button>+ </div></>}</aside>}diff --git a/src/components/workspace/ImageEditor.tsx b/src/components/workspace/ImageEditor.tsxindex 6410f54..a9216c6 100644--- a/src/components/workspace/ImageEditor.tsx+++ b/src/components/workspace/ImageEditor.tsx@@ -532,13 +532,14 @@ export function ImageEditor({ config, folderPath, onChange: changeConfig, onGene.map((reference) => ({ id: reference.id, name: reference.name, mediaTypes: referenceMediaTypes(reference), detail: referenceTypeLabel(reference), icon: <ReferenceIcon reference={reference} folderPath={folderPath} fallback={reference.kind === "image" ? <Image16 /> : <Text16 />} /> }));// A chip for a video or audio reference names it; one deleted says so.const missingReference = (id: string) => config.references.find((reference) => reference.id === id)?.name ?? "Deleted reference";+ const templateInspector = Boolean((extendMode && output && extendOptions) || (output && templateSourceId === output.id) || (runningTemplate && templateSource));+ const generateButton = <button type="button" className="primary-button image-generate-button" data-tooltip={editPlan?.error ?? undefined} disabled={active ? work.cancelling || work.status === "encoding" : Boolean(templateSnapshot && output?.imageDraft) || !isTauri() || !template || !templateUsable(template) || (imageRoot ? Boolean(editPlan?.error) : !imageScenePrompt(scene))} onClick={() => attempt(() => active ? onCancel(work.id) : onGenerate(template!))}>{active ? <Stop14 aria-hidden="true" /> : <Sparkle16 aria-hidden="true" />}{active ? work.cancelling ? "Cancelling…" : "Cancel" : "Generate"}</button>;return <div ref={editorRoot} className="image-editor" style={{ ...treePane.style, ...inspectorPane.style }}><div className="image-canvas-tools" role="toolbar" aria-label="Image tools">- {/* Generate and the generator lead; canvas tools and view controls- share the centered group. */}+ {/* The generator leads; canvas tools and view controls share the centered group. */}<div className="image-tools__start">- {(!extendMode || active) && <button className="primary-button image-generate-button" data-tooltip={editPlan?.error ?? undefined} disabled={active ? work.cancelling || work.status === "encoding" : Boolean(templateSnapshot && output?.imageDraft) || !isTauri() || !template || !templateUsable(template) || (imageRoot ? Boolean(editPlan?.error) : !imageScenePrompt(scene))} onClick={() => attempt(() => active ? onCancel(work.id) : onGenerate(template!))}>{active ? <Stop14 aria-hidden="true" /> : <Sparkle16 aria-hidden="true" />}{active ? work.cancelling ? "Cancelling…" : "Cancel" : "Generate"}</button>}+ {templateInspector && active && generateButton}<ComboBoxclassName="image-generator"aria-label="Generator"@@ -759,7 +760,10 @@ export function ImageEditor({ config, folderPath, onChange: changeConfig, onGene<div className="image-palette">{selected.colors.map((color, index) => <div key={index}><input aria-label={`Palette color ${index + 1}`} type="color" value={color} onChange={(event) => patchNode({ colors: selected.colors.map((old, i) => i === index ? event.target.value : old) })} /><button className="icon-button image-pane-button" aria-label={`Remove color ${index + 1}`} data-tooltip="Remove color" onClick={() => patchNode({ colors: selected.colors.filter((_, i) => i !== index) })}><Delete14 aria-hidden="true" /></button></div>)}<button className="secondary-button" disabled={selected.colors.length >= (selected.kind === "root" ? 16 : 5)} onClick={() => patchNode({ colors: [...selected.colors, "#808080"] })}><Add14 aria-hidden="true" />Color</button></div></PropSection>}</div>- {debugEnabled && <div className="debug-prompt"><button type="button" className="secondary-button debug-prompt__toggle" aria-haspopup="dialog" onClick={() => attempt(() => setDebugPrompt(imageRoot ? imageEditDebugPrompt(compileImageEdits(config).edits) : compileImagePrompt(config).prompt))}>Debug prompt</button></div>}+ <div className="inspector-actions">+ {debugEnabled && <button type="button" className="secondary-button debug-prompt__toggle" aria-haspopup="dialog" onClick={() => attempt(() => setDebugPrompt(imageRoot ? imageEditDebugPrompt(compileImageEdits(config).edits) : compileImagePrompt(config).prompt))}>Debug prompt</button>}+ {(!extendMode || active) && generateButton}+ </div></aside>}{debugEnabled && debugPrompt !== null && <DebugPromptDialog sceneTitle={config.name} segments={[{ kind: "brief", value: debugPrompt }]} onClose={() => setDebugPrompt(null)} />}</div>;diff --git a/src/styles/generator.css b/src/styles/generator.cssindex 349e76f..43c03e1 100644--- a/src/styles/generator.css+++ b/src/styles/generator.css@@ -865,15 +865,22 @@gap: var(--space-2);}-/* --- The compiled prompt (Debug prompt dialog) ----------------------------- */+/* --- Inspector actions and compiled prompt -------------------------------- */-.debug-prompt {+.debug-prompt,+.inspector-actions {flex: 0 0 auto;padding: var(--space-2) var(--space-3);border-top: 1px solid var(--line);background: var(--panel);}+.inspector-actions {+ display: flex;+ flex-direction: column;+ gap: var(--space-2);+}+.debug-prompt__toggle {width: 100%;}diff --git a/src/styles/image-editor.css b/src/styles/image-editor.cssindex a4196d5..e05f9dd 100644--- a/src/styles/image-editor.css+++ b/src/styles/image-editor.css@@ -12,7 +12,7 @@.image-tree > .ui-pane-header, .image-inspector > .ui-item-header { flex-shrink: 0; }.image-tree > [role="tree"] { flex: 1; overflow: auto; padding: var(--space-1) 0; }.image-inspector { display: flex; flex-direction: column; }-.image-inspector > .debug-prompt { margin-top: auto; }+.image-inspector > .inspector-actions { margin-top: auto; }.image-pane-button.icon-button { width: var(--control-sm); height: var(--control-sm); }/* --- Tree rows -----------------------------------------------------------------