Skip to content

AI media harness for planning, generating, and editing locally

TypeScript

Document and verify slop sharing

Bitti44ee7c5998c1
diff --git a/README.md b/README.md
index 512a06d..10055d8 100644
--- a/README.md
+++ b/README.md
@@ -34,7 +34,7 @@ Slopus brings an AI assistant, a scene generator, reusable references, a timelin
- **RefMods.** Use pre-encoded H3 `.safetensors` references with Ref2VA generators for video, images, edits and icons. Set **Strength** and **Copies** per attachment.
- **LoRAs.** Combine local or downloadable adapters in generator templates, with ordering, strength and step-count controls.
- **LAN workers.** Generate on another Windows or Linux computer. Workers download available weights, receive local files as needed, and return results to your project.
-- **Generator templates.** Download weights or use local files. Save model and attention settings per template, with optional **MotionCache** for supported modes.
+- **Generator templates.** Download weights or use local files. Save model and attention settings per template, with optional **MotionCache** for supported modes. Import and export URL-based templates as portable [`.slop` bundles](docs/generator-weights.md#sharing-generator-templates).
- **Timeline.** Video and audio tracks with thumbnails, waveforms, snapping, trimming, splitting, zoom and keyboard shortcuts. Transform, opacity, chroma key, fades and wipes, plus GPU effects (sharpen, blur, color correction, vignette, `.cube` LUTs) that can be bypassed.
- **Image editor.** Generate images from prompts, objects and text, or open an image and describe whole-image or local edits. Keep originals, drafts and versions in the image bar.
- **Export.** Video: MP4 in H.264, VP9 or AV1 (as your encoders allow) at a chosen resolution, frame rate and quality; exports keep running in the background. Images: pick one from the image bar and save it as JPG or PNG at a chosen size and quality.
diff --git a/RELEASE_NOTES.md b/RELEASE_NOTES.md
index 007b6e1..d33eacc 100644
--- a/RELEASE_NOTES.md
+++ b/RELEASE_NOTES.md
@@ -4,6 +4,8 @@ This alpha update adds DMAD LoRA support, resumable model downloads, and improve
## What's new
+- Share URL-based generator templates using Import and Export in Generator settings. Versioned `.slop` JSON bundles include GPU download variants, LoRAs and additional safetensors, preserve existing templates on import, and leave local paths out of shared files.
+
- Renamed Colour correction to Basic Corrections and added temperature, tint, highlights, shadows, whites and blacks alongside exposure, contrast and saturation.
- Added Creative with eight built-in procedural looks and intensity, faded film, sharpen and vibrance controls; RGB and hue/saturation/luma curve editors; and shadow, midtone and highlight Color Wheels with individual lightness controls.
- Vignette now includes midpoint, roundness and feather, plus negative amounts for lighter edges. Grading settings are saved with the project and applied consistently in preview and export.
diff --git a/docs/generator-weights.md b/docs/generator-weights.md
index 243a48c..f29703b 100644
--- a/docs/generator-weights.md
+++ b/docs/generator-weights.md
@@ -13,6 +13,78 @@ the video default is used if eligible, otherwise the first available template.
Icons use the selected template's steps, attention, MotionCache and LoRAs,
including their step overrides.
+## Sharing generator templates
+
+Use **Export** in Settings → Generator to select one or more templates and save
+a `.slop` file. Each required model, configured optional file, and referenced
+LoRA must have an HTTP or HTTPS download URL. The export picker explains which
+templates need URLs before they can be shared. Downloaded templates retain their
+source URLs and GPU variants when exported; local paths and download state are
+excluded.
+
+Use **Import** to open a `.slop` file. Templates are added with new IDs; duplicate
+names receive numbered suffixes. Existing templates, the default generator, and
+unrelated settings are preserved. Custom LoRAs are included by URL, including
+their strength, activation, step override and sampling recipe. Matching LoRAs
+already in the recipient's library are reused. Import does not download weights;
+use the template's normal **Download** action when ready.
+
+### `.slop` version 1
+
+A `.slop` file is UTF-8 JSON, optionally with a BOM. It contains a versioned
+envelope and typed, independently versioned entries. This separates the file
+format from individual payloads so future entries can represent project
+templates, settings bundles, or other shareable data:
+
+```json
+{
+ "format": "slop",
+ "version": 1,
+ "items": [
+ {
+ "type": "generator-template",
+ "version": 1,
+ "data": {
+ "name": "Example generator",
+ "modelType": "minimax-h3",
+ "defaultSteps": 20,
+ "attention": "sage2",
+ "mode": "prompt",
+ "motionCache": false,
+ "sources": {
+ "transformer": [{ "url": "https://example.com/transformer.safetensors", "gpuModel": "", "minVramGb": 0 }],
+ "textEncoder": [{ "url": "https://example.com/text-encoder.safetensors", "gpuModel": "", "minVramGb": 0 }],
+ "videoVae": [{ "url": "https://example.com/video-vae.safetensors", "gpuModel": "", "minVramGb": 0 }],
+ "audioVae": [{ "url": "https://example.com/audio-vae.safetensors", "gpuModel": "", "minVramGb": 0 }]
+ },
+ "loras": [],
+ "additionalSafetensors": []
+ }
+ }
+ ]
+}
+```
+
+Version 1 supports 1–100 entries, with a 4 MB file limit. The current importer
+accepts only `generator-template` entries at payload version 1. Unsupported
+envelope versions, entry types, payload versions, and malformed entries reject
+the entire import before settings are changed. Unknown payload fields are
+rejected so settings from a newer version cannot silently disappear. Future
+payload changes must declare a supported version and migration explicitly.
+
+Generator payloads carry no machine IDs or paths. `sources` maps the existing
+weight roles (`transformer`, `textEncoder`, `videoVae`, `audioVae`, optional
+`tokenizer`) to ordered variant arrays. Each variant has `url`, optional
+`gpuModel` (default empty), and optional `minVramGb` (default zero). Prompt mode
+requires the four model roles; Animate requires transformer and both VAEs, plus
+an additional safetensor with `role: "promptEmbedding"`.
+
+LoRA entries embed `name`, `url`, `enabled`, and `strength`, plus optional
+`stepOverride` and `samplingPreset` (`"dmad-4step"`). Their array order is
+preserved. Additional safetensors carry `name`, `url`, and an optional
+`role: "promptEmbedding"`. Local download and preparation state is never shared.
+URLs must be HTTP(S) and cannot contain username/password credentials.
+
## LoRAs
Settings → Generators includes a separate **LoRAs** library. **TaoMate 3-Step**
diff --git a/src/components/GeneratorSharing.test.tsx b/src/components/GeneratorSharing.test.tsx
index 8a9e684..5505e3a 100644
--- a/src/components/GeneratorSharing.test.tsx
+++ b/src/components/GeneratorSharing.test.tsx
@@ -18,13 +18,13 @@ afterEach(() => { cleanup(); delete (window as unknown as Record<string, unknown
it("exports only chosen URL templates through the native save dialog", async () => {
const template = minimaxOriginalTemplate();
render(<GeneratorSharing templates={[createGeneratorTemplate("Local setup"), template, { ...template, id: "other", name: "Other" }]} />);
- fireEvent.click(screen.getByRole("button", { name: "Export", exact: true }));
+ fireEvent.click(screen.getByRole("button", { name: "Export" }));
const dialog = within(screen.getByRole("dialog", { name: "Export generator templates" }));
expect((dialog.getByRole("checkbox", { name: "Export Local setup" }) as HTMLInputElement).disabled).toBe(true);
- expect(dialog.getByText(/Transformer weights needs a download URL/)).toBeTruthy();
+ expect(dialog.getByText(/Add a download URL for Transformer weights/)).toBeTruthy();
fireEvent.click(dialog.getByRole("checkbox", { name: "Export Other" }));
vi.mocked(invoke).mockResolvedValue(true);
- fireEvent.click(dialog.getByRole("button", { name: "Export", exact: true }));
+ fireEvent.click(dialog.getByRole("button", { name: "Export" }));
await screen.findByText("Exported 1 generator template.");
const [command, args] = vi.mocked(invoke).mock.calls[0];
expect(command).toBe("export_slop_file");
@@ -38,7 +38,7 @@ it("imports from the Generators page and updates its list without downloading or
vi.mocked(invoke).mockImplementation(async (command) => command === "import_slop_file" ? serializeGeneratorSlop([shared]) : null as never);
const previous = loadGeneratorTemplateSettings();
render(<SettingsView onClose={() => undefined} />);
- fireEvent.click(screen.getByRole("button", { name: "Import", exact: true }));
+ fireEvent.click(screen.getByRole("button", { name: "Import" }));
await screen.findByText("Added 1 generator template.");
expect(screen.getByRole("button", { name: "Edit Shared generator generator" })).toBeTruthy();
expect(loadGeneratorTemplateSettings().templates).toHaveLength(previous.templates.length + 1);
@@ -49,7 +49,7 @@ it("imports from the Generators page and updates its list without downloading or
it("does not mutate on cancellation or malformed files, and reports native read errors", async () => {
const before = loadGeneratorTemplateSettings();
render(<GeneratorSharing templates={before.templates} />);
- fireEvent.click(screen.getByRole("button", { name: "Import", exact: true }));
+ fireEvent.click(screen.getByRole("button", { name: "Import" }));
await waitFor(() => expect((screen.getByRole("button", { name: "Import" }) as HTMLButtonElement).disabled).toBe(false));
expect(screen.queryByText(/Added/)).toBeNull();
expect(loadGeneratorTemplateSettings()).toEqual(before);
diff --git a/src/components/GeneratorSharing.tsx b/src/components/GeneratorSharing.tsx
index 6b80f07..2349701 100644
--- a/src/components/GeneratorSharing.tsx
+++ b/src/components/GeneratorSharing.tsx
@@ -61,7 +61,7 @@ export function GeneratorSharing({ templates }: { templates: GeneratorTemplate[]
}} />
{error && !choosing && <InfoBar severity="error" title="Couldn’t share generator templates" message={error} onClose={() => setError(null)} />}
{message && <InfoBar severity="success" title={message} onClose={() => setMessage(null)} />}
- {choosing && <ContentDialog title="Export generator templates" primaryText={busy ? "Exporting…" : "Export"} primaryDisabled={busy || selected.length === 0 || selected.length > 100}
+ {choosing && <ContentDialog title="Export generator templates" defaultButton="primary" primaryText={busy ? "Exporting…" : "Export"} primaryDisabled={busy || selected.length === 0 || selected.length > 100}
onPrimary={() => void exportFile()} closeText="Cancel" closeDisabled={busy} disableEscape={busy} onClose={() => { setChoosing(false); setError(null); }}>
<p>Choose up to 100 templates to share. Each model file and LoRA needs a download URL.</p>
<div className="generator-sharing__choices">
diff --git a/src/lib/slop.test.ts b/src/lib/slop.test.ts
index ca1b70e..685f914 100644
--- a/src/lib/slop.test.ts
+++ b/src/lib/slop.test.ts
@@ -79,6 +79,15 @@ describe("portable generator bundles", () => {
expect(loadLoras()).toEqual(loras);
expect(loadGeneratorTemplateSettings()).toEqual(before);
});
+ it("preserves separate LoRA selections even when they share a URL and recipe", () => {
+ const template = minimaxOriginalTemplate();
+ template.loras = [{ loraId: "a", enabled: true, strength: .5 }, { loraId: "b", enabled: true, strength: .75 }];
+ const library = ["a", "b"].map((id) => ({ id, name: id, path: "", url: "https://example.com/adapter" }));
+ const [imported] = importGeneratorSlop(serializeGeneratorSlop([template], library));
+ const reopened = loadGeneratorTemplateSettings().templates.find(({ id }) => id === imported.id)!;
+ expect(reopened.loras?.map(({ strength }) => strength)).toEqual([.5, .75]);
+ expect(new Set(reopened.loras?.map(({ loraId }) => loraId)).size).toBe(2);
+ });
});
describe("slop validation", () => {
diff --git a/src/lib/slop.ts b/src/lib/slop.ts
index 9d5d630..3736227 100644
--- a/src/lib/slop.ts
+++ b/src/lib/slop.ts
@@ -34,7 +34,7 @@ export const portableGeneratorSchema = z.object({
additionalSafetensors: z.array(z.object({ name, url, role: z.literal("promptEmbedding").optional() }).strict()).max(128).default([]),
}).strict().superRefine((template, context) => {
for (const field of generatorPathFields(template)) {
- if (field.required && !template.sources[field.id]?.length) context.addIssue({ code: "custom", path: ["sources", field.id], message: `${field.label} needs a download URL.` });
+ if (field.required && !template.sources[field.id]?.length) context.addIssue({ code: "custom", path: ["sources", field.id], message: `Add a download URL for ${field.label}.` });
}
if (template.mode === "animate" && !template.additionalSafetensors.some((file) => file.role === "promptEmbedding")) {
context.addIssue({ code: "custom", path: ["additionalSafetensors"], message: "Animate templates need a prompt embedding download URL." });
@@ -57,12 +57,12 @@ function validatedGenerator(value: unknown, label: string): PortableGenerator {
const result = portableGeneratorSchema.safeParse(value);
if (!result.success) {
const issue = result.error.issues[0];
- throw new Error(`${label}: ${issue.path.join(".") || "template"}: ${issue.message}`);
+ throw new Error(`${label}: ${issue.code === "custom" ? "" : `${issue.path.join(".") || "template"}: `}${issue.message}`);
}
return result.data;
}
-/** Explicit projection is deliberate: machine paths, IDs, credentials and
+/** Explicit projection is deliberate: machine paths, IDs, API settings and
* download/preparation state are never serialized into a shared template. */
export function portableGenerator(template: GeneratorTemplate, library = loadLoras()): PortableGenerator {
const sources: PortableGenerator["sources"] = {};
@@ -120,18 +120,20 @@ export function mergeGeneratorSlop(document: GeneratorSlop, current: GeneratorTe
names.add(title.toLowerCase());
const template = createGeneratorTemplate(title, data.modelType);
const paths = { ...EMPTY_ENGINE_SETTINGS };
+ const usedLoraIds = new Set<string>();
for (const field of ENGINE_PATH_FIELDS) paths[field.id] = data.sources[field.id]?.[0]?.url ?? "";
return { ...template, defaultSteps: data.defaultSteps, attention: data.attention, mode: data.mode, motionCache: data.motionCache,
paths, sources: structuredClone(data.sources),
additionalSafetensors: data.additionalSafetensors.map((file) => ({ ...file, id: `additional-${crypto.randomUUID()}` })),
loras: data.loras.map((entry) => {
- let lora = loras.find((existing) => existing.url === entry.url && existing.stepOverride === entry.stepOverride && existing.samplingPreset === entry.samplingPreset);
+ let lora = loras.find((existing) => !usedLoraIds.has(existing.id) && existing.url === entry.url && existing.stepOverride === entry.stepOverride && existing.samplingPreset === entry.samplingPreset);
if (!lora) {
lora = { id: `lora-${crypto.randomUUID()}`, name: entry.name, path: "", url: entry.url,
...(entry.stepOverride !== undefined ? { stepOverride: entry.stepOverride } : {}),
...(entry.samplingPreset ? { samplingPreset: entry.samplingPreset } : {}) };
loras.push(lora);
}
+ usedLoraIds.add(lora.id);
return { loraId: lora.id, enabled: entry.enabled, strength: entry.strength };
}),
} satisfies GeneratorTemplate;