Builds on #54 loosely (seed/steps help); primarily an orchestration + caching feature over /api/generate.
Problem
A pad takes ~1.5 s (small DiT, ADR-0012) and queues behind the single-slot _generation_lock (backend/lsdj/sa3.py:59) when the booth is busy — too slow to drop on the beat. Performers want to fire a fresh AI loop instantly, the way they fire a hot cue. The fix is to generate ahead of need: keep a warm crate of pads in the chosen palette ready to drop.
Proposed approach
A background pre-generation queue: given a palette/prompt (and #54's seed for variety), generate N candidate pads during idle time into a "fresh crate" the performer can audition and fire instantly; refill as they are consumed. Expose --steps (today fixed at 8, sa3.py:21) as a fast-preview ↔ final quality knob so previews are cheap and the kept one can be re-rendered at full steps. Respect the serialization: pre-gen yields to on-demand generation so a live request never waits behind speculation.
Acceptance criteria
- With a palette set, a crate of ready pads fills in the background; firing one is instant (no generation wait).
- On-demand generation always preempts speculative work — a live request never queues behind the crate refill.
- A steps/quality knob trades preview speed for final fidelity; the kept pad can be finalized at full steps.
- The crate's memory/disk is bounded and its contents are auditable; strings via i18n; house style;
npx tsc -p tsconfig.app.json --noEmit clean.
Scope & non-goals
In scope: background pre-generation, the fresh-crate UI, the steps knob, preemption. Non-goals: changing the single-slot generation model (still one CLI at a time); persistent libraries (ADR-0022 already covers saving); palette construction (the palette issue).
Builds on #54 loosely (seed/steps help); primarily an orchestration + caching feature over
/api/generate.Problem
A pad takes ~1.5 s (small DiT, ADR-0012) and queues behind the single-slot
_generation_lock(backend/lsdj/sa3.py:59) when the booth is busy — too slow to drop on the beat. Performers want to fire a fresh AI loop instantly, the way they fire a hot cue. The fix is to generate ahead of need: keep a warm crate of pads in the chosen palette ready to drop.Proposed approach
A background pre-generation queue: given a palette/prompt (and #54's seed for variety), generate N candidate pads during idle time into a "fresh crate" the performer can audition and fire instantly; refill as they are consumed. Expose
--steps(today fixed at 8,sa3.py:21) as a fast-preview ↔ final quality knob so previews are cheap and the kept one can be re-rendered at full steps. Respect the serialization: pre-gen yields to on-demand generation so a live request never waits behind speculation.Acceptance criteria
npx tsc -p tsconfig.app.json --noEmitclean.Scope & non-goals
In scope: background pre-generation, the fresh-crate UI, the steps knob, preemption. Non-goals: changing the single-slot generation model (still one CLI at a time); persistent libraries (ADR-0022 already covers saving); palette construction (the palette issue).