Commit Graph
549 Commits
Author SHA1 Message Date
digital-garbageandClaude Sonnet 4.6 f3fe032847 Fix transition coverage and allow disabling (duration=0)
- transition_duration=0 now fully skips boundary recording and all
  effect application (previously min was 2 and effects always ran)
- Pixel path: half now covers the full blend zone (blend_half_pixels =
  video_overlap//2 * time_scale) plus transition_duration//2 extra
  frames, so blended latent artifacts are no longer visible outside
  the fade region
- Latent path: half_lat now covers blend_half_latent + extra_lat so
  the re-encode window includes the full overlap zone; half_pix uses
  the full decoded window so the VAE round-trip frames are all faded
- blend_half_latent/blend_half_pixels stored per boundary entry so
  each boundary uses the correct overlap geometry

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-26 00:42:40 +03:00
digital-garbageandClaude Sonnet 4.6 51816254bd Fix creativity mask yellow cast: gate noise by noise_mask
i2v reference frames have noise_mask≈0.3 but were receiving full
creativity noise perturbation, shifting their latent representation
and causing the VAE to decode a yellow-tinted anchor frame.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-25 19:04:28 +03:00
digital-garbageandClaude Sonnet 4.6 b4c6e1b264 Fix LTXAVTEModel memory leak warning on VAE decode
Delete model/positive/negative references before calling vae.decode() so
ComfyUI's model manager can unload the diffusion model and text encoder
cleanly. Previously they stayed live as function parameters, causing the
circular-reference warning.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-25 18:36:41 +03:00
digital-garbageandClaude Sonnet 4.6 0e17316639 Rework transition routing: decode once for IMAGE, re-encode only for LATENT-only
- Detect which outputs are connected via the ComfyUI prompt graph
- IMAGE connected: full decode → pixel transitions → IMAGE (no re-encode)
- LATENT only: window decode → effect → re-encode → splice (original approach)
- Both: pixel path for IMAGE; LATENT is the raw combined output unchanged
- Add decode_tile_size optional input for OOM control
- Split logic into _apply_effect_on_pixels / _apply_transitions_pixel /
  _apply_transitions_latent / _decode_video for clarity

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-25 18:10:51 +03:00
digital-garbageandClaude Sonnet 4.6 a46c4c7146 Fix transition decode: flatten [B, T, H, W, C] to [N, H, W, C]
LTXAV video VAE returns 5D tensor; _blur_pixel_frame expected 3D frames.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-25 18:03:41 +03:00
digital-garbageandClaude Sonnet 4.6 9dbd239702 Add visual transition effects to scene chain sampler
Custom transition triggers in Studio can now have a visual_effect assigned
(fade_to_black, crossfade, blur_out_in). When triggered during scene splitting,
the effect fires at that scene boundary: the sampler decodes the latent window
around the boundary, applies the pixel-space effect, and re-encodes in-place.

No new nodes needed — VAE is already connected to the scene chain sampler.
New transition_duration input controls how many pixel frames are affected.
New scene_boundaries output provides the boundary list for debugging.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-25 17:50:31 +03:00
digital-garbageandClaude Sonnet 4.6 8775304fe1 Fix i2v injection performance: skip hooks when i2v off, keep tensors on GPU
Two causes of 3-4x slowdown:
1. Hooks registered for blessed maps capture even when reference_injection
   was disabled. Now hooks only register when has_i2v is True.
2. Hidden state tensors moved CPU on capture and GPU on inject -
   for 150-frame LTXAV the tensors are large. Tensors now stay on the
   model device throughout.

Also fixes memory leak: _block_list captured strongly in wrapper closure
stored inside model.model_options created a cycle:
  model → model_options → wrapper → _block_list → model
Changed to weakref.ref(_block_list) - dereferenced lazily inside
_register_hooks at call time, breaking the cycle.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-23 01:04:12 +03:00
digital-garbageandClaude Sonnet 4.6 8caafe8239 Remove Bridge Shots - first-last-frame approach fails for scene transitions
Attempted both approaches:
1. Bridge to reference image - visible reset, character snaps back to reference
2. Two-pass: generate scenes independently, bridge between actual scene frames -
   still resets to reference because each independently generated scene
   starts from the i2v reference frame (it IS the first frame)

Root cause: LTX-2's first-last-frame conditioning anchors outputs to the
pinned frames too strongly. When the "last frame" target is the reference
image (as the start of any scene), the bridge always transitions TO that
reference, producing the exact reset effect we were trying to avoid.

Would require scenes generated without any reference anchor for the
bridge target to be a natural scene composition - which breaks character
consistency. No clean solution without IP-Adapter or equivalent.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-23 00:18:08 +03:00
digital-garbageandClaude Sonnet 4.6 f1815b6645 Fix Bridge Shots: two-pass generation, bridge between actual scene frames
Previous implementation bridged scene N → reference image, which caused
a visible "reset to reference" rather than a smooth transition.

Correct approach (matches LTX Desktop Bridge Shots):
1. Generate ALL scenes independently from latent_template
2. For each consecutive pair, generate a bridge:
   - First frame = last frame of scene N
   - Last frame  = first frame of scene N+1
   - Middle      = denoised by the model
3. Assemble: scene1 + bridge + scene2 + bridge + scene3 + ...

The model now transitions between where scene N actually ended and where
scene N+1 actually begins, not to a static reference reset.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-23 00:09:17 +03:00
digital-garbageandClaude Sonnet 4.6 a27fee80b3 Add Bridge Shots to scene chain sampler
New boolean input: bridge_shots (default False). When enabled, generates
a short transition clip between scenes by pinning both ends:
- First frame = last frame of the previous scene (where we came from)
- Last frame  = first protected frame of the i2v latent (reference image)
- Middle      = denoised by the model with the scene's conditioning

Duration: 30 video frames (~1 second at 30fps). Only fires when an i2v
reference is detected in the latent template (noise_mask present with
first frame mask < 0.95). Falls back to standard overlap if no i2v
reference is connected.

Status line reports bridge count. Scene report lists bridge seeds.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-22 23:58:15 +03:00
digital-garbageandClaude Sonnet 4.6 a37d6a7a6f Lazy hook registration: zero overhead for high-sigma steps
Hooks were registered upfront and called on every block, every step -
even when returning None immediately. For 150-frame LTXAV with large
hidden state tensors, Python hook dispatch overhead accumulated.

New approach: hooks are only registered when sigma first drops below
0.95 (the active zone). For the 8-step distilled schedule this means
steps 1-5 have ZERO hook overhead. On scene transition (sigma resets),
hooks are unregistered for a clean state, then re-registered when sigma
enters the active zone again.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-22 23:34:48 +03:00
digital-garbageandClaude Sonnet 4.6 ada1f4ada1 Fix injection performance: skip hooks when i2v off, keep tensors on GPU
Two causes of 3-4x slowdown:
1. Hooks registered for blessed maps capture even when reference_injection
   is disabled. Now hooks only register when has_i2v is True.
2. Hidden state tensors were moved CPU on capture and GPU on inject -
   for 150-frame LTXAV the tensors are large (~100MB per block).
   Tensors now stay on the model's device throughout, eliminating the
   CPU<->GPU round trip overhead.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-22 23:24:53 +03:00
digital-garbageandClaude Sonnet 4.6 770779b0a5 Strip diagnostic code, restore normal generation speed
Removed: 13 extra diagnostic hooks (18→5), scene transition tracking,
per-scene capture buffers, cross-scene similarity reporting, _prev_sigma,
_scene_snapped, _scene_cur_ref/_sca refs in hook remover.

Back to 5 hooks on IDENTITY_BLOCKS only. Diagnostic data collected,
analysis complete - no longer needed in production path.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-22 23:17:38 +03:00
digital-garbageandClaude Sonnet 4.6 f6c761746f Add Reference injection toggle to Studio, off by default
The i2v hidden state injection only produces meaningful results alongside
carry_i2v_guides in the Scene Chain Sampler. Without it the injection
has no reliable reference to anchor from (proven through testing).

New Studio Refiner setting: "Reference injection" toggle (default off).
Hint explains it should be enabled together with carry_i2v_guides.
Passing reference_latent=None to build_enhancements when disabled so
the entire injection path is skipped cleanly.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-22 22:59:42 +03:00
digital-garbageandClaude Sonnet 4.6 faaa95a4d6 Update IDENTITY_BLOCKS: swap b34 for b20 based on carry_i2v data
With carry_i2v_guides=True, 5-scene similarity ranking:
b14:0.785, b33:0.742, b20:0.739, b21:0.737, b30:0.730 (vs b34:0.722)
b20 is consistently 3rd, b34 dropped to 5th. New set: [14, 20, 21, 30, 33].

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-22 22:57:20 +03:00
digital-garbageandClaude Sonnet 4.6 2f8e09db1e Update IDENTITY_BLOCKS based on empirical cross-scene similarity data
Data from 5-scene run showed:
- b14:0.609, b33:0.581, b34:0.551, b30:0.542, b21:0.538 (most consistent)
- b26:0.403, b27:0.437 (least consistent - scene-specific, removed)

New IDENTITY_BLOCKS = [14, 21, 30, 33, 34] replacing [21, 26, 31].

Also fixes phantom scene count: only save a scene snapshot on transition
if the previous scene was properly snapped (filters model init passes
that triggered false scene transitions, overcounting by 1).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-22 22:49:28 +03:00
digital-garbageandClaude Sonnet 4.6 bf6cb80f9f Fix diagnostic performance and report timing
Performance: hooks now only capture when sigma in [0.85, 0.95] - one
step per scene instead of every step. Eliminates the 2x overhead and
5x slowdown on step 6.

Report timing: fires in sigma tracker when sigma < 0.5 AND scene is
snapped AND ≥2 scenes captured. Covers the last sigma=0.421875 step
which was below the old hook_remover threshold of 0.05.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-22 22:44:17 +03:00
digital-garbageandClaude Sonnet 4.6 21fb111956 Diagnostic: cross-scene block consistency within a single run
Detects scene transitions via sigma resets (sigma jumping back up = new
scene). At mid-sigma in each scene, snapshots ALL candidate blocks
(14, 19, 20-35). After the run completes, computes pairwise cosine
similarity across scenes and prints ranked results:

  Cross-scene block consistency (3 scenes):
    b27:0.89  b31:0.84  b24:0.81 ... b14:0.21
  -> Candidate identity blocks (sim>=0.70): [24, 27, 29, 31]
  -> Scene-specific blocks (sim<=0.40): [14, 19, 20]

Blocks with high similarity = consistent character features across
different scene compositions. Use these as actual injection targets.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-22 22:37:21 +03:00
digital-garbageandClaude Sonnet 4.6 9922f8279a Add per-block similarity diagnostic to find true identity blocks
Registers capture-only hooks on ALL candidate blocks (14, 19, 20-35).
After each run, saves their hidden states at sigma~0.91 to a diagnostic
file. On the second run, compares per-block cosine similarity against the
first run and prints ranked results:

  Block similarity (high=character-consistent, low=scene-specific):
    b27:0.89  b31:0.84  b24:0.81  b19:0.43  b14:0.21 ...

Blocks with high similarity across different scenes of the same character
are the true identity blocks. Blocks with low similarity are scene-specific.
Requires refinement_key to be set. Runs silently (no output) on first
generation, reports on second.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-22 22:34:21 +03:00
digital-garbageandClaude Sonnet 4.6 890df470c6 Fix injection timing for front-loaded sigma schedules
With schedules like [1.0, 0.99, 0.98, ..., 0.725, 0.421, 0.0] the old
snapshot threshold of sigma<0.6 fired on the last step, leaving zero
steps for injection. Changed to sigma<0.95 to snapshot after the
high-noise plateau, giving injection during the two steps that actually
form character identity (sigma 0.725 and 0.421875).

Widened identity injection gate from (0.25, 0.42) to (0.35, 0.80) to
cover those steps. Strength stays at 2%.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-22 22:26:52 +03:00
digital-garbageandClaude Sonnet 4.6 917b439741 Reduce i2v injection to 2%, tighten sigma gate to 0.25-0.42
4% was still causing spatial content from reference to ghost into new
scenes. Dropped to 2% and narrowed the injection window to 0.25-0.42
(late identity formation, after coarse composition is already set),
reducing scene composition interference from the reference.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-22 22:18:34 +03:00
digital-garbageandClaude Sonnet 4.6 3e1033e345 Reduce i2v injection: identity blocks only at 4%, no anchor blocks
Anchor blocks (14, 19) encode scene composition/structure - injecting
from the reference frame bled the entire reference scene into new
generations. Disabled anchor injection for i2v entirely.

Identity block strength reduced from 10% to 4% - hidden states encode
the full scene context, not just character features, so even a light
touch at 10% was too strong. 4% applies a gentle bias toward the
reference character without overriding scene-specific content.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-22 22:14:05 +03:00
digital-garbageandClaude Sonnet 4.6 5c0d867e0e Implement injection via forward hooks, snapshot at mid-sigma
patches_replace["dit"] never fires for LTXAV - both capture and inject
must use forward hooks. Each hook now handles both:
- Capture: always writes block output to capture_buf (for blessed maps)
- Inject: when lazy_inject is populated, lerps the block output toward
  the reference tensor at the appropriate sigma-gated strength, then
  returns the modified output so the model sees the adjusted hidden state

Reference snapshot moved from step 1 (sigma_max, very noisy) to first
time sigma drops below 0.6, giving cleaner reference maps for fine
details like character features. Snapshot only fires once len(cap_buf)
covers all injection blocks.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-22 22:09:17 +03:00
digital-garbageandClaude Sonnet 4.6 9209433edc Switch to forward hooks for capture - patches_replace["dit"] not called by LTXAV
LTXAV transformer blocks receive transformer_options correctly but never
check patches_replace["dit"], so capture/inject via that mechanism is a
no-op. Switch to nn.Module forward hooks registered directly on the
transformer blocks.

Finds transformer block list via model.model.diffusion_model using common
attribute names (transformer_blocks, blocks, joint_blocks, layers).
Handles dict/tuple/tensor output formats from blocks.
Hooks are removed via a cleanup wrapper once sigma drops below 0.05.
Prints "Registered N forward hooks" if successful, warns if block list
not found.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-22 21:54:18 +03:00
digital-garbageandClaude Sonnet 4.6 7fca7dbc2b Diagnose whether transformer_options patches reach the model
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-22 21:48:23 +03:00
digital-garbageandClaude Sonnet 4.6 a449ceda27 Add stage-by-stage diagnostics to trace wrapper installation and execution
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-22 21:43:40 +03:00
digital-garbageandClaude Sonnet 4.6 ef3a421bd4 Fix capture_buf=None when no refinement key, remove _model_ref from closure
Two bugs:
1. capture_buf was None when refinement_key was empty, so block replacements
   never captured anything and the lazy inject snapshot check always failed
   silently. capture_buf is now always created when has_i2v is True.
2. _model_ref=model was left in the sigma tracker closure from a previous
   refactor - a direct model reference sitting inside model.model_options,
   causing the "potential memory leak" warning. Removed.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-22 21:38:48 +03:00
digital-garbageandClaude Sonnet 4.6 45c6b9d60d Fix reference extraction - use first generation step instead of separate pass
Running apply_fn with a different x tensor causes shape mismatches because
the conditioning in args["c"] was prepared for the actual generation's
input shape, not our reference tensor.

New approach: no separate forward pass. The block capture already runs
during every denoising step. After the first actual step completes,
snapshot capture_buf into the lazy inject objects. From step 2 onwards
injection is active with the step-1 reference maps.

This is shape-safe, model-type agnostic, and requires zero extra inference.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-22 21:33:13 +03:00
digital-garbageandClaude Sonnet 4.6 fc96cda54e Fix reference extraction for ModelPatcherDynamic - use apply_fn not apply_model
ModelPatcherDynamic (dynamic VRAM loading) has no apply_model method.
Use apply_fn from the wrapper instead - it's the base model function
and works with all patcher types.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-22 21:30:17 +03:00
digital-garbageandClaude Sonnet 4.6 5d9d45eea8 Fix i2v detection threshold: LTX uses mask = 1 - strength, not 0
LTX i2v sets the image frame mask to (1 - strength), e.g. 0.3 at
strength=0.7. Our threshold of < 0.1 was too tight and missed all
real-world i2v latents. Changed to < 0.95 - any frame below 1.0
indicates a reference image is present.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-22 21:27:54 +03:00
digital-garbageandClaude Sonnet 4.6 73314041ac Expand diagnostics: show mask min/max/frame0 values
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-22 21:23:28 +03:00
digital-garbageandClaude Sonnet 4.6 fa26f76239 Add diagnostic logging to reference map detection
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-22 21:21:19 +03:00
digital-garbageandClaude Sonnet 4.6 ebc794c5e9 Fix reference map extraction - use real conditioning via wrapper
The previous approach called model.apply_model with empty conditioning {},
which fails silently for LTX2 (text conditioning required). Reference maps
were never actually populated.

New approach:
- _LazyInject holder: blocks receive a placeholder that starts empty and gets
  populated on the first denoising step. No injection until maps are ready.
- _run_reference_extraction: called from _sigma_tracker on the first model
  call, where args["c"] contains the real conditioning. Temporarily installs
  capture patches, calls model.apply_model at sigma=0.03 with actual
  conditioning, collects hidden states, populates lazy inject objects, then
  restores all patches.
- Generation proceeds normally from step 1 with injection active.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-22 21:15:59 +03:00
digital-garbageandClaude Sonnet 4.6 f7b2906230 Never fall back to blessed maps when i2v latent is provided
When an i2v reference is connected, old blessed maps from prior runs
(which may represent a completely different character) must not inject.
If reference map extraction fails, injection is simply skipped rather
than falling back to stale appearance data.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-22 21:07:50 +03:00
digital-garbageandClaude Sonnet 4.6 0f6a6fd674 Extract reference maps from i2v latent for automatic appearance consistency
When an i2v latent is connected (noise_mask with protected first frame),
FunPack now automatically extracts hidden state maps from the reference
image at blocks 14, 19, 21, 26, 31 via a single forward pass at sigma=0.03.
These maps are injected during generation to anchor character appearance
without requiring any prior rated runs.

Priority: reference maps from i2v > blessed maps from prior rated run.
T2v latents (no noise_mask or mask=1 throughout) are detected and skipped
cleanly - no injection happens and generation is unaffected.

Reference map injection uses fixed moderate strength (anchor 22%, identity
10%) since there is no reward signal to scale against. Blessed maps continue
to scale with reward as before.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-22 21:07:08 +03:00
digital-garbageandClaude Sonnet 4.6 35abb66169 Add identity block injection (21, 26, 31) for character appearance consistency
Extends the attention anchor system with three representative blocks from
the concept-formation/identity zone (20-35) which handles character
appearance, body proportions, and distinguishing visual traits.

- IDENTITY_BLOCKS = [21, 26, 31]: evenly spaced across the identity zone
- sigma gate (0.2, 0.55): mid-sigma window where identity is being formed,
  slightly later than semantic anchors (0.2, 0.5)
- max inject strength 12% (vs 28% for semantic anchors): lighter touch to
  preserve appearance without overriding scene-specific action/composition
- Same blessed map file, same capture/bless/inject infrastructure
- _sigma_gated_strength now takes configurable sigma_high/sigma_low params
- _build_block_replacement takes sigma_gate tuple per block

Fix pre-existing test failures from single-word transition removal:
"suddenly" replaced with "cut to" in transition-related test prompts.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-22 20:53:44 +03:00
digital-garbageandClaude Sonnet 4.6 15e4c0e764 Normalize continuation scene audio amplitude to match overlap context
Audio continuation chunks mix real latents (overlap context from prev
scene, low std) with template noise (new frames, std ~1). The model
denoises new frames anchored by the low-amplitude context, producing
quieter audio in every scene after the first.

After sampling each continuation scene, measure the RMS of the overlap
audio frames (known good amplitude from previous scene) and the RMS of
the newly generated frames. If the discrepancy is >10%, rescale the new
frames to match the overlap RMS before blending.

Scene 1 is unaffected (no overlap, no adjustment). Video latents are
never touched.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-22 20:41:10 +03:00
digital-garbageandClaude Sonnet 4.6 0a5875b1b4 Gate attention anchor injection to early high-sigma steps
Injection from blessed maps (Perfect/Loved it runs) at blocks 14 and 19
now concentrates in the anatomy/physics formation phase:
- sigma >= 0.5: full inject_strength (early structure steps)
- 0.2 <= sigma < 0.5: linear fade to zero
- sigma < 0.2: no injection (detail refinement phase, leave alone)

A lightweight sigma_tracker wrapper updates shared sigma_state before
each model call so block replacements always have the current timestep.
The tracker is only installed when blessed maps exist (zero overhead
otherwise).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-22 20:31:00 +03:00
digital-garbageandClaude Sonnet 4.6 6836db202b Bump version to 2.7.2 in pyproject.toml
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-22 19:58:27 +03:00
digital-garbageandClaude Sonnet 4.6 f90dec7780 Release 2.7.2
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-22 19:57:48 +03:00
digital-garbageandClaude Sonnet 4.6 223e60e832 Add silent transition placement - split without outputting the trigger
New placement option 'silent': the transition phrase marks the scene
boundary but is stripped from the output entirely. Neither the previous
nor the next segment contains it. Available globally and as a per-entry
override on custom transitions.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-22 19:38:29 +03:00
digital-garbageandClaude Sonnet 4.6 239d5a763e Fix custom transition triggers ending with punctuation not matching
Trailing \b after a non-word character (like '.') never matches since
\b requires a word char on one side. Custom triggers ending with
punctuation now use (?=\s|$) as the end boundary instead, so
"Scene cut." correctly splits prompts.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-22 19:11:57 +03:00
digital-garbageandClaude Sonnet 4.6 5e1aa4a6c3 Add transition placement control (start/end of segment)
- Global setting in Studio Refiner tab: "Transition placement" (start/end).
  start = transition opens the new segment (existing default behavior).
  end = transition closes the previous segment instead.
- Per-entry placement override in Transitions tab (global/start/end).
  Custom transitions can pin their placement regardless of the global setting.
- transition items gain a placement field (global/start/end, defaults to global).
- load_custom_transition_triggers returns {trigger_lower: placement|None} so
  the split function can do per-trigger lookups efficiently.
- refine_v2 and Studio.run() wired with split_transition_placement parameter.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-22 19:10:13 +03:00
digital-garbageandClaude Sonnet 4.6 8063566aba Fix _GENERIC_SCENE_LABEL_PATTERN matching scene as noun
The [a-z][\w-]* alternative matched any word after "scene", turning
"scene proceeds", "scene features", "scene shows" etc. into false
transition split points. Removed the over-broad alternative - the
pattern now only matches numbered scenes (scene 1, scene -2) and
"scene minus <label>" forms.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-22 19:00:45 +03:00
digital-garbageandClaude Sonnet 4.6 39dba21f9f Remove single-word transition markers from builtin list
Single words like "next", "suddenly", "later", "finally" etc. fire on
normal prompt text and cause spurious scene splits. Removed the entire
single-word temporal markers block. Shortest triggers are now two words
minimum. Also removes "and suddenly" and "and next" which were similarly
too vague.

Stray article-comma cleanup ("the, next" -> "the next") also applied when
building transition segments to handle commas left by the split.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-22 18:45:29 +03:00
digital-garbageandClaude Sonnet 4.6 9b8948dc77 Fix stray comma after article in merged transition segments
When the stacking fix merges a pure-transition segment into the next one,
it now uses a space instead of ", " if the segment ends with an article
(a/an/the). This prevents "the scene then cuts to the, next view" when
"next" is also a transition word and the segments get merged mid-phrase.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-22 18:43:11 +03:00
digital-garbageandClaude Sonnet 4.6 28eabefe51 Drop dangling trailing transition segments with no real content
If a prompt ends with a transition phrase plus nothing (or just a lone
article like "the"), the last segment is now dropped rather than kept
as a near-empty scene. Covers cases like "...K/DA Kai'Sa, the scene
then cuts to the" where the user did not complete the transition.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-22 18:34:06 +03:00
digital-garbageandClaude Sonnet 4.6 acdc4c41d6 Collapsible shortcut/transition rows, optional replacement, name fallback
- Shortcuts and Transitions: saved entries collapse to a summary row (name +
  on/off badge); click to expand, Collapse button to close without saving
- Transition summary also shows trigger phrase in italic next to the name
- Shortcuts: replacement is no longer required; blank/missing defaults to [""]
  which removes the matched phrase (same as explicit empty replacement)
- Shortcuts: name falls back to first activation word when left blank
- New summary row CSS: badge-on/badge-off, label, trigger styles

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-22 18:16:59 +03:00
digital-garbageandClaude Sonnet 4.6 889e4dc2c8 Add shortcuts empty replacement, custom transitions, and longer-phrase-wins tests
- Shortcuts: allow empty string as a valid replacement to remove matched phrases
  from prompts; post-pass cleans up orphaned commas/spaces left by removals
- Shortcuts: add cross-shortcut longer-phrase-wins test confirming ordered
  alternation handles multiple shortcuts with overlapping triggers correctly
- Transitions: new user-editable transition word list stored in transitions.json;
  custom triggers extend the built-in split pattern at runtime, keyed by name
- Transitions: Studio JS gets a dedicated Transitions tab (name, trigger, enabled)
  with Add/Refresh/Import/Export toolbar
- Transitions: four API routes mirroring shortcuts (GET, export, save/delete, import)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-22 17:47:55 +03:00
digital-garbage 3434d1efa2 Add global scene shortcuts 2026-05-22 16:38:33 +03:00