Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS
JavaScript ai-agentsdashboarddeveloper-toolsdigital-twinquantified-selfsecond-brainself-hostedtailscale
Merge pull request #1234 from atomantic/feat/video-lora-huggingface-ltx2
[._.]/ Adam Eivy3922c93e9b27
diff --cc .changelog/NEXT.mdindex 32239e2501,073de089e6..3991d26964--- a/.changelog/NEXT.md+++ b/.changelog/NEXT.md@@@ -2,10 -2,10 +2,12 @@@## Added+- **Add canon characters / places / objects by hand** — Each canon section in the Universe editor (Cast, Places, Objects) now has an **Add** button next to "Pick from Catalog" — the same manual-add affordance the variation buckets already had. Click it, type a name (and optionally a description), and Save mints a new canon entry you can immediately render, refine, and fill in. The entry lands unlocked (so its inline editors are usable right away), dedupes case-insensitively against existing names, and persists through the same optimistic-append path as the catalog picker — so you no longer have to extract from prose, pick from the catalog, or promote a variation just to start a character. (`client/src/components/universe/UniverseCanonSection.jsx`)+- **Character LoRA training — train consistent character adapters from your universe canon** — Create → Media Gen gains a **Training** tab (`/media/training`) that closes the loop from "character exists in a universe" to "every render of that character looks the same." Per character, a **dataset workbench** builds reference material three ways: batch-generate single-subject training renders from the character's canon descriptors (deterministic view/pose/expression/outfit variation matrix, queued through the normal image lane), upload your own images (normalized to PNG via sharp), or slice the character's existing reference-sheet turnaround into grid crops. A **vision-LLM captioner** (same provider pathway as the voice agent's visual describe) auto-captions every image prefixed with the character's trigger word, with per-image caption editing and re-captioning. Once ≥10 captioned images are ready, **train a FLUX.2 Klein LoRA locally** through one of two engines, picked automatically: mflux's MLX-native trainer (`mflux-train`, mflux ≥0.17 — wrapped by `scripts/train_mflux_lora.py`, preferred on Apple Silicon; the dataset stages in mflux's `NNNN.png`+`NNNN.txt` auto-discovery layout, and quantize/low-ram knobs derive from total RAM so a 48 GB machine trains QLoRA-style instead of OOMing) or a vendored torch/diffusers+peft trainer (`scripts/train_flux2_lora.py` — bf16 bases only, precompute-then-free text/VAE encoding, gradient checkpointing) as the fallback. Either engine exports diffusers-format adapters. Training runs ride the media-job GPU lane (serialized with renders, SSE progress with per-step loss, mid-training sample previews, 30-min idle watchdog, cancel saves a checkpoint). The finished adapter lands in `data/loras/` with a sidecar carrying the character link + trigger word + size-variant compat key (`flux2-4b`/`flux2-9b`), so it appears in the existing LoRA library and picker with the right base-model gating immediately. **Auto-apply:** pipeline comic-page and storyboard renders that match a character with a trained LoRA automatically attach the adapter and weave its trigger word into the prompt (local mode; per-stage opt-out in Generation settings). Character cards in the universe editor and catalog detail pages show a trained-LoRA chip + dataset entry point; trained LoRAs in the library link back to their dataset. Datasets are machine-local (like the LoRA files themselves — never federated) and fully backed up; training checkpoints/caches are excluded as regenerable. Run records live in PostgreSQL (`lora_training_runs`). (`server/services/loraTraining/`, `server/services/loraDatasets.js`, `server/services/loraDatasetGenerate.js`, `server/services/loraDatasetCaption.js`, `server/services/characterLoraResolver.js`, `client/src/pages/LoraTraining.jsx`, `client/src/pages/LoraDatasetDetail.jsx`)+ - **Video LoRAs — install LTX-2 LoRAs from HuggingFace and fuse them into Video Gen renders** — LoRA support now extends past image models to the **dgrauet `ltx2` video runtime**. A new **"Install video LoRA from HuggingFace"** box on the LoRA Manager (`/media/loras`) takes any HF repo URL or `org/name` id (e.g. `fal/ltx2.3-audio-reactive-lora`), fetches the repo metadata, picks the `.safetensors`, auto-detects the video family from the repo id / tags / `base_model` (LTX-Video → `ltx-video`), and writes a sidecar — the HuggingFace analogue of the existing Civitai installer (gated repos use your HuggingFace token from Image Gen settings). Video Gen (`/media/video`) gains a **LoRA picker** that appears only on an LTX-2 (`ltx2`) model, filtered to the `ltx-video` family, with per-LoRA strength and a trigger-word append button — the same component the Image Gen page uses. Selected LoRAs fuse into the transformer via the pipeline's `_pending_loras` hook (the exact mechanism upstream's `ltx-2-mlx generate --lora` CLI uses), so they apply across **every** mode — text, image, FFLF, extend, and audio-to-video — including multi-chunk chains. Applied LoRAs are stamped into the video-history entry and round-trip through the resume/Remix flow. Only the `ltx2` runtime can fuse LoRAs today; the route and service reject LoRAs on the legacy `mlx_video` / `wan22` / `hunyuan` runtimes with a clear error. (`server/lib/huggingfaceLora.js`, `server/services/loras.js`, `server/routes/loras.js`, `server/services/videoGen/local.js`, `server/routes/videoGen.js`, `scripts/generate_ltx2.py`, `server/lib/runners.js`, `client/src/lib/runnerFamilies.js`, `client/src/pages/VideoGen.jsx`, `client/src/pages/Loras.jsx`)+## Changed- **CoS system jobs can now pin their own AI provider + model** — Each autonomous "System Task" (Chief of Staff → Jobs) gains an optional **AI Provider & Model** picker in its create and edit forms, so a heavy refactor job can run on Opus while a lightweight triage job runs on a cheaper/local model — independently, per job, instead of every job inheriting the single active provider. The override is forwarded into the generated task's metadata on both the scheduled and manual-trigger paths, where the agent runner already honors `metadata.provider`/`metadata.model`. Leaving the picker on its defaults preserves the prior behavior (active provider, per-task model selection). Only AI-agent jobs show the picker; shell/script jobs never reach the AI runner. A pinned provider is now resolved *before* the active-provider availability gate, so a job pinned to a healthy provider runs even when the globally active provider is down or unset. (`client/src/components/cos/tabs/JobsTab.jsx`, `server/services/autonomousJobs/crud.js`, `server/services/autonomousJobs/skillTemplates.js`, `server/services/agentProviderResolution.js`, `server/routes/cosJobRoutes.js`, `server/lib/validation.js`)