@nodaro/prompts 1.46.0 → 1.48.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{catalog-packs-C9CXEWfl.d.cts → catalog-packs-BDsrv8St.d.cts} +1 -1
- package/dist/{catalog-packs-D7NJpo4k.d.ts → catalog-packs-CAK42voB.d.ts} +1 -1
- package/dist/{chunk-SMKIVT7P.js → chunk-36XMRVY4.js} +4 -4
- package/dist/{chunk-SMKIVT7P.js.map → chunk-36XMRVY4.js.map} +1 -1
- package/dist/{chunk-JHEZJKTX.cjs → chunk-54BYDWAM.cjs} +62 -52
- package/dist/chunk-54BYDWAM.cjs.map +1 -0
- package/dist/{chunk-IKHRZ5UQ.js → chunk-BTV2I7EN.js} +3 -3
- package/dist/{chunk-IKHRZ5UQ.js.map → chunk-BTV2I7EN.js.map} +1 -1
- package/dist/{chunk-57PTYJJX.js → chunk-CMEUYFBZ.js} +13 -13
- package/dist/chunk-CMEUYFBZ.js.map +1 -0
- package/dist/{chunk-2OIKQ4WB.js → chunk-GZVCBSFG.js} +5 -5
- package/dist/{chunk-2OIKQ4WB.js.map → chunk-GZVCBSFG.js.map} +1 -1
- package/dist/{chunk-FCTK7RGO.cjs → chunk-IMQB7GIK.cjs} +42 -39
- package/dist/chunk-IMQB7GIK.cjs.map +1 -0
- package/dist/{chunk-2HJJBXGA.js → chunk-JHRVNWBS.js} +6 -6
- package/dist/{chunk-2HJJBXGA.js.map → chunk-JHRVNWBS.js.map} +1 -1
- package/dist/{chunk-OSKABA64.cjs → chunk-JV2WSMAA.cjs} +8 -8
- package/dist/{chunk-OSKABA64.cjs.map → chunk-JV2WSMAA.cjs.map} +1 -1
- package/dist/{chunk-VAK4RUNU.cjs → chunk-KNAKOSKV.cjs} +13 -13
- package/dist/{chunk-VAK4RUNU.cjs.map → chunk-KNAKOSKV.cjs.map} +1 -1
- package/dist/{chunk-TXHFL725.js → chunk-LD47QOKS.js} +62 -53
- package/dist/chunk-LD47QOKS.js.map +1 -0
- package/dist/{chunk-QKD2KUZW.cjs → chunk-MGK6SFTV.cjs} +20 -6
- package/dist/chunk-MGK6SFTV.cjs.map +1 -0
- package/dist/{chunk-YCCQXX3U.cjs → chunk-MYVJVOPB.cjs} +39 -39
- package/dist/{chunk-YCCQXX3U.cjs.map → chunk-MYVJVOPB.cjs.map} +1 -1
- package/dist/{chunk-PHR4UETI.cjs → chunk-PJFX3MFI.cjs} +18 -18
- package/dist/{chunk-PHR4UETI.cjs.map → chunk-PJFX3MFI.cjs.map} +1 -1
- package/dist/{chunk-PUWJ2ZBG.js → chunk-RRHU6MD5.js} +20 -6
- package/dist/chunk-RRHU6MD5.js.map +1 -0
- package/dist/{chunk-NN4FL7SB.js → chunk-XBRW75LM.js} +4 -4
- package/dist/{chunk-NN4FL7SB.js.map → chunk-XBRW75LM.js.map} +1 -1
- package/dist/{chunk-C4FDHCEZ.cjs → chunk-XGNUOU4F.cjs} +125 -125
- package/dist/{chunk-C4FDHCEZ.cjs.map → chunk-XGNUOU4F.cjs.map} +1 -1
- package/dist/{chunk-CPKYIVWP.js → chunk-YXJSPQC6.js} +12 -9
- package/dist/chunk-YXJSPQC6.js.map +1 -0
- package/dist/{chunk-OY7XOPDG.cjs → chunk-Z755PH3K.cjs} +57 -57
- package/dist/chunk-Z755PH3K.cjs.map +1 -0
- package/dist/entries/assembly.cjs +28 -28
- package/dist/entries/assembly.d.cts +1 -2
- package/dist/entries/assembly.d.ts +1 -2
- package/dist/entries/assembly.js +5 -5
- package/dist/entries/catalog-packs.d.cts +3 -3
- package/dist/entries/catalog-packs.d.ts +3 -3
- package/dist/entries/person.d.cts +2 -2
- package/dist/entries/person.d.ts +2 -2
- package/dist/entries/picker-catalogs.cjs +56 -56
- package/dist/entries/picker-catalogs.d.cts +26 -4
- package/dist/entries/picker-catalogs.d.ts +26 -4
- package/dist/entries/picker-catalogs.js +4 -4
- package/dist/entries/pickers.cjs +377 -373
- package/dist/entries/pickers.d.cts +473 -2
- package/dist/entries/pickers.d.ts +473 -2
- package/dist/entries/pickers.js +2 -2
- package/dist/entries/presets.cjs +35 -35
- package/dist/entries/presets.js +1 -1
- package/dist/entries/prompt-builder.cjs +75 -75
- package/dist/entries/prompt-builder.d.cts +2 -3
- package/dist/entries/prompt-builder.d.ts +2 -3
- package/dist/entries/prompt-builder.js +4 -4
- package/dist/index.cjs +564 -560
- package/dist/index.d.cts +5 -6
- package/dist/index.d.ts +5 -6
- package/dist/index.js +9 -9
- package/dist/{picker-catalogs-C3utGMRB.d.cts → picker-catalogs-BiRCs_5G.d.cts} +8 -0
- package/dist/{picker-catalogs-BM8IphF1.d.ts → picker-catalogs-CX8pHi8q.d.ts} +8 -0
- package/dist/{subject-registry-DFiGx49v.d.ts → subject-registry-Cf802LQ5.d.ts} +8 -4
- package/dist/{subject-registry-CQi_CZfJ.d.cts → subject-registry-D2uMBVpP.d.cts} +8 -4
- package/package.json +2 -2
- package/src/__tests__/assemble-video-input.test.ts +13 -11
- package/src/__tests__/direction-registry.test.ts +5 -5
- package/src/__tests__/factory-presets.test.ts +26 -2
- package/src/__tests__/image-unwired-reference-tokens.test.ts +3 -2
- package/src/__tests__/prompt-style-section.test.ts +2 -2
- package/src/__tests__/style-video-wording.test.ts +258 -0
- package/src/catalog-overlay.ts +15 -1
- package/src/direction-registry.ts +25 -7
- package/src/factory-presets/generate-image.ts +18 -4
- package/src/parameter-prompt-hint.ts +23 -7
- package/src/picker-catalogs.ts +11 -0
- package/src/style.ts +78 -49
- package/dist/chunk-57PTYJJX.js.map +0 -1
- package/dist/chunk-CPKYIVWP.js.map +0 -1
- package/dist/chunk-FCTK7RGO.cjs.map +0 -1
- package/dist/chunk-JHEZJKTX.cjs.map +0 -1
- package/dist/chunk-OY7XOPDG.cjs.map +0 -1
- package/dist/chunk-PUWJ2ZBG.js.map +0 -1
- package/dist/chunk-QKD2KUZW.cjs.map +0 -1
- package/dist/chunk-TXHFL725.js.map +0 -1
- package/dist/transitions-BLFfAJUH.d.cts +0 -450
- package/dist/transitions-BgwWM37i.d.ts +0 -450
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunk54BYDWAM_cjs = require('./chunk-54BYDWAM.cjs');
|
|
4
4
|
var catalogs = require('@nodaro/shared/catalogs');
|
|
5
5
|
|
|
6
6
|
var WARDROBE_DIMENSION_ORDER = [
|
|
@@ -169,11 +169,11 @@ function getCharacterMotionDiagnostics(value, timing, bindings = {}) {
|
|
|
169
169
|
const requested = typeof value === "string" ? [value] : Array.isArray(value) ? [...new Set(value)] : [];
|
|
170
170
|
const result = [];
|
|
171
171
|
const add = (code, severity, ids, message) => result.push({ code, severity, ids, message });
|
|
172
|
-
if (requested.length >
|
|
173
|
-
const picks = requested.slice(0,
|
|
174
|
-
for (const id of picks) if (!
|
|
172
|
+
if (requested.length > chunk54BYDWAM_cjs.CHARACTER_MOTION_MAX_PICKS) add("capacity", "warning", requested, "Only the first three selections contribute. Remove extra selections.");
|
|
173
|
+
const picks = requested.slice(0, chunk54BYDWAM_cjs.CHARACTER_MOTION_MAX_PICKS);
|
|
174
|
+
for (const id of picks) if (!chunk54BYDWAM_cjs.getCharacterMotion(id)) add("unknown", "error", [id], `Motion \u201C${id}\u201D is unavailable and contributes no fragment. Remove or replace it.`);
|
|
175
175
|
const entries = picks.flatMap((id) => {
|
|
176
|
-
const entry =
|
|
176
|
+
const entry = chunk54BYDWAM_cjs.getCharacterMotion(id);
|
|
177
177
|
return entry?.promptHint ? [entry] : [];
|
|
178
178
|
});
|
|
179
179
|
const active = entries.filter((e) => !bindings.subjectMinor || !e.adultOnly);
|
|
@@ -182,7 +182,7 @@ function getCharacterMotionDiagnostics(value, timing, bindings = {}) {
|
|
|
182
182
|
if (omitted.length) add("omitted", active.length ? "warning" : "error", omitted.map((e) => e.id), `${omitted.map((e) => e.label).join(", ")} omitted for a connected minor. ${active.length ? "Replace these selections." : "No selected motion contributes a fragment."}`);
|
|
183
183
|
if ((bindings.targetNames?.length ?? 0) > 1) add("multiple-targets", "warning", picks, "Each target performs a separate copy of the sequence. Use separate motion nodes for coordinated choreography.");
|
|
184
184
|
for (const entry of active) {
|
|
185
|
-
if (entry.deprecated) add("retired", "warning", [entry.id], `${entry.label} is retired from new choices but still resolves in saved workflows.${entry.replacementId ? ` Use ${
|
|
185
|
+
if (entry.deprecated) add("retired", "warning", [entry.id], `${entry.label} is retired from new choices but still resolves in saved workflows.${entry.replacementId ? ` Use ${chunk54BYDWAM_cjs.getCharacterMotion(entry.replacementId)?.label ?? entry.replacementId}.` : ""}`);
|
|
186
186
|
if (entry.fixedPace && timing?.pace && timing.pace !== "auto") add("pace", "warning", [entry.id], `${entry.label} sets its own timing. Set Pace to Auto or replace the motion.`);
|
|
187
187
|
if (entry.requires?.length) add("requirements", "info", [entry.id], `${entry.label} requires: ${entry.requires.join(", ")}.${entry.twoPerson || entry.counterpart ? bindings.partnerNames?.length ? ` Partner reference: ${bindings.partnerNames.join(", ")}; confirm it matches the required recipient.` : " Connect a Partner reference to identify the recipient; otherwise the model chooses it." : " Establish these in the scene or prompt; the fragment does not supply reference media."}`);
|
|
188
188
|
}
|
|
@@ -206,5 +206,5 @@ exports.getCharacterMotionDiagnostics = getCharacterMotionDiagnostics;
|
|
|
206
206
|
exports.getWardrobeEntriesByDimension = getWardrobeEntriesByDimension;
|
|
207
207
|
exports.getWardrobeEntry = getWardrobeEntry;
|
|
208
208
|
exports.getWardrobePromptHint = getWardrobePromptHint;
|
|
209
|
-
//# sourceMappingURL=chunk-
|
|
210
|
-
//# sourceMappingURL=chunk-
|
|
209
|
+
//# sourceMappingURL=chunk-JV2WSMAA.cjs.map
|
|
210
|
+
//# sourceMappingURL=chunk-JV2WSMAA.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/wardrobe.ts","../src/character-motion-diagnostics.ts"],"names":["id","pickIds","h","CHARACTER_MOTION_MAX_PICKS","getC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AA;AACpK,IAAA,IAAI,MAAA,CAAO,OAAA,IAAW,KAAA,CAAM,SAAA,IAAa,MAAA,CAAO,OAAA,KAAY,KAAA,IAAS,KAAA,CAAM,SAAA,KAAc,KAAA,IAAS,MAAA,CAAO,OAAA,KAAY,MAAM,SAAA,EAAW,GAAA,CAAI,MAAA,EAAQ,SAAA,EAAW,GAAA,EAAK,CAAA,EAAG,MAAA,CAAO,KAAK,CAAA,MAAA,EAAS,MAAA,CAAO,OAAO,CAAA,EAAA,EAAK,KAAA,CAAM,KAAK,CAAA,QAAA,EAAW,KAAA,CAAM,SAAS,CAAA,uCAAA,CAAyC,CAAA;AAC3R,IAAA,IAAI,OAAO,UAAA,IAAc,MAAA,CAAO,UAAA,KAAe,MAAA,IAAU,MAAM,cAAA,EAAgB,GAAA,CAAI,OAAA,EAAS,SAAA,EAAW,KAAK,CAAA,EAAG,MAAA,CAAO,KAAK,CAAA,wBAAA,EAA2B,KAAA,CAAM,KAAK,CAAA,uCAAA,CAAyC,CAAA;AAAA,EAC5M;AACA,EAAA,MAAM,WAAW,MAAA,CAAO,MAAA,CAAO,CAAA,CAAA,KAAK,CAAA,CAAE,SAAS,UAAU,CAAA;AACzD,EAAA,IAAI,QAAA,CAAS,QAAQ,GAAA,CAAI,UAAA,EAAY,WAAW,QAAA,CAAS,GAAA,CAAI,OAAK,CAAA,CAAE,EAAE,GAAG,CAAA,EAAG,QAAA,CAAS,MAAM,CAAA,UAAA,EAAa,QAAA,CAAS,WAAW,CAAA,GAAI,KAAA,GAAQ,OAAO,CAAA,0GAAA,CAA4G,CAAA;AAC3P,EAAA,OAAO,MAAA;AACT","file":"chunk-OSKABA64.cjs","sourcesContent":["import { pickIds } from \"@nodaro/shared/catalogs\"\n\nexport type WardrobeDimension =\n | \"archetype\" | \"top\" | \"bottom\" | \"outerwear\" | \"footwear\"\n | \"headwear\" | \"accessories\" | \"color-palette\" | \"material\" | \"era\"\n\nexport interface WardrobeEntry {\n readonly id: string\n readonly label: string\n readonly dimension: WardrobeDimension\n readonly promptHint: string\n}\n\nexport interface WardrobeValue {\n archetype?: string\n top?: string\n bottom?: string\n outerwear?: string\n footwear?: string\n headwear?: string | ReadonlyArray<string>\n accessories?: string | ReadonlyArray<string>\n colorPalette?: string\n material?: string\n era?: string\n}\n\nexport const WARDROBE_DIMENSION_ORDER: ReadonlyArray<WardrobeDimension> = [\n \"archetype\", \"top\", \"bottom\", \"outerwear\", \"footwear\",\n \"headwear\", \"accessories\", \"color-palette\", \"material\", \"era\",\n]\n\nexport const WARDROBE_CATEGORY_LABELS: Readonly<Record<WardrobeDimension, string>> = {\n archetype: \"Archetype\", top: \"Top\", bottom: \"Bottom\", outerwear: \"Outerwear\",\n footwear: \"Footwear\", headwear: \"Headwear\", accessories: \"Accessories\",\n \"color-palette\": \"Color Palette\", material: \"Material\", era: \"Era\",\n}\n\nexport const WARDROBE_FIELD_BY_DIMENSION: Record<WardrobeDimension, keyof WardrobeValue> = {\n archetype: \"archetype\", top: \"top\", bottom: \"bottom\", outerwear: \"outerwear\",\n footwear: \"footwear\", headwear: \"headwear\", accessories: \"accessories\",\n \"color-palette\": \"colorPalette\", material: \"material\", era: \"era\",\n}\n\n/** Multi-pick dims emit each picked entry independently. */\nconst MULTI_PICK: ReadonlySet<WardrobeDimension> = new Set([\"headwear\", \"accessories\"])\n/** Sentinel ids that mean \"nothing here\" and emit no hint. */\nconst NONE_IDS: ReadonlySet<string> = new Set([\"wd-outer-none\"])\n\nexport const WARDROBE: ReadonlyArray<WardrobeEntry> = [\n // archetype\n { id: \"wd-casual\", label: \"Casual\", dimension: \"archetype\", promptHint: \"in casual everyday clothing\" },\n { id: \"wd-business\", label: \"Business\", dimension: \"archetype\", promptHint: \"in smart business attire\" },\n { id: \"wd-formal\", label: \"Formal\", dimension: \"archetype\", promptHint: \"in elegant formal wear\" },\n { id: \"wd-streetwear\", label: \"Streetwear\", dimension: \"archetype\", promptHint: \"in contemporary streetwear\" },\n { id: \"wd-athletic\", label: \"Athletic\", dimension: \"archetype\", promptHint: \"in athletic sportswear\" },\n { id: \"wd-fantasy\", label: \"Fantasy\", dimension: \"archetype\", promptHint: \"in fantasy costume\" },\n { id: \"wd-scifi\", label: \"Sci-Fi\", dimension: \"archetype\", promptHint: \"in futuristic sci-fi attire\" },\n { id: \"wd-historical\", label: \"Historical\", dimension: \"archetype\", promptHint: \"in period historical dress\" },\n { id: \"wd-uniform\", label: \"Uniform\", dimension: \"archetype\", promptHint: \"in a uniform\" },\n { id: \"wd-loungewear\", label: \"Loungewear\", dimension: \"archetype\", promptHint: \"in relaxed loungewear\" },\n // top\n { id: \"wd-tshirt\", label: \"T-Shirt\", dimension: \"top\", promptHint: \"wearing a t-shirt\" },\n { id: \"wd-blouse\", label: \"Blouse\", dimension: \"top\", promptHint: \"wearing a blouse\" },\n { id: \"wd-hoodie\", label: \"Hoodie\", dimension: \"top\", promptHint: \"wearing a hoodie\" },\n { id: \"wd-buttondown\", label: \"Button-down\", dimension: \"top\", promptHint: \"wearing a button-down shirt\" },\n { id: \"wd-tank\", label: \"Tank\", dimension: \"top\", promptHint: \"wearing a tank top\" },\n { id: \"wd-sweater\", label: \"Sweater\", dimension: \"top\", promptHint: \"wearing a sweater\" },\n { id: \"wd-turtleneck\", label: \"Turtleneck\", dimension: \"top\", promptHint: \"wearing a turtleneck\" },\n // bottom\n { id: \"wd-jeans\", label: \"Jeans\", dimension: \"bottom\", promptHint: \"wearing jeans\" },\n { id: \"wd-trousers\", label: \"Trousers\", dimension: \"bottom\", promptHint: \"wearing tailored trousers\" },\n { id: \"wd-skirt\", label: \"Skirt\", dimension: \"bottom\", promptHint: \"wearing a skirt\" },\n { id: \"wd-shorts\", label: \"Shorts\", dimension: \"bottom\", promptHint: \"wearing shorts\" },\n { id: \"wd-leggings\", label: \"Leggings\", dimension: \"bottom\", promptHint: \"wearing leggings\" },\n { id: \"wd-cargo\", label: \"Cargo\", dimension: \"bottom\", promptHint: \"wearing cargo pants\" },\n // outerwear\n { id: \"wd-outer-none\", label: \"None\", dimension: \"outerwear\", promptHint: \"\" },\n { id: \"wd-leatherjkt\", label: \"Leather Jacket\", dimension: \"outerwear\", promptHint: \"in a leather jacket\" },\n { id: \"wd-blazer\", label: \"Blazer\", dimension: \"outerwear\", promptHint: \"in a blazer\" },\n { id: \"wd-trench\", label: \"Trench Coat\", dimension: \"outerwear\", promptHint: \"in a trench coat\" },\n { id: \"wd-parka\", label: \"Parka\", dimension: \"outerwear\", promptHint: \"in a parka\" },\n { id: \"wd-cloak\", label: \"Cloak\", dimension: \"outerwear\", promptHint: \"in a flowing cloak\" },\n { id: \"wd-denimjkt\", label: \"Denim Jacket\", dimension: \"outerwear\", promptHint: \"in a denim jacket\" },\n { id: \"wd-cardigan\", label: \"Cardigan\", dimension: \"outerwear\", promptHint: \"in a cardigan\" },\n // footwear\n { id: \"wd-sneakers\", label: \"Sneakers\", dimension: \"footwear\", promptHint: \"wearing sneakers\" },\n { id: \"wd-boots\", label: \"Boots\", dimension: \"footwear\", promptHint: \"wearing boots\" },\n { id: \"wd-heels\", label: \"Heels\", dimension: \"footwear\", promptHint: \"wearing heels\" },\n { id: \"wd-sandals\", label: \"Sandals\", dimension: \"footwear\", promptHint: \"wearing sandals\" },\n { id: \"wd-dressshoe\", label: \"Dress Shoes\", dimension: \"footwear\", promptHint: \"wearing dress shoes\" },\n { id: \"wd-barefoot\", label: \"Barefoot\", dimension: \"footwear\", promptHint: \"barefoot\" },\n // headwear (multi)\n { id: \"wd-cap\", label: \"Cap\", dimension: \"headwear\", promptHint: \"wearing a cap\" },\n { id: \"wd-beanie\", label: \"Beanie\", dimension: \"headwear\", promptHint: \"wearing a beanie\" },\n { id: \"wd-widehat\", label: \"Wide-brim Hat\", dimension: \"headwear\", promptHint: \"wearing a wide-brim hat\" },\n { id: \"wd-hood\", label: \"Hood\", dimension: \"headwear\", promptHint: \"with the hood up\" },\n { id: \"wd-crown\", label: \"Crown\", dimension: \"headwear\", promptHint: \"wearing a crown\" },\n { id: \"wd-helmet\", label: \"Helmet\", dimension: \"headwear\", promptHint: \"wearing a helmet\" },\n // accessories (multi)\n { id: \"wd-glasses\", label: \"Glasses\", dimension: \"accessories\", promptHint: \"wearing glasses\" },\n { id: \"wd-sunglasses\", label: \"Sunglasses\", dimension: \"accessories\", promptHint: \"wearing sunglasses\" },\n { id: \"wd-scarf\", label: \"Scarf\", dimension: \"accessories\", promptHint: \"wearing a scarf\" },\n { id: \"wd-gloves\", label: \"Gloves\", dimension: \"accessories\", promptHint: \"wearing gloves\" },\n { id: \"wd-jewelry\", label: \"Jewelry\", dimension: \"accessories\", promptHint: \"wearing statement jewelry\" },\n { id: \"wd-belt\", label: \"Belt\", dimension: \"accessories\", promptHint: \"with a belt\" },\n { id: \"wd-watch\", label: \"Watch\", dimension: \"accessories\", promptHint: \"wearing a watch\" },\n // color-palette\n { id: \"wd-neutral\", label: \"Neutral\", dimension: \"color-palette\", promptHint: \"in a neutral color palette\" },\n { id: \"wd-all-black\", label: \"All Black\", dimension: \"color-palette\", promptHint: \"in an all-black palette\" },\n { id: \"wd-earth\", label: \"Earth Tones\", dimension: \"color-palette\", promptHint: \"in earth-tone colors\" },\n { id: \"wd-pastel\", label: \"Pastel\", dimension: \"color-palette\", promptHint: \"in pastel colors\" },\n { id: \"wd-jewel\", label: \"Jewel Tones\", dimension: \"color-palette\", promptHint: \"in rich jewel-tone colors\" },\n { id: \"wd-neon\", label: \"Neon\", dimension: \"color-palette\", promptHint: \"in vivid neon colors\" },\n { id: \"wd-all-white\", label: \"All White\", dimension: \"color-palette\", promptHint: \"in an all-white palette\" },\n // material\n { id: \"wd-cotton\", label: \"Cotton\", dimension: \"material\", promptHint: \"in cotton fabric\" },\n { id: \"wd-denim\", label: \"Denim\", dimension: \"material\", promptHint: \"in denim\" },\n { id: \"wd-leather\", label: \"Leather\", dimension: \"material\", promptHint: \"in leather\" },\n { id: \"wd-silk\", label: \"Silk\", dimension: \"material\", promptHint: \"in silk\" },\n { id: \"wd-wool\", label: \"Wool\", dimension: \"material\", promptHint: \"in wool\" },\n { id: \"wd-latex\", label: \"Latex\", dimension: \"material\", promptHint: \"in latex\" },\n { id: \"wd-linen\", label: \"Linen\", dimension: \"material\", promptHint: \"in linen\" },\n // era\n { id: \"wd-contemporary\", label: \"Contemporary\", dimension: \"era\", promptHint: \"in contemporary fashion\" },\n { id: \"wd-1920s\", label: \"1920s\", dimension: \"era\", promptHint: \"in 1920s fashion\" },\n { id: \"wd-1950s\", label: \"1950s\", dimension: \"era\", promptHint: \"in 1950s fashion\" },\n { id: \"wd-1980s\", label: \"1980s\", dimension: \"era\", promptHint: \"in 1980s fashion\" },\n { id: \"wd-victorian\", label: \"Victorian\", dimension: \"era\", promptHint: \"in Victorian-era dress\" },\n { id: \"wd-medieval\", label: \"Medieval\", dimension: \"era\", promptHint: \"in medieval dress\" },\n { id: \"wd-futuristic\", label: \"Futuristic\", dimension: \"era\", promptHint: \"in futuristic clothing\" },\n] as const\n\nconst BY_ID: Map<string, WardrobeEntry> = new Map(WARDROBE.map((e) => [e.id, e]))\n\n/** Entries grouped by dimension — precomputed once so per-dimension lookups\n * (the picker calls one per dimension per render) are O(1) with stable array\n * refs, instead of a full WARDROBE scan each call. */\nconst BY_DIMENSION: Map<WardrobeDimension, WardrobeEntry[]> = (() => {\n const map = new Map<WardrobeDimension, WardrobeEntry[]>()\n for (const e of WARDROBE) {\n const list = map.get(e.dimension)\n if (list) list.push(e)\n else map.set(e.dimension, [e])\n }\n return map\n})()\n\nexport function getWardrobeEntry(id: string | undefined | null): WardrobeEntry | undefined {\n return id ? BY_ID.get(id) : undefined\n}\n\nexport function getWardrobePromptHint(id: string | undefined | null): string {\n return getWardrobeEntry(id)?.promptHint ?? \"\"\n}\n\nexport function getWardrobeEntriesByDimension(dim: WardrobeDimension): WardrobeEntry[] {\n return BY_DIMENSION.get(dim) ?? []\n}\n\nexport function buildWardrobeHints(value: Record<string, unknown> & WardrobeValue): string[] {\n const hints: string[] = []\n for (const dimension of WARDROBE_DIMENSION_ORDER) {\n const field = WARDROBE_FIELD_BY_DIMENSION[dimension]\n const raw = value[field]\n if (MULTI_PICK.has(dimension)) {\n for (const id of pickIds(raw)) {\n if (NONE_IDS.has(id)) continue\n const h = getWardrobePromptHint(id)\n if (h) hints.push(h)\n }\n continue\n }\n const id = typeof raw === \"string\" ? raw : undefined\n if (!id || NONE_IDS.has(id)) continue\n const h = getWardrobePromptHint(id)\n if (h) hints.push(h)\n }\n return hints\n}\n","import { getCharacterMotion, CHARACTER_MOTION_MAX_PICKS, type CharacterMotionTiming } from \"./character-motion.js\"\n\nexport interface CharacterMotionDiagnostic {\n readonly code: \"unknown\" | \"omitted\" | \"retired\" | \"pose\" | \"visibility\" | \"hands\" | \"pace\" | \"requirements\" | \"compound\" | \"capacity\" | \"multiple-targets\" | \"roles\"\n readonly severity: \"error\" | \"warning\" | \"info\"\n readonly ids: readonly string[]\n readonly message: string\n}\nexport interface CharacterMotionBindings {\n readonly selfPairing?: boolean\n readonly subjectMinor?: boolean\n readonly partnerNames?: readonly string[]\n readonly targetNames?: readonly string[]\n}\n\n/** Shared by editor, API clients and local review. Missing metadata means\n * unknown; this never certifies a sequence or predicts clip duration. */\nexport function getCharacterMotionDiagnostics(\n value: string | readonly string[] | null | undefined,\n timing?: CharacterMotionTiming,\n bindings: CharacterMotionBindings = {},\n): readonly CharacterMotionDiagnostic[] {\n const requested = typeof value === \"string\" ? [value] : Array.isArray(value) ? [...new Set(value)] : []\n const result: CharacterMotionDiagnostic[] = []\n const add = (code: CharacterMotionDiagnostic[\"code\"], severity: CharacterMotionDiagnostic[\"severity\"], ids: readonly string[], message: string) => result.push({ code, severity, ids, message })\n if (requested.length > CHARACTER_MOTION_MAX_PICKS) add(\"capacity\", \"warning\", requested, \"Only the first three selections contribute. Remove extra selections.\")\n const picks = requested.slice(0, CHARACTER_MOTION_MAX_PICKS)\n for (const id of picks) if (!getCharacterMotion(id)) add(\"unknown\", \"error\", [id], `Motion “${id}” is unavailable and contributes no fragment. Remove or replace it.`)\n const entries = picks.flatMap(id => { const entry = getCharacterMotion(id); return entry?.promptHint ? [entry] : [] })\n const active = entries.filter(e => !bindings.subjectMinor || !e.adultOnly)\n if (bindings.selfPairing && active.some(e => e.twoPerson || e.counterpart)) add(\"roles\", \"error\", active.filter(e => e.twoPerson || e.counterpart).map(e => e.id), \"The same reference is connected as Target and Partner. Connect distinct participants before running this interaction.\")\n const omitted = entries.filter(e => bindings.subjectMinor && e.adultOnly)\n if (omitted.length) add(\"omitted\", active.length ? \"warning\" : \"error\", omitted.map(e => e.id), `${omitted.map(e => e.label).join(\", \")} omitted for a connected minor. ${active.length ? \"Replace these selections.\" : \"No selected motion contributes a fragment.\"}`)\n if ((bindings.targetNames?.length ?? 0) > 1) add(\"multiple-targets\", \"warning\", picks, \"Each target performs a separate copy of the sequence. Use separate motion nodes for coordinated choreography.\")\n for (const entry of active) {\n if (entry.deprecated) add(\"retired\", \"warning\", [entry.id], `${entry.label} is retired from new choices but still resolves in saved workflows.${entry.replacementId ? ` Use ${getCharacterMotion(entry.replacementId)?.label ?? entry.replacementId}.` : \"\"}`)\n if (entry.fixedPace && timing?.pace && timing.pace !== \"auto\") add(\"pace\", \"warning\", [entry.id], `${entry.label} sets its own timing. Set Pace to Auto or replace the motion.`)\n if (entry.requires?.length) add(\"requirements\", \"info\", [entry.id], `${entry.label} requires: ${entry.requires.join(\", \")}.${entry.twoPerson || entry.counterpart ? bindings.partnerNames?.length ? ` Partner reference: ${bindings.partnerNames.join(\", \")}; confirm it matches the required recipient.` : \" Connect a Partner reference to identify the recipient; otherwise the model chooses it.\" : \" Establish these in the scene or prompt; the fragment does not supply reference media.\"}`)\n }\n for (let i = 1; i < active.length; i++) {\n const before = active[i - 1]!, after = active[i]!, ids = [before.id, after.id]\n if (before.endVisibility === \"out-of-frame\") add(\"visibility\", \"warning\", ids, `${before.label} ends out of view before ${after.label}. Reorder or add an entrance.`)\n if (before.endPose && after.startPose && before.endPose !== \"any\" && after.startPose !== \"any\" && before.endPose !== after.startPose) add(\"pose\", \"warning\", ids, `${before.label} ends ${before.endPose}; ${after.label} starts ${after.startPose}. Add a transition or replace a motion.`)\n if (before.handsAfter && before.handsAfter !== \"free\" && after.needsFreeHands) add(\"hands\", \"warning\", ids, `${before.label} leaves hands occupied; ${after.label} needs free hands. Add a release first.`)\n }\n const compound = active.filter(e => e.kind === \"compound\")\n if (compound.length) add(\"compound\", \"warning\", compound.map(e => e.id), `${compound.length} selection${compound.length === 1 ? \" is\" : \"s are\"} compound choreography. Short clips may not fit every phase; test the sequence before adding more actions.`)\n return result\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/wardrobe.ts","../src/character-motion-diagnostics.ts"],"names":["id","pickIds","h","CHARACTER_MOTION_MAX_PICKS","getCharacterMotion"],"mappings":";;;;;AA0BO,IAAM,wBAAA,GAA6D;AAAA,EACxE,WAAA;AAAA,EAAa,KAAA;AAAA,EAAO,QAAA;AAAA,EAAU,WAAA;AAAA,EAAa,UAAA;AAAA,EAC3C,UAAA;AAAA,EAAY,aAAA;AAAA,EAAe,eAAA;AAAA,EAAiB,UAAA;AAAA,EAAY;AAC1D;AAEO,IAAM,wBAAA,GAAwE;AAAA,EACnF,SAAA,EAAW,WAAA;AAAA,EAAa,GAAA,EAAK,KAAA;AAAA,EAAO,MAAA,EAAQ,QAAA;AAAA,EAAU,SAAA,EAAW,WAAA;AAAA,EACjE,QAAA,EAAU,UAAA;AAAA,EAAY,QAAA,EAAU,UAAA;AAAA,EAAY,WAAA,EAAa,aAAA;AAAA,EACzD,eAAA,EAAiB,eAAA;AAAA,EAAiB,QAAA,EAAU,UAAA;AAAA,EAAY,GAAA,EAAK;AAC/D;AAEO,IAAM,2BAAA,GAA8E;AAAA,EACzF,SAAA,EAAW,WAAA;AAAA,EAAa,GAAA,EAAK,KAAA;AAAA,EAAO,MAAA,EAAQ,QAAA;AAAA,EAAU,SAAA,EAAW,WAAA;AAAA,EACjE,QAAA,EAAU,UAAA;AAAA,EAAY,QA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A,CAAS,QAAQ,GAAA,CAAI,UAAA,EAAY,WAAW,QAAA,CAAS,GAAA,CAAI,OAAK,CAAA,CAAE,EAAE,GAAG,CAAA,EAAG,QAAA,CAAS,MAAM,CAAA,UAAA,EAAa,QAAA,CAAS,WAAW,CAAA,GAAI,KAAA,GAAQ,OAAO,CAAA,0GAAA,CAA4G,CAAA;AAC3P,EAAA,OAAO,MAAA;AACT","file":"chunk-JV2WSMAA.cjs","sourcesContent":["import { pickIds } from \"@nodaro/shared/catalogs\"\n\nexport type WardrobeDimension =\n | \"archetype\" | \"top\" | \"bottom\" | \"outerwear\" | \"footwear\"\n | \"headwear\" | \"accessories\" | \"color-palette\" | \"material\" | \"era\"\n\nexport interface WardrobeEntry {\n readonly id: string\n readonly label: string\n readonly dimension: WardrobeDimension\n readonly promptHint: string\n}\n\nexport interface WardrobeValue {\n archetype?: string\n top?: string\n bottom?: string\n outerwear?: string\n footwear?: string\n headwear?: string | ReadonlyArray<string>\n accessories?: string | ReadonlyArray<string>\n colorPalette?: string\n material?: string\n era?: string\n}\n\nexport const WARDROBE_DIMENSION_ORDER: ReadonlyArray<WardrobeDimension> = [\n \"archetype\", \"top\", \"bottom\", \"outerwear\", \"footwear\",\n \"headwear\", \"accessories\", \"color-palette\", \"material\", \"era\",\n]\n\nexport const WARDROBE_CATEGORY_LABELS: Readonly<Record<WardrobeDimension, string>> = {\n archetype: \"Archetype\", top: \"Top\", bottom: \"Bottom\", outerwear: \"Outerwear\",\n footwear: \"Footwear\", headwear: \"Headwear\", accessories: \"Accessories\",\n \"color-palette\": \"Color Palette\", material: \"Material\", era: \"Era\",\n}\n\nexport const WARDROBE_FIELD_BY_DIMENSION: Record<WardrobeDimension, keyof WardrobeValue> = {\n archetype: \"archetype\", top: \"top\", bottom: \"bottom\", outerwear: \"outerwear\",\n footwear: \"footwear\", headwear: \"headwear\", accessories: \"accessories\",\n \"color-palette\": \"colorPalette\", material: \"material\", era: \"era\",\n}\n\n/** Multi-pick dims emit each picked entry independently. */\nconst MULTI_PICK: ReadonlySet<WardrobeDimension> = new Set([\"headwear\", \"accessories\"])\n/** Sentinel ids that mean \"nothing here\" and emit no hint. */\nconst NONE_IDS: ReadonlySet<string> = new Set([\"wd-outer-none\"])\n\nexport const WARDROBE: ReadonlyArray<WardrobeEntry> = [\n // archetype\n { id: \"wd-casual\", label: \"Casual\", dimension: \"archetype\", promptHint: \"in casual everyday clothing\" },\n { id: \"wd-business\", label: \"Business\", dimension: \"archetype\", promptHint: \"in smart business attire\" },\n { id: \"wd-formal\", label: \"Formal\", dimension: \"archetype\", promptHint: \"in elegant formal wear\" },\n { id: \"wd-streetwear\", label: \"Streetwear\", dimension: \"archetype\", promptHint: \"in contemporary streetwear\" },\n { id: \"wd-athletic\", label: \"Athletic\", dimension: \"archetype\", promptHint: \"in athletic sportswear\" },\n { id: \"wd-fantasy\", label: \"Fantasy\", dimension: \"archetype\", promptHint: \"in fantasy costume\" },\n { id: \"wd-scifi\", label: \"Sci-Fi\", dimension: \"archetype\", promptHint: \"in futuristic sci-fi attire\" },\n { id: \"wd-historical\", label: \"Historical\", dimension: \"archetype\", promptHint: \"in period historical dress\" },\n { id: \"wd-uniform\", label: \"Uniform\", dimension: \"archetype\", promptHint: \"in a uniform\" },\n { id: \"wd-loungewear\", label: \"Loungewear\", dimension: \"archetype\", promptHint: \"in relaxed loungewear\" },\n // top\n { id: \"wd-tshirt\", label: \"T-Shirt\", dimension: \"top\", promptHint: \"wearing a t-shirt\" },\n { id: \"wd-blouse\", label: \"Blouse\", dimension: \"top\", promptHint: \"wearing a blouse\" },\n { id: \"wd-hoodie\", label: \"Hoodie\", dimension: \"top\", promptHint: \"wearing a hoodie\" },\n { id: \"wd-buttondown\", label: \"Button-down\", dimension: \"top\", promptHint: \"wearing a button-down shirt\" },\n { id: \"wd-tank\", label: \"Tank\", dimension: \"top\", promptHint: \"wearing a tank top\" },\n { id: \"wd-sweater\", label: \"Sweater\", dimension: \"top\", promptHint: \"wearing a sweater\" },\n { id: \"wd-turtleneck\", label: \"Turtleneck\", dimension: \"top\", promptHint: \"wearing a turtleneck\" },\n // bottom\n { id: \"wd-jeans\", label: \"Jeans\", dimension: \"bottom\", promptHint: \"wearing jeans\" },\n { id: \"wd-trousers\", label: \"Trousers\", dimension: \"bottom\", promptHint: \"wearing tailored trousers\" },\n { id: \"wd-skirt\", label: \"Skirt\", dimension: \"bottom\", promptHint: \"wearing a skirt\" },\n { id: \"wd-shorts\", label: \"Shorts\", dimension: \"bottom\", promptHint: \"wearing shorts\" },\n { id: \"wd-leggings\", label: \"Leggings\", dimension: \"bottom\", promptHint: \"wearing leggings\" },\n { id: \"wd-cargo\", label: \"Cargo\", dimension: \"bottom\", promptHint: \"wearing cargo pants\" },\n // outerwear\n { id: \"wd-outer-none\", label: \"None\", dimension: \"outerwear\", promptHint: \"\" },\n { id: \"wd-leatherjkt\", label: \"Leather Jacket\", dimension: \"outerwear\", promptHint: \"in a leather jacket\" },\n { id: \"wd-blazer\", label: \"Blazer\", dimension: \"outerwear\", promptHint: \"in a blazer\" },\n { id: \"wd-trench\", label: \"Trench Coat\", dimension: \"outerwear\", promptHint: \"in a trench coat\" },\n { id: \"wd-parka\", label: \"Parka\", dimension: \"outerwear\", promptHint: \"in a parka\" },\n { id: \"wd-cloak\", label: \"Cloak\", dimension: \"outerwear\", promptHint: \"in a flowing cloak\" },\n { id: \"wd-denimjkt\", label: \"Denim Jacket\", dimension: \"outerwear\", promptHint: \"in a denim jacket\" },\n { id: \"wd-cardigan\", label: \"Cardigan\", dimension: \"outerwear\", promptHint: \"in a cardigan\" },\n // footwear\n { id: \"wd-sneakers\", label: \"Sneakers\", dimension: \"footwear\", promptHint: \"wearing sneakers\" },\n { id: \"wd-boots\", label: \"Boots\", dimension: \"footwear\", promptHint: \"wearing boots\" },\n { id: \"wd-heels\", label: \"Heels\", dimension: \"footwear\", promptHint: \"wearing heels\" },\n { id: \"wd-sandals\", label: \"Sandals\", dimension: \"footwear\", promptHint: \"wearing sandals\" },\n { id: \"wd-dressshoe\", label: \"Dress Shoes\", dimension: \"footwear\", promptHint: \"wearing dress shoes\" },\n { id: \"wd-barefoot\", label: \"Barefoot\", dimension: \"footwear\", promptHint: \"barefoot\" },\n // headwear (multi)\n { id: \"wd-cap\", label: \"Cap\", dimension: \"headwear\", promptHint: \"wearing a cap\" },\n { id: \"wd-beanie\", label: \"Beanie\", dimension: \"headwear\", promptHint: \"wearing a beanie\" },\n { id: \"wd-widehat\", label: \"Wide-brim Hat\", dimension: \"headwear\", promptHint: \"wearing a wide-brim hat\" },\n { id: \"wd-hood\", label: \"Hood\", dimension: \"headwear\", promptHint: \"with the hood up\" },\n { id: \"wd-crown\", label: \"Crown\", dimension: \"headwear\", promptHint: \"wearing a crown\" },\n { id: \"wd-helmet\", label: \"Helmet\", dimension: \"headwear\", promptHint: \"wearing a helmet\" },\n // accessories (multi)\n { id: \"wd-glasses\", label: \"Glasses\", dimension: \"accessories\", promptHint: \"wearing glasses\" },\n { id: \"wd-sunglasses\", label: \"Sunglasses\", dimension: \"accessories\", promptHint: \"wearing sunglasses\" },\n { id: \"wd-scarf\", label: \"Scarf\", dimension: \"accessories\", promptHint: \"wearing a scarf\" },\n { id: \"wd-gloves\", label: \"Gloves\", dimension: \"accessories\", promptHint: \"wearing gloves\" },\n { id: \"wd-jewelry\", label: \"Jewelry\", dimension: \"accessories\", promptHint: \"wearing statement jewelry\" },\n { id: \"wd-belt\", label: \"Belt\", dimension: \"accessories\", promptHint: \"with a belt\" },\n { id: \"wd-watch\", label: \"Watch\", dimension: \"accessories\", promptHint: \"wearing a watch\" },\n // color-palette\n { id: \"wd-neutral\", label: \"Neutral\", dimension: \"color-palette\", promptHint: \"in a neutral color palette\" },\n { id: \"wd-all-black\", label: \"All Black\", dimension: \"color-palette\", promptHint: \"in an all-black palette\" },\n { id: \"wd-earth\", label: \"Earth Tones\", dimension: \"color-palette\", promptHint: \"in earth-tone colors\" },\n { id: \"wd-pastel\", label: \"Pastel\", dimension: \"color-palette\", promptHint: \"in pastel colors\" },\n { id: \"wd-jewel\", label: \"Jewel Tones\", dimension: \"color-palette\", promptHint: \"in rich jewel-tone colors\" },\n { id: \"wd-neon\", label: \"Neon\", dimension: \"color-palette\", promptHint: \"in vivid neon colors\" },\n { id: \"wd-all-white\", label: \"All White\", dimension: \"color-palette\", promptHint: \"in an all-white palette\" },\n // material\n { id: \"wd-cotton\", label: \"Cotton\", dimension: \"material\", promptHint: \"in cotton fabric\" },\n { id: \"wd-denim\", label: \"Denim\", dimension: \"material\", promptHint: \"in denim\" },\n { id: \"wd-leather\", label: \"Leather\", dimension: \"material\", promptHint: \"in leather\" },\n { id: \"wd-silk\", label: \"Silk\", dimension: \"material\", promptHint: \"in silk\" },\n { id: \"wd-wool\", label: \"Wool\", dimension: \"material\", promptHint: \"in wool\" },\n { id: \"wd-latex\", label: \"Latex\", dimension: \"material\", promptHint: \"in latex\" },\n { id: \"wd-linen\", label: \"Linen\", dimension: \"material\", promptHint: \"in linen\" },\n // era\n { id: \"wd-contemporary\", label: \"Contemporary\", dimension: \"era\", promptHint: \"in contemporary fashion\" },\n { id: \"wd-1920s\", label: \"1920s\", dimension: \"era\", promptHint: \"in 1920s fashion\" },\n { id: \"wd-1950s\", label: \"1950s\", dimension: \"era\", promptHint: \"in 1950s fashion\" },\n { id: \"wd-1980s\", label: \"1980s\", dimension: \"era\", promptHint: \"in 1980s fashion\" },\n { id: \"wd-victorian\", label: \"Victorian\", dimension: \"era\", promptHint: \"in Victorian-era dress\" },\n { id: \"wd-medieval\", label: \"Medieval\", dimension: \"era\", promptHint: \"in medieval dress\" },\n { id: \"wd-futuristic\", label: \"Futuristic\", dimension: \"era\", promptHint: \"in futuristic clothing\" },\n] as const\n\nconst BY_ID: Map<string, WardrobeEntry> = new Map(WARDROBE.map((e) => [e.id, e]))\n\n/** Entries grouped by dimension — precomputed once so per-dimension lookups\n * (the picker calls one per dimension per render) are O(1) with stable array\n * refs, instead of a full WARDROBE scan each call. */\nconst BY_DIMENSION: Map<WardrobeDimension, WardrobeEntry[]> = (() => {\n const map = new Map<WardrobeDimension, WardrobeEntry[]>()\n for (const e of WARDROBE) {\n const list = map.get(e.dimension)\n if (list) list.push(e)\n else map.set(e.dimension, [e])\n }\n return map\n})()\n\nexport function getWardrobeEntry(id: string | undefined | null): WardrobeEntry | undefined {\n return id ? BY_ID.get(id) : undefined\n}\n\nexport function getWardrobePromptHint(id: string | undefined | null): string {\n return getWardrobeEntry(id)?.promptHint ?? \"\"\n}\n\nexport function getWardrobeEntriesByDimension(dim: WardrobeDimension): WardrobeEntry[] {\n return BY_DIMENSION.get(dim) ?? []\n}\n\nexport function buildWardrobeHints(value: Record<string, unknown> & WardrobeValue): string[] {\n const hints: string[] = []\n for (const dimension of WARDROBE_DIMENSION_ORDER) {\n const field = WARDROBE_FIELD_BY_DIMENSION[dimension]\n const raw = value[field]\n if (MULTI_PICK.has(dimension)) {\n for (const id of pickIds(raw)) {\n if (NONE_IDS.has(id)) continue\n const h = getWardrobePromptHint(id)\n if (h) hints.push(h)\n }\n continue\n }\n const id = typeof raw === \"string\" ? raw : undefined\n if (!id || NONE_IDS.has(id)) continue\n const h = getWardrobePromptHint(id)\n if (h) hints.push(h)\n }\n return hints\n}\n","import { getCharacterMotion, CHARACTER_MOTION_MAX_PICKS, type CharacterMotionTiming } from \"./character-motion.js\"\n\nexport interface CharacterMotionDiagnostic {\n readonly code: \"unknown\" | \"omitted\" | \"retired\" | \"pose\" | \"visibility\" | \"hands\" | \"pace\" | \"requirements\" | \"compound\" | \"capacity\" | \"multiple-targets\" | \"roles\"\n readonly severity: \"error\" | \"warning\" | \"info\"\n readonly ids: readonly string[]\n readonly message: string\n}\nexport interface CharacterMotionBindings {\n readonly selfPairing?: boolean\n readonly subjectMinor?: boolean\n readonly partnerNames?: readonly string[]\n readonly targetNames?: readonly string[]\n}\n\n/** Shared by editor, API clients and local review. Missing metadata means\n * unknown; this never certifies a sequence or predicts clip duration. */\nexport function getCharacterMotionDiagnostics(\n value: string | readonly string[] | null | undefined,\n timing?: CharacterMotionTiming,\n bindings: CharacterMotionBindings = {},\n): readonly CharacterMotionDiagnostic[] {\n const requested = typeof value === \"string\" ? [value] : Array.isArray(value) ? [...new Set(value)] : []\n const result: CharacterMotionDiagnostic[] = []\n const add = (code: CharacterMotionDiagnostic[\"code\"], severity: CharacterMotionDiagnostic[\"severity\"], ids: readonly string[], message: string) => result.push({ code, severity, ids, message })\n if (requested.length > CHARACTER_MOTION_MAX_PICKS) add(\"capacity\", \"warning\", requested, \"Only the first three selections contribute. Remove extra selections.\")\n const picks = requested.slice(0, CHARACTER_MOTION_MAX_PICKS)\n for (const id of picks) if (!getCharacterMotion(id)) add(\"unknown\", \"error\", [id], `Motion “${id}” is unavailable and contributes no fragment. Remove or replace it.`)\n const entries = picks.flatMap(id => { const entry = getCharacterMotion(id); return entry?.promptHint ? [entry] : [] })\n const active = entries.filter(e => !bindings.subjectMinor || !e.adultOnly)\n if (bindings.selfPairing && active.some(e => e.twoPerson || e.counterpart)) add(\"roles\", \"error\", active.filter(e => e.twoPerson || e.counterpart).map(e => e.id), \"The same reference is connected as Target and Partner. Connect distinct participants before running this interaction.\")\n const omitted = entries.filter(e => bindings.subjectMinor && e.adultOnly)\n if (omitted.length) add(\"omitted\", active.length ? \"warning\" : \"error\", omitted.map(e => e.id), `${omitted.map(e => e.label).join(\", \")} omitted for a connected minor. ${active.length ? \"Replace these selections.\" : \"No selected motion contributes a fragment.\"}`)\n if ((bindings.targetNames?.length ?? 0) > 1) add(\"multiple-targets\", \"warning\", picks, \"Each target performs a separate copy of the sequence. Use separate motion nodes for coordinated choreography.\")\n for (const entry of active) {\n if (entry.deprecated) add(\"retired\", \"warning\", [entry.id], `${entry.label} is retired from new choices but still resolves in saved workflows.${entry.replacementId ? ` Use ${getCharacterMotion(entry.replacementId)?.label ?? entry.replacementId}.` : \"\"}`)\n if (entry.fixedPace && timing?.pace && timing.pace !== \"auto\") add(\"pace\", \"warning\", [entry.id], `${entry.label} sets its own timing. Set Pace to Auto or replace the motion.`)\n if (entry.requires?.length) add(\"requirements\", \"info\", [entry.id], `${entry.label} requires: ${entry.requires.join(\", \")}.${entry.twoPerson || entry.counterpart ? bindings.partnerNames?.length ? ` Partner reference: ${bindings.partnerNames.join(\", \")}; confirm it matches the required recipient.` : \" Connect a Partner reference to identify the recipient; otherwise the model chooses it.\" : \" Establish these in the scene or prompt; the fragment does not supply reference media.\"}`)\n }\n for (let i = 1; i < active.length; i++) {\n const before = active[i - 1]!, after = active[i]!, ids = [before.id, after.id]\n if (before.endVisibility === \"out-of-frame\") add(\"visibility\", \"warning\", ids, `${before.label} ends out of view before ${after.label}. Reorder or add an entrance.`)\n if (before.endPose && after.startPose && before.endPose !== \"any\" && after.startPose !== \"any\" && before.endPose !== after.startPose) add(\"pose\", \"warning\", ids, `${before.label} ends ${before.endPose}; ${after.label} starts ${after.startPose}. Add a transition or replace a motion.`)\n if (before.handsAfter && before.handsAfter !== \"free\" && after.needsFreeHands) add(\"hands\", \"warning\", ids, `${before.label} leaves hands occupied; ${after.label} needs free hands. Add a release first.`)\n }\n const compound = active.filter(e => e.kind === \"compound\")\n if (compound.length) add(\"compound\", \"warning\", compound.map(e => e.id), `${compound.length} selection${compound.length === 1 ? \" is\" : \"s are\"} compound choreography. Short clips may not fit every phase; test the sequence before adding more actions.`)\n return result\n}\n"]}
|
|
@@ -1,22 +1,22 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
var
|
|
3
|
+
var chunkPJFX3MFI_cjs = require('./chunk-PJFX3MFI.cjs');
|
|
4
|
+
var chunkIMQB7GIK_cjs = require('./chunk-IMQB7GIK.cjs');
|
|
5
5
|
|
|
6
6
|
// src/read-node-direction.ts
|
|
7
7
|
function readDirectionFields(value) {
|
|
8
8
|
if (typeof value !== "object" || value === null || Array.isArray(value)) return void 0;
|
|
9
9
|
const src = value;
|
|
10
10
|
const out = {};
|
|
11
|
-
for (const spec of
|
|
11
|
+
for (const spec of chunkIMQB7GIK_cjs.DIRECTION_FIELDS) {
|
|
12
12
|
const v = src[spec.key];
|
|
13
13
|
if (typeof v === "string") {
|
|
14
|
-
if (v.length > 0 && v.length <=
|
|
14
|
+
if (v.length > 0 && v.length <= chunkIMQB7GIK_cjs.DIRECTION_ID_MAX_CHARS) out[spec.key] = v;
|
|
15
15
|
} else if (Array.isArray(v)) {
|
|
16
16
|
const kept = [];
|
|
17
17
|
for (const x of v) {
|
|
18
|
-
if (kept.length >=
|
|
19
|
-
if (typeof x === "string" && x.length > 0 && x.length <=
|
|
18
|
+
if (kept.length >= chunkIMQB7GIK_cjs.DIRECTION_ARRAY_CEILING) break;
|
|
19
|
+
if (typeof x === "string" && x.length > 0 && x.length <= chunkIMQB7GIK_cjs.DIRECTION_ID_MAX_CHARS) {
|
|
20
20
|
kept.push(x);
|
|
21
21
|
}
|
|
22
22
|
}
|
|
@@ -29,19 +29,19 @@ function readSubjectFields(value) {
|
|
|
29
29
|
if (typeof value !== "object" || value === null || Array.isArray(value)) return void 0;
|
|
30
30
|
const src = value;
|
|
31
31
|
const out = {};
|
|
32
|
-
for (const key of
|
|
32
|
+
for (const key of chunkPJFX3MFI_cjs.getRegisteredSubjectKeys()) {
|
|
33
33
|
const v = src[key];
|
|
34
|
-
if (key ===
|
|
34
|
+
if (key === chunkPJFX3MFI_cjs.SUBJECT_CUSTOM_AGE_KEY) {
|
|
35
35
|
if (typeof v === "number" && Number.isFinite(v)) out[key] = v;
|
|
36
36
|
continue;
|
|
37
37
|
}
|
|
38
38
|
if (typeof v === "string") {
|
|
39
|
-
if (v.length > 0 && v.length <=
|
|
39
|
+
if (v.length > 0 && v.length <= chunkPJFX3MFI_cjs.SUBJECT_ID_MAX_CHARS) out[key] = v;
|
|
40
40
|
} else if (Array.isArray(v)) {
|
|
41
41
|
const kept = [];
|
|
42
42
|
for (const x of v) {
|
|
43
|
-
if (kept.length >=
|
|
44
|
-
if (typeof x === "string" && x.length > 0 && x.length <=
|
|
43
|
+
if (kept.length >= chunkPJFX3MFI_cjs.SUBJECT_ARRAY_CEILING) break;
|
|
44
|
+
if (typeof x === "string" && x.length > 0 && x.length <= chunkPJFX3MFI_cjs.SUBJECT_ID_MAX_CHARS) {
|
|
45
45
|
kept.push(x);
|
|
46
46
|
}
|
|
47
47
|
}
|
|
@@ -118,5 +118,5 @@ function readStructuredFields(value) {
|
|
|
118
118
|
exports.readDirectionFields = readDirectionFields;
|
|
119
119
|
exports.readStructuredFields = readStructuredFields;
|
|
120
120
|
exports.readSubjectFields = readSubjectFields;
|
|
121
|
-
//# sourceMappingURL=chunk-
|
|
122
|
-
//# sourceMappingURL=chunk-
|
|
121
|
+
//# sourceMappingURL=chunk-KNAKOSKV.cjs.map
|
|
122
|
+
//# sourceMappingURL=chunk-KNAKOSKV.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/read-node-direction.ts"],"names":["DIRECTION_FIELDS","DIRECTION_ID_MAX_CHARS","DIRECTION_ARRAY_CEILING","getRegisteredSubjectKeys","SUBJECT_CUSTOM_AGE_KEY","SUBJECT_ID_MAX_CHARS","SUBJECT_ARRAY_CEILING"],"mappings":";;;;;;AA2EO,SAAS,oBAAoB,KAAA,EAA6C;AAC/E,EAAA,IAAI,OAAO,UAAU,QAAA,IAAY,KAAA,KAAU,QAAQ,KAAA,CAAM,OAAA,CAAQ,KAAK,CAAA,EAAG,OAAO,MAAA;AAChF,EAAA,MAAM,GAAA,GAAM,KAAA;AACZ,EAAA,MAAM,MAAyC,EAAC;AAChD,EAAA,KAAA,MAAW,QAAQA,kCAAA,EAAkB;AACnC,IAAA,MAAM,CAAA,GAAI,GAAA,CAAI,IAAA,CAAK,GAAG,CAAA;AACtB,IAAA,IAAI,OAAO,MAAM,QAAA,EAAU;AACzB,MAAA,IAAI,CAAA,CAAE,SAAS,CAAA,IAAK,CAAA,CAAE,UAAUC,wCAAA,EAAwB,GAAA,CAAI,IAAA,CAAK,GAAG,CAA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,GAAG,CAAA,EAAG;AACnE,IAAA,MAAM,MAAA,GAAS,GAAA;AACf,IAAA,MAAM,OAAgC,EAAC;AACvC,IAAA,KAAA,MAAW,CAAC,KAAA,EAAO,IAAI,CAAA,IAAK,MAAA,CAAO,OAAA;AAAA,MACjC,kBAAkB,KAAK;AAAA,KACzB,EAAG;AACD,MAAA,MAAM,CAAA,GAAI,SAAA,CAAU,MAAA,CAAO,KAAK,GAAG,IAAI,CAAA;AACvC,MAAA,IAAI,CAAA,KAAM,MAAA,EAAW,IAAA,CAAK,KAAK,CAAA,GAAI,CAAA;AAAA,IACrC;AACA,IAAA,IAAI,MAAA,CAAO,KAAK,IAAI,CAAA,CAAE,SAAS,CAAA,EAAG,GAAA,CAAI,KAAK,CAAA,GAAI,IAAA;AAAA,EACjD;AACA,EAAA,MAAM,IAAA,GAAO,SAAA,CAAU,GAAA,CAAI,IAAA,EAAM,QAAQ,CAAA;AACzC,EAAA,IAAI,IAAA,KAAS,MAAA,EAAW,GAAA,CAAI,IAAA,GAAO,IAAA;AACnC,EAAA,OAAO,OAAO,IAAA,CAAK,GAAG,CAAA,CAAE,MAAA,GAAS,IAAK,GAAA,GAAiC,MAAA;AACzE","file":"chunk-VAK4RUNU.cjs","sourcesContent":["/**\n * Narrow readers turning UNTRUSTED persisted node data (`workflows.nodes`\n * JSONB — import, MCP write, node preset, a Studio-emitted graph) into the\n * typed `subject` / `direction` / `structured` levers `assembleImageInput`\n * accepts.\n * `buildPayload` has no zod and workflow writes are\n * `z.record(z.string(), z.unknown())`, so this blob may have been written years\n * ago by any client.\n *\n * Used by ALL THREE image-assembly sites so what the canvas accepts cannot\n * drift between them: the frontend single-node executor (`execute-node.ts`),\n * the orchestrator (`payload-builder.ts`), and the config-panel final-prompt\n * preview (`build-image-assemble-input.ts`).\n *\n * `readDirectionFields` is DERIVED FROM `DIRECTION_FIELDS`, never a hand list:\n * a dimension added to the registry is honored here by construction, so the\n * reader can never silently drop a key the wire schema and the renderer both\n * know about. Anything unrecognised is DROPPED, never thrown on — a malformed\n * blob must not fail a canvas run, and an unknown catalog ID already degrades\n * to `\"\"` inside each `get*PromptHint`, so this validates SHAPE only.\n *\n * BOUNDS MATCH THE WIRE SCHEMA where both exist, by SHARED CONSTANT:\n * `DIRECTION_ID_MAX_CHARS` and `DIRECTION_ARRAY_CEILING` are the same two\n * literals the `generate-image` route's `directionSchema` enforces, imported\n * from the registry rather than re-typed here — a body the route accepts and a\n * node the canvas re-runs must not disagree about which strings are ids.\n *\n * DELIBERATELY STRICTER THAN THE WIRE SCHEMA on `structured` values: the\n * route's `structuredPromptFieldsSchema` declares every field as a bare\n * `z.string().optional()` (unbounded), while `MAX_STRUCTURED_VALUE_CHARS` below\n * bounds them at 200. Do not \"fix\" that asymmetry by loosening HERE — this\n * reads a blob any client may have written years ago, and the values land\n * verbatim in `jobs.input_data.prompt`. Tightening the ROUTE instead would be a\n * new 400 on currently-accepted input, so a >200-char structured value stored\n * on a node is dropped on a canvas run while `POST /v1/generate-image` still\n * renders it. That is the one known divergence; it is bounded to a field the\n * canvas UI never writes that long.\n *\n * RETURNS `undefined`, NEVER `{}`: an empty object would still be a *defined*\n * `direction`, and the call sites' `...(x !== undefined ? { x } : {})` spread\n * would then hand `assembleImageInput` a defined-but-empty lever. Returning\n * `undefined` keeps that spread honest and the exact no-op branch taken.\n */\nimport {\n DIRECTION_ARRAY_CEILING,\n DIRECTION_FIELDS,\n DIRECTION_ID_MAX_CHARS,\n type DirectionFields,\n} from \"./direction-registry.js\"\nimport {\n SUBJECT_ARRAY_CEILING,\n SUBJECT_CUSTOM_AGE_KEY,\n SUBJECT_ID_MAX_CHARS,\n getRegisteredSubjectKeys,\n type SubjectFields,\n} from \"./subject-registry.js\"\nimport type { StructuredPromptFields } from \"./prompt-builder-structured-fields.js\"\n\n/**\n * Read a node's stored cinematic-direction ids. Accepts a single id OR an array\n * on every key (multi-pick dimensions carry arrays; a single-pick key may\n * legitimately carry one).\n *\n * The SEMANTIC per-dimension cap stays the renderer's slice (`maxPicks`) — this\n * reader does not know a row's pick budget and must not guess it. But it DOES\n * bound cardinality at `DIRECTION_ARRAY_CEILING`, the same ceiling the wire\n * schema enforces: the value is untrusted persisted JSONB (a node blob is\n * validated only as `z.record(z.string(), z.unknown())` on write), and handing\n * an unbounded array to `renderDirectionHints` would put an `includes`-dedupe\n * scan in front of that slice. Keeping the FIRST `DIRECTION_ARRAY_CEILING`\n * survivors is what the wire door already does to the same input.\n *\n * Junk is filtered BEFORE the cap, so valid ids sitting behind malformed\n * entries survive rather than being crowded out by them.\n */\nexport function readDirectionFields(value: unknown): DirectionFields | undefined {\n if (typeof value !== \"object\" || value === null || Array.isArray(value)) return undefined\n const src = value as Record<string, unknown>\n const out: Record<string, string | string[]> = {}\n for (const spec of DIRECTION_FIELDS) {\n const v = src[spec.key]\n if (typeof v === \"string\") {\n if (v.length > 0 && v.length <= DIRECTION_ID_MAX_CHARS) out[spec.key] = v\n } else if (Array.isArray(v)) {\n const kept: string[] = []\n for (const x of v) {\n if (kept.length >= DIRECTION_ARRAY_CEILING) break\n if (typeof x === \"string\" && x.length > 0 && x.length <= DIRECTION_ID_MAX_CHARS) {\n kept.push(x)\n }\n }\n if (kept.length > 0) out[spec.key] = kept\n }\n }\n return Object.keys(out).length > 0 ? (out as DirectionFields) : undefined\n}\n\n// ── subject ──────────────────────────────────────────────────────────────────\n\n/**\n * Read a node's stored SUBJECT ids — the flat Person / Styling / prop bag the\n * `subject` channel carries. Same three contracts as `readDirectionFields`:\n * drop-never-throw, `undefined` never `{}`, and bounds shared with the wire\n * door by CONSTANT (`SUBJECT_ID_MAX_CHARS` / `SUBJECT_ARRAY_CEILING`, which are\n * defined AS the direction constants) so a body the route accepts and the same\n * node re-run from the canvas cannot disagree about which strings are ids.\n *\n * DERIVED from `getRegisteredSubjectKeys()`, never a hand-authored field list —\n * that is the whole lesson of `readStructuredFields` below, whose hand table is\n * only viable because `StructuredPromptFields` is a small hand-authored type.\n * The subject vocabulary is ~54 catalog-derived fields PLUS deployment-registered\n * pack dimensions unknown at compile time, so it is read from the registry at\n * call time. Iterating the KEY SET (never `Object.keys(value)`) is also what\n * keeps an adversarial blob's key count off the hot path.\n *\n * The SEMANTIC per-dimension cap stays the renderer's job\n * (`normalizeSubjectFields`), exactly as `maxPicks` does for direction: this\n * reader bounds cardinality only. `customAge` is the one number on the wire and\n * is passed through finite-only — the renderer clamps it.\n */\nexport function readSubjectFields(value: unknown): SubjectFields | undefined {\n if (typeof value !== \"object\" || value === null || Array.isArray(value)) return undefined\n const src = value as Record<string, unknown>\n const out: Record<string, string | string[] | number> = {}\n for (const key of getRegisteredSubjectKeys()) {\n const v = src[key]\n if (key === SUBJECT_CUSTOM_AGE_KEY) {\n if (typeof v === \"number\" && Number.isFinite(v)) out[key] = v\n continue\n }\n if (typeof v === \"string\") {\n if (v.length > 0 && v.length <= SUBJECT_ID_MAX_CHARS) out[key] = v\n } else if (Array.isArray(v)) {\n // Junk is filtered BEFORE the cap, so valid ids sitting behind malformed\n // entries survive rather than being crowded out by them.\n const kept: string[] = []\n for (const x of v) {\n if (kept.length >= SUBJECT_ARRAY_CEILING) break\n if (typeof x === \"string\" && x.length > 0 && x.length <= SUBJECT_ID_MAX_CHARS) {\n kept.push(x)\n }\n }\n if (kept.length > 0) out[key] = kept\n }\n }\n return Object.keys(out).length > 0 ? (out as SubjectFields) : undefined\n}\n\n// ── structured ───────────────────────────────────────────────────────────────\n\ntype FieldKind = \"string\" | \"number\" | \"gender\"\nconst GENDERS = [\"man\", \"woman\", \"child\", \"non-binary\"] as const\nconst MAX_STRUCTURED_VALUE_CHARS = 200\n\ntype Group = Exclude<keyof StructuredPromptFields, \"mood\">\ntype GroupFields<K extends Group> = Record<keyof NonNullable<StructuredPromptFields[K]>, FieldKind>\n\n/**\n * A FIELD-BY-FIELD table (not a registry walk) on purpose:\n * `StructuredPromptFields` is a small HAND-AUTHORED type, not catalog-derived,\n * and the table is what blocks `person: { age: \"drop table\" }` from rendering\n * verbatim into `jobs.input_data.prompt` — `renderStructuredFields` never\n * throws on junk, but it does render it. Totality is enforced by the\n * `GroupFields<K>` / `{ [K in Group]: … }` mapped types: a new field or group\n * on the published type fails to typecheck here.\n */\nconst PERSON_FIELDS: GroupFields<\"person\"> = {\n age: \"number\",\n gender: \"gender\",\n hair: \"string\",\n eyes: \"string\",\n expression: \"string\",\n profession: \"string\",\n warriorType: \"string\",\n}\nconst STYLING_FIELDS: GroupFields<\"styling\"> = {\n mood: \"string\",\n lighting: \"string\",\n aesthetic: \"string\",\n colorLook: \"string\",\n}\nconst SETTING_FIELDS: GroupFields<\"setting\"> = {\n era: \"string\",\n atmosphere: \"string\",\n backdrop: \"string\",\n}\nconst CAMERA_FIELDS: GroupFields<\"camera\"> = {\n framing: \"string\",\n motion: \"string\",\n format: \"string\",\n}\nconst LENS_FIELDS: GroupFields<\"lens\"> = { focalLength: \"string\", aperture: \"string\" }\n\nconst STRUCTURED_GROUPS: { [K in Group]: GroupFields<K> } = {\n person: PERSON_FIELDS,\n styling: STYLING_FIELDS,\n setting: SETTING_FIELDS,\n camera: CAMERA_FIELDS,\n lens: LENS_FIELDS,\n}\n\nfunction readField(v: unknown, kind: FieldKind): string | number | undefined {\n if (kind === \"number\") return typeof v === \"number\" && Number.isFinite(v) ? v : undefined\n if (typeof v !== \"string\" || v.length === 0 || v.length > MAX_STRUCTURED_VALUE_CHARS) {\n return undefined\n }\n if (kind === \"gender\") return (GENDERS as readonly string[]).includes(v) ? v : undefined\n return v\n}\n\n/** Read a node's stored Path-1 structured prompt fields. Same drop-never-throw\n * and `undefined`-never-`{}` contract as `readDirectionFields`. */\nexport function readStructuredFields(value: unknown): StructuredPromptFields | undefined {\n if (typeof value !== \"object\" || value === null || Array.isArray(value)) return undefined\n const src = value as Record<string, unknown>\n const out: Record<string, unknown> = {}\n for (const group of Object.keys(STRUCTURED_GROUPS) as Group[]) {\n const raw = src[group]\n if (typeof raw !== \"object\" || raw === null || Array.isArray(raw)) continue\n const rawRec = raw as Record<string, unknown>\n const kept: Record<string, unknown> = {}\n for (const [field, kind] of Object.entries(\n STRUCTURED_GROUPS[group] as Record<string, FieldKind>,\n )) {\n const v = readField(rawRec[field], kind)\n if (v !== undefined) kept[field] = v\n }\n if (Object.keys(kept).length > 0) out[group] = kept\n }\n const mood = readField(src.mood, \"string\")\n if (mood !== undefined) out.mood = mood\n return Object.keys(out).length > 0 ? (out as StructuredPromptFields) : undefined\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/read-node-direction.ts"],"names":["DIRECTION_FIELDS","DIRECTION_ID_MAX_CHARS","DIRECTION_ARRAY_CEILING","getRegisteredSubjectKeys","SUBJECT_CUSTOM_AGE_KEY","SUBJECT_ID_MAX_CHARS","SUBJECT_ARRAY_CEILING"],"mappings":";;;;;;AA2EO,SAAS,oBAAoB,KAAA,EAA6C;AAC/E,EAAA,IAAI,OAAO,UAAU,QAAA,IAAY,KAAA,KAAU,QAAQ,KAAA,CAAM,OAAA,CAAQ,KAAK,CAAA,EAAG,OAAO,MAAA;AAChF,EAAA,MAAM,GAAA,GAAM,KAAA;AACZ,EAAA,MAAM,MAAyC,EAAC;AAChD,EAAA,KAAA,MAAW,QAAQA,kCAAA,EAAkB;AACnC,IAAA,MAAM,CAAA,GAAI,GAAA,CAAI,IAAA,CAAK,GAAG,CAAA;AACtB,IAAA,IAAI,OAAO,MAAM,QAAA,EAAU;AACzB,MAAA,IAAI,CAAA,CAAE,SAAS,CAAA,IAAK,CAAA,CAAE,UAAUC,wCAAA,EAAwB,GAAA,CAAI,IAAA,CAAK,GAAG,CAAA,GAAI,CAAA;AAAA,IAC1E,CAAA,MAAA,IAAW,KAAA,CAAM,OAAA,CAAQ,CAAC,CAAA,EAAG;AAC3B,MAAA,MAAM,OAAiB,EAAC;AACxB,MAAA,KAAA,MAAW,KAAK,CAAA,EAAG;AACjB,QAAA,IAAI,IAAA,CAAK,UAAUC,yCAAA,EAAyB;AAC5C,QAAA,IAAI,OAAO,MAAM,QAAA,I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A,CAAO,KAAK,GAAG,IAAI,CAAA;AACvC,MAAA,IAAI,CAAA,KAAM,MAAA,EAAW,IAAA,CAAK,KAAK,CAAA,GAAI,CAAA;AAAA,IACrC;AACA,IAAA,IAAI,MAAA,CAAO,KAAK,IAAI,CAAA,CAAE,SAAS,CAAA,EAAG,GAAA,CAAI,KAAK,CAAA,GAAI,IAAA;AAAA,EACjD;AACA,EAAA,MAAM,IAAA,GAAO,SAAA,CAAU,GAAA,CAAI,IAAA,EAAM,QAAQ,CAAA;AACzC,EAAA,IAAI,IAAA,KAAS,MAAA,EAAW,GAAA,CAAI,IAAA,GAAO,IAAA;AACnC,EAAA,OAAO,OAAO,IAAA,CAAK,GAAG,CAAA,CAAE,MAAA,GAAS,IAAK,GAAA,GAAiC,MAAA;AACzE","file":"chunk-KNAKOSKV.cjs","sourcesContent":["/**\n * Narrow readers turning UNTRUSTED persisted node data (`workflows.nodes`\n * JSONB — import, MCP write, node preset, a Studio-emitted graph) into the\n * typed `subject` / `direction` / `structured` levers `assembleImageInput`\n * accepts.\n * `buildPayload` has no zod and workflow writes are\n * `z.record(z.string(), z.unknown())`, so this blob may have been written years\n * ago by any client.\n *\n * Used by ALL THREE image-assembly sites so what the canvas accepts cannot\n * drift between them: the frontend single-node executor (`execute-node.ts`),\n * the orchestrator (`payload-builder.ts`), and the config-panel final-prompt\n * preview (`build-image-assemble-input.ts`).\n *\n * `readDirectionFields` is DERIVED FROM `DIRECTION_FIELDS`, never a hand list:\n * a dimension added to the registry is honored here by construction, so the\n * reader can never silently drop a key the wire schema and the renderer both\n * know about. Anything unrecognised is DROPPED, never thrown on — a malformed\n * blob must not fail a canvas run, and an unknown catalog ID already degrades\n * to `\"\"` inside each `get*PromptHint`, so this validates SHAPE only.\n *\n * BOUNDS MATCH THE WIRE SCHEMA where both exist, by SHARED CONSTANT:\n * `DIRECTION_ID_MAX_CHARS` and `DIRECTION_ARRAY_CEILING` are the same two\n * literals the `generate-image` route's `directionSchema` enforces, imported\n * from the registry rather than re-typed here — a body the route accepts and a\n * node the canvas re-runs must not disagree about which strings are ids.\n *\n * DELIBERATELY STRICTER THAN THE WIRE SCHEMA on `structured` values: the\n * route's `structuredPromptFieldsSchema` declares every field as a bare\n * `z.string().optional()` (unbounded), while `MAX_STRUCTURED_VALUE_CHARS` below\n * bounds them at 200. Do not \"fix\" that asymmetry by loosening HERE — this\n * reads a blob any client may have written years ago, and the values land\n * verbatim in `jobs.input_data.prompt`. Tightening the ROUTE instead would be a\n * new 400 on currently-accepted input, so a >200-char structured value stored\n * on a node is dropped on a canvas run while `POST /v1/generate-image` still\n * renders it. That is the one known divergence; it is bounded to a field the\n * canvas UI never writes that long.\n *\n * RETURNS `undefined`, NEVER `{}`: an empty object would still be a *defined*\n * `direction`, and the call sites' `...(x !== undefined ? { x } : {})` spread\n * would then hand `assembleImageInput` a defined-but-empty lever. Returning\n * `undefined` keeps that spread honest and the exact no-op branch taken.\n */\nimport {\n DIRECTION_ARRAY_CEILING,\n DIRECTION_FIELDS,\n DIRECTION_ID_MAX_CHARS,\n type DirectionFields,\n} from \"./direction-registry.js\"\nimport {\n SUBJECT_ARRAY_CEILING,\n SUBJECT_CUSTOM_AGE_KEY,\n SUBJECT_ID_MAX_CHARS,\n getRegisteredSubjectKeys,\n type SubjectFields,\n} from \"./subject-registry.js\"\nimport type { StructuredPromptFields } from \"./prompt-builder-structured-fields.js\"\n\n/**\n * Read a node's stored cinematic-direction ids. Accepts a single id OR an array\n * on every key (multi-pick dimensions carry arrays; a single-pick key may\n * legitimately carry one).\n *\n * The SEMANTIC per-dimension cap stays the renderer's slice (`maxPicks`) — this\n * reader does not know a row's pick budget and must not guess it. But it DOES\n * bound cardinality at `DIRECTION_ARRAY_CEILING`, the same ceiling the wire\n * schema enforces: the value is untrusted persisted JSONB (a node blob is\n * validated only as `z.record(z.string(), z.unknown())` on write), and handing\n * an unbounded array to `renderDirectionHints` would put an `includes`-dedupe\n * scan in front of that slice. Keeping the FIRST `DIRECTION_ARRAY_CEILING`\n * survivors is what the wire door already does to the same input.\n *\n * Junk is filtered BEFORE the cap, so valid ids sitting behind malformed\n * entries survive rather than being crowded out by them.\n */\nexport function readDirectionFields(value: unknown): DirectionFields | undefined {\n if (typeof value !== \"object\" || value === null || Array.isArray(value)) return undefined\n const src = value as Record<string, unknown>\n const out: Record<string, string | string[]> = {}\n for (const spec of DIRECTION_FIELDS) {\n const v = src[spec.key]\n if (typeof v === \"string\") {\n if (v.length > 0 && v.length <= DIRECTION_ID_MAX_CHARS) out[spec.key] = v\n } else if (Array.isArray(v)) {\n const kept: string[] = []\n for (const x of v) {\n if (kept.length >= DIRECTION_ARRAY_CEILING) break\n if (typeof x === \"string\" && x.length > 0 && x.length <= DIRECTION_ID_MAX_CHARS) {\n kept.push(x)\n }\n }\n if (kept.length > 0) out[spec.key] = kept\n }\n }\n return Object.keys(out).length > 0 ? (out as DirectionFields) : undefined\n}\n\n// ── subject ──────────────────────────────────────────────────────────────────\n\n/**\n * Read a node's stored SUBJECT ids — the flat Person / Styling / prop bag the\n * `subject` channel carries. Same three contracts as `readDirectionFields`:\n * drop-never-throw, `undefined` never `{}`, and bounds shared with the wire\n * door by CONSTANT (`SUBJECT_ID_MAX_CHARS` / `SUBJECT_ARRAY_CEILING`, which are\n * defined AS the direction constants) so a body the route accepts and the same\n * node re-run from the canvas cannot disagree about which strings are ids.\n *\n * DERIVED from `getRegisteredSubjectKeys()`, never a hand-authored field list —\n * that is the whole lesson of `readStructuredFields` below, whose hand table is\n * only viable because `StructuredPromptFields` is a small hand-authored type.\n * The subject vocabulary is ~54 catalog-derived fields PLUS deployment-registered\n * pack dimensions unknown at compile time, so it is read from the registry at\n * call time. Iterating the KEY SET (never `Object.keys(value)`) is also what\n * keeps an adversarial blob's key count off the hot path.\n *\n * The SEMANTIC per-dimension cap stays the renderer's job\n * (`normalizeSubjectFields`), exactly as `maxPicks` does for direction: this\n * reader bounds cardinality only. `customAge` is the one number on the wire and\n * is passed through finite-only — the renderer clamps it.\n */\nexport function readSubjectFields(value: unknown): SubjectFields | undefined {\n if (typeof value !== \"object\" || value === null || Array.isArray(value)) return undefined\n const src = value as Record<string, unknown>\n const out: Record<string, string | string[] | number> = {}\n for (const key of getRegisteredSubjectKeys()) {\n const v = src[key]\n if (key === SUBJECT_CUSTOM_AGE_KEY) {\n if (typeof v === \"number\" && Number.isFinite(v)) out[key] = v\n continue\n }\n if (typeof v === \"string\") {\n if (v.length > 0 && v.length <= SUBJECT_ID_MAX_CHARS) out[key] = v\n } else if (Array.isArray(v)) {\n // Junk is filtered BEFORE the cap, so valid ids sitting behind malformed\n // entries survive rather than being crowded out by them.\n const kept: string[] = []\n for (const x of v) {\n if (kept.length >= SUBJECT_ARRAY_CEILING) break\n if (typeof x === \"string\" && x.length > 0 && x.length <= SUBJECT_ID_MAX_CHARS) {\n kept.push(x)\n }\n }\n if (kept.length > 0) out[key] = kept\n }\n }\n return Object.keys(out).length > 0 ? (out as SubjectFields) : undefined\n}\n\n// ── structured ───────────────────────────────────────────────────────────────\n\ntype FieldKind = \"string\" | \"number\" | \"gender\"\nconst GENDERS = [\"man\", \"woman\", \"child\", \"non-binary\"] as const\nconst MAX_STRUCTURED_VALUE_CHARS = 200\n\ntype Group = Exclude<keyof StructuredPromptFields, \"mood\">\ntype GroupFields<K extends Group> = Record<keyof NonNullable<StructuredPromptFields[K]>, FieldKind>\n\n/**\n * A FIELD-BY-FIELD table (not a registry walk) on purpose:\n * `StructuredPromptFields` is a small HAND-AUTHORED type, not catalog-derived,\n * and the table is what blocks `person: { age: \"drop table\" }` from rendering\n * verbatim into `jobs.input_data.prompt` — `renderStructuredFields` never\n * throws on junk, but it does render it. Totality is enforced by the\n * `GroupFields<K>` / `{ [K in Group]: … }` mapped types: a new field or group\n * on the published type fails to typecheck here.\n */\nconst PERSON_FIELDS: GroupFields<\"person\"> = {\n age: \"number\",\n gender: \"gender\",\n hair: \"string\",\n eyes: \"string\",\n expression: \"string\",\n profession: \"string\",\n warriorType: \"string\",\n}\nconst STYLING_FIELDS: GroupFields<\"styling\"> = {\n mood: \"string\",\n lighting: \"string\",\n aesthetic: \"string\",\n colorLook: \"string\",\n}\nconst SETTING_FIELDS: GroupFields<\"setting\"> = {\n era: \"string\",\n atmosphere: \"string\",\n backdrop: \"string\",\n}\nconst CAMERA_FIELDS: GroupFields<\"camera\"> = {\n framing: \"string\",\n motion: \"string\",\n format: \"string\",\n}\nconst LENS_FIELDS: GroupFields<\"lens\"> = { focalLength: \"string\", aperture: \"string\" }\n\nconst STRUCTURED_GROUPS: { [K in Group]: GroupFields<K> } = {\n person: PERSON_FIELDS,\n styling: STYLING_FIELDS,\n setting: SETTING_FIELDS,\n camera: CAMERA_FIELDS,\n lens: LENS_FIELDS,\n}\n\nfunction readField(v: unknown, kind: FieldKind): string | number | undefined {\n if (kind === \"number\") return typeof v === \"number\" && Number.isFinite(v) ? v : undefined\n if (typeof v !== \"string\" || v.length === 0 || v.length > MAX_STRUCTURED_VALUE_CHARS) {\n return undefined\n }\n if (kind === \"gender\") return (GENDERS as readonly string[]).includes(v) ? v : undefined\n return v\n}\n\n/** Read a node's stored Path-1 structured prompt fields. Same drop-never-throw\n * and `undefined`-never-`{}` contract as `readDirectionFields`. */\nexport function readStructuredFields(value: unknown): StructuredPromptFields | undefined {\n if (typeof value !== \"object\" || value === null || Array.isArray(value)) return undefined\n const src = value as Record<string, unknown>\n const out: Record<string, unknown> = {}\n for (const group of Object.keys(STRUCTURED_GROUPS) as Group[]) {\n const raw = src[group]\n if (typeof raw !== \"object\" || raw === null || Array.isArray(raw)) continue\n const rawRec = raw as Record<string, unknown>\n const kept: Record<string, unknown> = {}\n for (const [field, kind] of Object.entries(\n STRUCTURED_GROUPS[group] as Record<string, FieldKind>,\n )) {\n const v = readField(rawRec[field], kind)\n if (v !== undefined) kept[field] = v\n }\n if (Object.keys(kept).length > 0) out[group] = kept\n }\n const mood = readField(src.mood, \"string\")\n if (mood !== undefined) out.mood = mood\n return Object.keys(out).length > 0 ? (out as StructuredPromptFields) : undefined\n}\n"]}
|