// Stage2 six-section prompt assembler (dev-plan.md T7; template source of // truth: docs/todo/dressup-dance-room-mvcp.md M.15, one-step version // confirmed by the S1 spike). Includes the footwear fix M.15 flagged as // still outstanding ("her footwear... is retained unchanged" / "does not // affect her footwear") so the same "shoes self-selected" drift the S1 // spike hit doesn't recur. const MAX_DESCRIPTOR_WORDS = 40; // ~2-3 concrete features, per docs/h3skill.md's own guidance const DETAILED_DESCRIPTION_MAX_WORDS = 500; // H6 function words(text) { return text.trim().split(/\s+/).filter(Boolean); } function truncateWords(text, maxWords) { const w = words(text); return w.length <= maxWords ? text.trim() : w.slice(0, maxWords).join(" "); } function wordCount(text) { return words(text).length; } function extractSection(prompt, name, nextName) { const re = new RegExp(`^${name}:\\n([\\s\\S]*?)\\n\\n${nextName}:`, "m"); const match = prompt.match(re); return match ? match[1] : ""; } function render({ appearanceDescriptor, garmentDescriptor, motionDescriptor }) { return `subject_definitions: is the young woman whose visual identity is defined by : ${appearanceDescriptor}. Preserve her face, hairstyle, and body exactly as shown; only her outfit, pose, motion, and framing change in the target video. is the character reference frame for , showing her face, hairstyle, and body in a neutral standing pose, wearing a neutral outfit that does not appear in the target video; her footwear as shown here is retained unchanged in the target video. is the garment reference image: ${garmentDescriptor}, laid flat with no person wearing it. Only its garment attributes (silhouette, color, fabric, trim, cut) transfer onto ; no other content of this image appears in the target video, and it does not affect her footwear.