@nodaro/prompts 1.38.0 → 1.39.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/{chunk-LVSH7K7R.cjs → chunk-22KZOAGL.cjs} +81 -42
- package/dist/chunk-22KZOAGL.cjs.map +1 -0
- package/dist/chunk-2P26SZX5.cjs +414 -0
- package/dist/chunk-2P26SZX5.cjs.map +1 -0
- package/dist/{chunk-CVPB2N3Z.cjs → chunk-3INXNDV7.cjs} +102 -4
- package/dist/chunk-3INXNDV7.cjs.map +1 -0
- package/dist/{chunk-7XKHDXCL.cjs → chunk-3U7X6JZN.cjs} +13 -12
- package/dist/chunk-3U7X6JZN.cjs.map +1 -0
- package/dist/chunk-4GKTOVFM.cjs +8 -0
- package/dist/chunk-4GKTOVFM.cjs.map +1 -0
- package/dist/{chunk-HRBBNODV.js → chunk-6GVFJLDL.js} +4 -3
- package/dist/chunk-6GVFJLDL.js.map +1 -0
- package/dist/{chunk-NO6XHX4R.js → chunk-6MPZHFIS.js} +99 -6
- package/dist/chunk-6MPZHFIS.js.map +1 -0
- package/dist/{chunk-4FDNVNJE.js → chunk-7XMTVYS5.js} +3 -76
- package/dist/chunk-7XMTVYS5.js.map +1 -0
- package/dist/{chunk-QDEWBBUR.js → chunk-DUXX6CBX.js} +12 -143
- package/dist/chunk-DUXX6CBX.js.map +1 -0
- package/dist/chunk-EAYEZXWT.js +388 -0
- package/dist/chunk-EAYEZXWT.js.map +1 -0
- package/dist/chunk-GILUVQQJ.js +6 -0
- package/dist/chunk-GILUVQQJ.js.map +1 -0
- package/dist/{chunk-KIYNOOPJ.js → chunk-GTDKDD7Y.js} +12 -6
- package/dist/chunk-GTDKDD7Y.js.map +1 -0
- package/dist/{chunk-TLVX5PXD.cjs → chunk-IUCNJAHW.cjs} +13 -7
- package/dist/chunk-IUCNJAHW.cjs.map +1 -0
- package/dist/{chunk-ZFIXQRBZ.cjs → chunk-KUBZVWME.cjs} +2 -80
- package/dist/chunk-KUBZVWME.cjs.map +1 -0
- package/dist/{chunk-JKCR6WRZ.cjs → chunk-NMWKXAYA.cjs} +2 -2
- package/dist/{chunk-JKCR6WRZ.cjs.map → chunk-NMWKXAYA.cjs.map} +1 -1
- package/dist/{chunk-LK2CZK5U.cjs → chunk-PWWM7Q3T.cjs} +7 -7
- package/dist/{chunk-LK2CZK5U.cjs.map → chunk-PWWM7Q3T.cjs.map} +1 -1
- package/dist/{chunk-N7TOWXDJ.js → chunk-QDUTMOF4.js} +3 -3
- package/dist/{chunk-N7TOWXDJ.js.map → chunk-QDUTMOF4.js.map} +1 -1
- package/dist/{chunk-MENBHEAY.cjs → chunk-WRM52ZBN.cjs} +19 -161
- package/dist/chunk-WRM52ZBN.cjs.map +1 -0
- package/dist/chunk-XIWWDGT5.cjs +86 -0
- package/dist/chunk-XIWWDGT5.cjs.map +1 -0
- package/dist/{chunk-CEPVQQVO.js → chunk-XRLOMTBZ.js} +2 -2
- package/dist/{chunk-CEPVQQVO.js.map → chunk-XRLOMTBZ.js.map} +1 -1
- package/dist/{chunk-QBEZMR2F.js → chunk-XU54YJXQ.js} +54 -15
- package/dist/chunk-XU54YJXQ.js.map +1 -0
- package/dist/chunk-Z3SZXWRU.js +80 -0
- package/dist/chunk-Z3SZXWRU.js.map +1 -0
- package/dist/entries/assembly.cjs +26 -25
- package/dist/entries/assembly.d.cts +32 -4
- package/dist/entries/assembly.d.ts +32 -4
- package/dist/entries/assembly.js +5 -4
- package/dist/entries/doctrine.cjs +46 -46
- package/dist/entries/doctrine.d.cts +3 -3
- package/dist/entries/doctrine.d.ts +3 -3
- package/dist/entries/doctrine.js +1 -1
- package/dist/entries/picker-catalogs.cjs +42 -42
- package/dist/entries/picker-catalogs.js +3 -3
- package/dist/entries/presets.cjs +49 -26
- package/dist/entries/presets.d.cts +51 -1
- package/dist/entries/presets.d.ts +51 -1
- package/dist/entries/presets.js +4 -1
- package/dist/entries/prompt-builder.cjs +135 -98
- package/dist/entries/prompt-builder.d.cts +22 -11
- package/dist/entries/prompt-builder.d.ts +22 -11
- package/dist/entries/prompt-builder.js +4 -3
- package/dist/entries/prompt-fields.cjs +41 -40
- package/dist/entries/prompt-fields.js +2 -1
- package/dist/index.cjs +331 -273
- package/dist/index.d.cts +4 -4
- package/dist/index.d.ts +4 -4
- package/dist/index.js +11 -9
- package/dist/{subject-registry-BUswuEVD.d.cts → subject-registry-CQi_CZfJ.d.cts} +78 -9
- package/dist/{subject-registry-D7V8PEG-.d.ts → subject-registry-DFiGx49v.d.ts} +78 -9
- package/package.json +2 -2
- package/src/__tests__/assemble-image-input-style-references.test.ts +173 -0
- package/src/__tests__/catalog-id-guard.test.ts +30 -0
- package/src/__tests__/factory-preset-previews.test.ts +123 -0
- package/src/__tests__/factory-preset-references.test.ts +222 -0
- package/src/__tests__/user-direction-refs.test.ts +180 -0
- package/src/assemble-image-input.ts +114 -13
- package/src/catalog-id-guard.ts +18 -2
- package/src/color-names.ts +192 -0
- package/src/direction-registry.ts +66 -5
- package/src/entries/prompt-builder.ts +2 -0
- package/src/factory-presets/generate-image.ts +29 -0
- package/src/factory-presets/index.ts +2 -0
- package/src/factory-presets/preview-files.generated.ts +4 -0
- package/src/factory-presets/previews.ts +40 -0
- package/src/factory-presets/references.ts +80 -0
- package/src/factory-presets/shared-image.ts +4 -0
- package/src/factory-presets/types.ts +8 -0
- package/src/image-reference-doctrine.ts +3 -3
- package/src/image-token-pattern.ts +13 -0
- package/src/prompt-builder.ts +4 -5
- package/src/prompt-style-section.ts +3 -3
- package/src/user-direction-refs.ts +110 -0
- package/dist/chunk-4FDNVNJE.js.map +0 -1
- package/dist/chunk-7XKHDXCL.cjs.map +0 -1
- package/dist/chunk-CVPB2N3Z.cjs.map +0 -1
- package/dist/chunk-HRBBNODV.js.map +0 -1
- package/dist/chunk-KIYNOOPJ.js.map +0 -1
- package/dist/chunk-LVSH7K7R.cjs.map +0 -1
- package/dist/chunk-MENBHEAY.cjs.map +0 -1
- package/dist/chunk-NO6XHX4R.js.map +0 -1
- package/dist/chunk-QBEZMR2F.js.map +0 -1
- package/dist/chunk-QDEWBBUR.js.map +0 -1
- package/dist/chunk-TLVX5PXD.cjs.map +0 -1
- package/dist/chunk-UJKFHPZ7.js +0 -37
- package/dist/chunk-UJKFHPZ7.js.map +0 -1
- package/dist/chunk-W5SCZIOB.cjs +0 -43
- package/dist/chunk-W5SCZIOB.cjs.map +0 -1
- package/dist/chunk-ZFIXQRBZ.cjs.map +0 -1
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkWRM52ZBN_cjs = require('./chunk-WRM52ZBN.cjs');
|
|
4
4
|
var chunkXUZXBY75_cjs = require('./chunk-XUZXBY75.cjs');
|
|
5
5
|
var chunk2NJTFCKQ_cjs = require('./chunk-2NJTFCKQ.cjs');
|
|
6
|
-
var
|
|
6
|
+
var chunkPWWM7Q3T_cjs = require('./chunk-PWWM7Q3T.cjs');
|
|
7
|
+
var chunk2P26SZX5_cjs = require('./chunk-2P26SZX5.cjs');
|
|
7
8
|
var chunkMQEXFCNU_cjs = require('./chunk-MQEXFCNU.cjs');
|
|
8
9
|
var entities = require('@nodaro/shared/entities');
|
|
9
10
|
var models = require('@nodaro/shared/models');
|
|
@@ -62,11 +63,11 @@ function resolveRefIdTokens(prompt, ctx) {
|
|
|
62
63
|
var REFERENCE_TOKEN_RE = /\{(image|video|audio):(\d+)(?::([a-zA-Z0-9_ -]+))?\}/gi;
|
|
63
64
|
function resolveReferenceTokens(prompt, counts) {
|
|
64
65
|
if (!prompt) return prompt;
|
|
65
|
-
return
|
|
66
|
+
return chunkWRM52ZBN_cjs.tidyReferenceTokenGaps(
|
|
66
67
|
prompt.replace(REFERENCE_TOKEN_RE, (_match, rawKind, nStr, label) => {
|
|
67
68
|
const kind = rawKind.toLowerCase();
|
|
68
69
|
const n = parseInt(nStr, 10);
|
|
69
|
-
if (n < 1 || n > counts[kind]) return
|
|
70
|
+
if (n < 1 || n > counts[kind]) return chunkWRM52ZBN_cjs.unboundReferenceTokenText(label);
|
|
70
71
|
if (label) return REF_BINDING[kind](label, n);
|
|
71
72
|
return `@${kind}_${n}`;
|
|
72
73
|
})
|
|
@@ -125,7 +126,7 @@ function resolveVideoCharacterMentionsHybrid(prompt, tokens, refs, offset) {
|
|
|
125
126
|
const binding = bindingFor(m.url);
|
|
126
127
|
const lock = chunk2NJTFCKQ_cjs.buildIdentityLockLine(chunk2NJTFCKQ_cjs.withForcedIdentityLock(ref, lockOverrideByUrl.get(m.url)), binding);
|
|
127
128
|
if (lock) lockLines.push(lock);
|
|
128
|
-
const overrideLine =
|
|
129
|
+
const overrideLine = chunkWRM52ZBN_cjs.referenceDescriptionLine(binding, ref.descriptionOverride);
|
|
129
130
|
if (overrideLine) elementDirectives.push(overrideLine);
|
|
130
131
|
const inject = ref.elementInjection?.trim();
|
|
131
132
|
if (inject) elementDirectives.push(inject);
|
|
@@ -153,8 +154,8 @@ function resolveVideoReferenceCore(args) {
|
|
|
153
154
|
audio: args.audioRefCount ?? 0
|
|
154
155
|
});
|
|
155
156
|
const describedAndCaptionLines = [
|
|
156
|
-
...
|
|
157
|
-
...
|
|
157
|
+
...chunkWRM52ZBN_cjs.renderDescribedReferenceLines(args.describedReferences),
|
|
158
|
+
...chunkWRM52ZBN_cjs.renderReferenceCaptionLines(args.videoCaptions, args.audioCaptions, {
|
|
158
159
|
video: args.videoRefCount ?? 0,
|
|
159
160
|
audio: args.audioRefCount ?? 0
|
|
160
161
|
})
|
|
@@ -191,7 +192,7 @@ function resolveVideoReferenceCore(args) {
|
|
|
191
192
|
// Described references and rail captions are the ONE thing this branch can
|
|
192
193
|
// still contribute: they need no seat, so a request that carries only them
|
|
193
194
|
// (a story landing before any entity exists) reaches the model here.
|
|
194
|
-
prompt: describedAndCaptionLines.length > 0 ?
|
|
195
|
+
prompt: describedAndCaptionLines.length > 0 ? chunkWRM52ZBN_cjs.appendReferenceLines(resolved2 ?? "", describedAndCaptionLines, args.hybridRoles === true ? "hybrid" : "legacy") : resolved2,
|
|
195
196
|
additionalUrls: [...leadingRefUrls]
|
|
196
197
|
};
|
|
197
198
|
}
|
|
@@ -212,7 +213,7 @@ function resolveVideoReferenceCore(args) {
|
|
|
212
213
|
mentionLockLines = h.lockLines;
|
|
213
214
|
mentionElementDirectives = h.elementDirectives;
|
|
214
215
|
} else {
|
|
215
|
-
resolved = mentionTokens.length > 0 ?
|
|
216
|
+
resolved = mentionTokens.length > 0 ? chunkWRM52ZBN_cjs.resolveCharacterMentions(promptForResolution, mentionTokens, wiredCharRefs) : { prompt: promptForResolution, additionalUrls: [], mentionedCharacterSlugs: /* @__PURE__ */ new Set() };
|
|
216
217
|
}
|
|
217
218
|
const fallbackUrls = [];
|
|
218
219
|
const fallbackDirectiveLines = [];
|
|
@@ -249,7 +250,7 @@ function resolveVideoReferenceCore(args) {
|
|
|
249
250
|
canonicalPhrases.push(entities.roleToPhrase(entities.resolveDefaultRole(r.defaultRole, r.defaultUsageMode, r.source), binding));
|
|
250
251
|
const lock = chunk2NJTFCKQ_cjs.buildIdentityLockLine(r, binding);
|
|
251
252
|
if (lock) canonicalLockLines.push(lock);
|
|
252
|
-
const overrideLine =
|
|
253
|
+
const overrideLine = chunkWRM52ZBN_cjs.referenceDescriptionLine(binding, r.descriptionOverride);
|
|
253
254
|
if (overrideLine) canonicalElementDirectives.push(overrideLine);
|
|
254
255
|
const inject = r.elementInjection?.trim();
|
|
255
256
|
if (inject) canonicalElementDirectives.push(inject);
|
|
@@ -381,7 +382,7 @@ function resolveVideoReferenceCore(args) {
|
|
|
381
382
|
const lockBlock = lockLines.length > 0 ? `${lockLines.join("\n")}
|
|
382
383
|
|
|
383
384
|
` : "";
|
|
384
|
-
finalPrompt = `${lockBlock}${
|
|
385
|
+
finalPrompt = `${lockBlock}${chunkWRM52ZBN_cjs.insertBeforeStyleSection(finalPrompt, trailingLines)}`;
|
|
385
386
|
} else {
|
|
386
387
|
const allFallbackLines = [...fallbackDirectiveLines, ...extraDirectiveLines];
|
|
387
388
|
if (allFallbackLines.length > 0) {
|
|
@@ -431,7 +432,7 @@ ${finalPrompt}` : block;
|
|
|
431
432
|
merged.push(u);
|
|
432
433
|
}
|
|
433
434
|
}
|
|
434
|
-
finalPrompt =
|
|
435
|
+
finalPrompt = chunkWRM52ZBN_cjs.appendReferenceLines(
|
|
435
436
|
finalPrompt,
|
|
436
437
|
describedAndCaptionLines,
|
|
437
438
|
hybrid ? "hybrid" : "legacy"
|
|
@@ -459,7 +460,7 @@ ${finalPrompt}` : block;
|
|
|
459
460
|
});
|
|
460
461
|
}
|
|
461
462
|
}
|
|
462
|
-
const reordered =
|
|
463
|
+
const reordered = chunkWRM52ZBN_cjs.applyReferenceOrderToVideo(assetUrls, finalPrompt, refsForOrdering, referenceOrder, void 0, offset);
|
|
463
464
|
return {
|
|
464
465
|
prompt: resolveReferenceTokens(reordered.prompt, tokenCounts(merged.length)),
|
|
465
466
|
additionalUrls: [...leadingRefUrls, ...reordered.urls]
|
|
@@ -513,7 +514,7 @@ function composeSoundHintFromConnections(consumer, consumerType, ctx) {
|
|
|
513
514
|
continue;
|
|
514
515
|
}
|
|
515
516
|
}
|
|
516
|
-
const hint =
|
|
517
|
+
const hint = chunkPWWM7Q3T_cjs.getParameterPromptHint(src);
|
|
517
518
|
if (hint) acceptedHints.push(hint);
|
|
518
519
|
if ((consumerType === "suno-generate" || consumerType === "generate-music") && t === "voice-character" && src.data) {
|
|
519
520
|
const gender = src.data.gender;
|
|
@@ -618,35 +619,78 @@ function assembleSunoInput(input) {
|
|
|
618
619
|
...input.persona ?? {}
|
|
619
620
|
};
|
|
620
621
|
}
|
|
621
|
-
|
|
622
|
-
// src/assemble-image-input.ts
|
|
623
|
-
function renderImageHintPieces(subject, direction, structured) {
|
|
622
|
+
function renderImageHintPieces(subject, direction, structured, directionRefs) {
|
|
624
623
|
return {
|
|
625
624
|
hintClauses: [
|
|
626
|
-
...
|
|
627
|
-
|
|
625
|
+
...chunkWRM52ZBN_cjs.asBodyClauses(
|
|
626
|
+
chunkWRM52ZBN_cjs.renderSubjectHints(subject, {
|
|
628
627
|
surface: "image",
|
|
629
|
-
mode:
|
|
628
|
+
mode: chunkWRM52ZBN_cjs.SUBJECT_IMAGE_HINT_MODE_DEFAULT
|
|
630
629
|
})
|
|
631
630
|
),
|
|
632
|
-
...
|
|
631
|
+
...chunkWRM52ZBN_cjs.partitionStyleClauses(direction, {
|
|
633
632
|
surface: "image",
|
|
634
|
-
mode:
|
|
633
|
+
mode: chunk2P26SZX5_cjs.IMAGE_HINT_MODE_DEFAULT,
|
|
634
|
+
...directionRefs !== void 0 ? { refs: directionRefs } : {}
|
|
635
635
|
})
|
|
636
636
|
].filter((c) => c.text.length > 0),
|
|
637
|
-
structuredFragment: structured ?
|
|
637
|
+
structuredFragment: structured ? chunkWRM52ZBN_cjs.renderStructuredFields(structured) : ""
|
|
638
638
|
};
|
|
639
639
|
}
|
|
640
640
|
function composePromptText(userPrompt, pieces, keptHintClauses) {
|
|
641
|
-
return
|
|
641
|
+
return chunkWRM52ZBN_cjs.composeSectionedPrompt(
|
|
642
642
|
userPrompt,
|
|
643
643
|
pieces.hintClauses.slice(0, keptHintClauses),
|
|
644
644
|
pieces.structuredFragment
|
|
645
645
|
);
|
|
646
646
|
}
|
|
647
647
|
function assembleImageInput(input) {
|
|
648
|
-
const
|
|
649
|
-
const
|
|
648
|
+
const style = input.styleReferences;
|
|
649
|
+
const result = style !== void 0 && style.length > 0 ? fillStyleReferences(input, style) : assembleOnce(input);
|
|
650
|
+
if (input.throwOnEmpty && !result.prompt.trim()) {
|
|
651
|
+
throw new Error(
|
|
652
|
+
"No prompt \u2014 type one, bind a character, or pick a cinematography direction"
|
|
653
|
+
);
|
|
654
|
+
}
|
|
655
|
+
return result;
|
|
656
|
+
}
|
|
657
|
+
function fillStyleReferences(input, style) {
|
|
658
|
+
const base = assembleOnce(input);
|
|
659
|
+
const own = base.referenceImageUrls ?? [];
|
|
660
|
+
const seats = models.imageReferenceLimit(input.provider) - own.length;
|
|
661
|
+
const seen = new Set(own);
|
|
662
|
+
const candidates = [];
|
|
663
|
+
for (const s of style) {
|
|
664
|
+
if (typeof s.url !== "string" || s.url.length === 0 || seen.has(s.url)) continue;
|
|
665
|
+
seen.add(s.url);
|
|
666
|
+
candidates.push(s);
|
|
667
|
+
}
|
|
668
|
+
for (let k = Math.min(seats, candidates.length); k > 0; k--) {
|
|
669
|
+
const extras = candidates.slice(0, k).map(styleConnectedReference);
|
|
670
|
+
const filled = assembleOnce({
|
|
671
|
+
...input,
|
|
672
|
+
connectedReferences: [...input.connectedReferences ?? [], ...extras]
|
|
673
|
+
});
|
|
674
|
+
const urls = filled.referenceImageUrls ?? [];
|
|
675
|
+
const keepsOwn = urls.length === own.length + k && own.every((url, i) => urls[i] === url) && extras.every((ref, j) => urls[own.length + j] === ref.url);
|
|
676
|
+
if (keepsOwn) return { ...filled, styleReferencesSent: k };
|
|
677
|
+
}
|
|
678
|
+
return { ...base, styleReferencesSent: 0 };
|
|
679
|
+
}
|
|
680
|
+
function styleConnectedReference(s, index) {
|
|
681
|
+
return {
|
|
682
|
+
id: `style-reference-${index + 1}`,
|
|
683
|
+
defaultName: `Style reference ${index + 1}`,
|
|
684
|
+
source: "manual",
|
|
685
|
+
url: s.url,
|
|
686
|
+
isExtraRef: true,
|
|
687
|
+
defaultRole: "style",
|
|
688
|
+
description: chunk2P26SZX5_cjs.styleReferenceDescription(index, s.caption)
|
|
689
|
+
};
|
|
690
|
+
}
|
|
691
|
+
function assembleOnce(input) {
|
|
692
|
+
const pieces = renderImageHintPieces(input.subject, input.direction, input.structured, input.directionRefs);
|
|
693
|
+
const assembleWith = (keptHintClauses) => chunkWRM52ZBN_cjs.buildImagePromptWithOverflow({
|
|
650
694
|
prompt: composePromptText(input.userPrompt, pieces, keptHintClauses),
|
|
651
695
|
provider: input.provider,
|
|
652
696
|
...input.connectedReferences !== void 0 ? { connectedReferences: input.connectedReferences } : {},
|
|
@@ -674,7 +718,7 @@ function assembleImageInput(input) {
|
|
|
674
718
|
let kept = pieces.hintClauses.length;
|
|
675
719
|
let fitted = assembleWith(kept);
|
|
676
720
|
if (fitted.overflowChars > 0) {
|
|
677
|
-
const costs =
|
|
721
|
+
const costs = chunkWRM52ZBN_cjs.sectionedClauseCosts(
|
|
678
722
|
input.userPrompt,
|
|
679
723
|
pieces.hintClauses,
|
|
680
724
|
pieces.structuredFragment
|
|
@@ -686,30 +730,25 @@ function assembleImageInput(input) {
|
|
|
686
730
|
}
|
|
687
731
|
}
|
|
688
732
|
const { overflowChars, ...result } = fitted;
|
|
689
|
-
if (input.throwOnEmpty && !result.prompt.trim()) {
|
|
690
|
-
throw new Error(
|
|
691
|
-
"No prompt \u2014 type one, bind a character, or pick a cinematography direction"
|
|
692
|
-
);
|
|
693
|
-
}
|
|
694
733
|
return result;
|
|
695
734
|
}
|
|
696
735
|
|
|
697
736
|
// src/assemble-video-input.ts
|
|
698
737
|
function composeVideoPromptText(userPrompt, direction, structured, opts) {
|
|
699
738
|
const hintClauses = [
|
|
700
|
-
...
|
|
701
|
-
|
|
739
|
+
...chunkWRM52ZBN_cjs.asBodyClauses(
|
|
740
|
+
chunkWRM52ZBN_cjs.renderSubjectHints(opts?.subject, {
|
|
702
741
|
surface: "video",
|
|
703
|
-
mode: opts?.subjectHintMode ??
|
|
742
|
+
mode: opts?.subjectHintMode ?? chunkWRM52ZBN_cjs.SUBJECT_VIDEO_HINT_MODE_DEFAULT
|
|
704
743
|
})
|
|
705
744
|
),
|
|
706
|
-
...
|
|
745
|
+
...chunkWRM52ZBN_cjs.partitionStyleClauses(direction, {
|
|
707
746
|
surface: "video",
|
|
708
|
-
mode: opts?.hintMode ??
|
|
747
|
+
mode: opts?.hintMode ?? chunk2P26SZX5_cjs.VIDEO_HINT_MODE_DEFAULT
|
|
709
748
|
})
|
|
710
749
|
].filter((c) => c.text.length > 0);
|
|
711
|
-
const structuredFragment = structured ?
|
|
712
|
-
const composeWith = (kept2) =>
|
|
750
|
+
const structuredFragment = structured ? chunkWRM52ZBN_cjs.renderStructuredFields(structured) : "";
|
|
751
|
+
const composeWith = (kept2) => chunkWRM52ZBN_cjs.composeSectionedPrompt(userPrompt, hintClauses.slice(0, kept2), structuredFragment);
|
|
713
752
|
const cap = opts?.cap;
|
|
714
753
|
if (cap === void 0) return composeWith(hintClauses.length);
|
|
715
754
|
const frame = opts?.frame ?? ((body2) => body2);
|
|
@@ -717,7 +756,7 @@ function composeVideoPromptText(userPrompt, direction, structured, opts) {
|
|
|
717
756
|
let body = composeWith(kept);
|
|
718
757
|
let framedLength = frame(body)?.length ?? 0;
|
|
719
758
|
if (framedLength <= cap) return body;
|
|
720
|
-
const costs =
|
|
759
|
+
const costs = chunkWRM52ZBN_cjs.sectionedClauseCosts(userPrompt, hintClauses, structuredFragment);
|
|
721
760
|
const texts = hintClauses.map((c) => c.text);
|
|
722
761
|
while (framedLength > cap && kept > 0) {
|
|
723
762
|
kept = chunkXUZXBY75_cjs.keepableDirectionHints(texts, kept, framedLength - cap, costs);
|
|
@@ -911,5 +950,5 @@ exports.resolveSeedance2Inputs = resolveSeedance2Inputs;
|
|
|
911
950
|
exports.resolveVeoI2vInputs = resolveVeoI2vInputs;
|
|
912
951
|
exports.resolveVideoReferenceCore = resolveVideoReferenceCore;
|
|
913
952
|
exports.truncateForField = truncateForField;
|
|
914
|
-
//# sourceMappingURL=chunk-
|
|
915
|
-
//# sourceMappingURL=chunk-
|
|
953
|
+
//# sourceMappingURL=chunk-22KZOAGL.cjs.map
|
|
954
|
+
//# sourceMappingURL=chunk-22KZOAGL.cjs.map
|