@nodaro/prompts 1.11.0 → 1.13.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/index.cjs +627 -177
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +726 -33
- package/dist/index.d.ts +726 -33
- package/dist/index.js +598 -179
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
- package/src/__tests__/__snapshots__/entity-convergence-image.test.ts.snap +19 -0
- package/src/__tests__/animal-getters-parity.test.ts +82 -0
- package/src/__tests__/assemble-image-input-cap.test.ts +236 -0
- package/src/__tests__/assemble-image-input.test.ts +100 -19
- package/src/__tests__/assemble-video-input-cap.test.ts +442 -0
- package/src/__tests__/assemble-video-input.test.ts +167 -33
- package/src/__tests__/direction-hint-token-safety.test.ts +21 -0
- package/src/__tests__/entity-convergence-image.test.ts +374 -0
- package/src/__tests__/location-convergence-image.test.ts +29 -1
- package/src/__tests__/location-default-role-image.test.ts +166 -0
- package/src/__tests__/mention-splice-spacing.test.ts +257 -0
- package/src/__tests__/prompt-style-section.test.ts +345 -0
- package/src/__tests__/read-node-subject.test.ts +140 -0
- package/src/__tests__/style-section-boundary.test.ts +179 -0
- package/src/__tests__/subject-fold.test.ts +251 -0
- package/src/__tests__/subject-registry.test.ts +312 -0
- package/src/assemble-image-input.ts +169 -41
- package/src/assemble-video-input.ts +200 -25
- package/src/direction-registry.ts +116 -28
- package/src/hint-shedding.ts +87 -0
- package/src/index.ts +3 -0
- package/src/parameter-prompt-hint.ts +8 -7
- package/src/picker-catalogs.ts +14 -7
- package/src/prompt-builder.ts +628 -88
- package/src/prompt-hint-join.ts +9 -0
- package/src/prompt-style-section.ts +256 -0
- package/src/read-node-direction.ts +60 -1
- package/src/subject-registry.ts +464 -0
- package/src/video-reference-resolver.ts +5 -2
package/src/picker-catalogs.ts
CHANGED
|
@@ -69,7 +69,7 @@ import {
|
|
|
69
69
|
} from "./character-fx.js"
|
|
70
70
|
import { POSES, POSE_CATEGORY_LABELS, POSE_CATEGORY_ORDER } from "./pose.js"
|
|
71
71
|
import { MATERIALS, MATERIAL_CATEGORY_LABELS, MATERIAL_CATEGORY_ORDER } from "./materials.js"
|
|
72
|
-
import { ANIMALS, ANIMAL_SUBCATEGORY_LABELS, ANIMAL_SUBCATEGORY_ORDER } from "@nodaro/shared"
|
|
72
|
+
import { ANIMALS, ANIMAL_SUBCATEGORY_LABELS, ANIMAL_SUBCATEGORY_ORDER, getAnimalPromptHint } from "@nodaro/shared"
|
|
73
73
|
import { VEHICLES, VEHICLE_SUBCATEGORY_LABELS, VEHICLE_SUBCATEGORY_ORDER } from "@nodaro/shared"
|
|
74
74
|
import { WEAPONS, WEAPON_SUBCATEGORY_LABELS, WEAPON_SUBCATEGORY_ORDER } from "@nodaro/shared"
|
|
75
75
|
import { FURNITURE, FURNITURE_SUBCATEGORY_LABELS, FURNITURE_SUBCATEGORY_ORDER } from "@nodaro/shared"
|
|
@@ -193,6 +193,13 @@ function toOptions<T extends BaseCatalogEntry>(
|
|
|
193
193
|
* label + description. Reproduce the exact phrasing from
|
|
194
194
|
* `getParameterPromptHint` so the registry stays faithful + every option's
|
|
195
195
|
* `promptHint` is non-empty.
|
|
196
|
+
*
|
|
197
|
+
* ANIMALS is the exception, and the direction of travel for the other three:
|
|
198
|
+
* its phrasing now has ONE owner, `@nodaro/shared`'s `getAnimalPromptHint`,
|
|
199
|
+
* which this funnel and `getParameterPromptHint` both call instead of
|
|
200
|
+
* re-authoring the sentence. `phrase` therefore takes the ENTRY (not
|
|
201
|
+
* label+description), so a catalog whose phrasing has moved to a getter can be
|
|
202
|
+
* pointed at it.
|
|
196
203
|
*/
|
|
197
204
|
interface ObjectCatalogEntry {
|
|
198
205
|
readonly id: string
|
|
@@ -204,14 +211,14 @@ interface ObjectCatalogEntry {
|
|
|
204
211
|
}
|
|
205
212
|
function objectOptions(
|
|
206
213
|
arr: ReadonlyArray<ObjectCatalogEntry>,
|
|
207
|
-
phrase: (
|
|
214
|
+
phrase: (entry: ObjectCatalogEntry) => string,
|
|
208
215
|
): ReadonlyArray<PickerOption> {
|
|
209
216
|
return arr.map((e) => ({
|
|
210
217
|
id: e.id,
|
|
211
218
|
label: e.label,
|
|
212
219
|
description: e.description,
|
|
213
220
|
category: e.subcategory,
|
|
214
|
-
promptHint: phrase(e
|
|
221
|
+
promptHint: phrase(e),
|
|
215
222
|
// Object entities have no `promptHint` field of their own (it is
|
|
216
223
|
// synthesized above), so the term cannot come from `resolveTerm`'s
|
|
217
224
|
// empty-hint rule: an authored `term` wins, and otherwise the label IS the
|
|
@@ -608,7 +615,7 @@ const SINGLE_CATALOGS: readonly PickerCatalog[] = [
|
|
|
608
615
|
defaultValue: "dog-golden-retriever",
|
|
609
616
|
categoryOrder: ANIMAL_SUBCATEGORY_ORDER,
|
|
610
617
|
categoryLabels: ANIMAL_SUBCATEGORY_LABELS,
|
|
611
|
-
options: objectOptions(ANIMALS, (
|
|
618
|
+
options: objectOptions(ANIMALS, (e) => getAnimalPromptHint(e.id)),
|
|
612
619
|
},
|
|
613
620
|
{
|
|
614
621
|
nodeType: "vehicle",
|
|
@@ -619,7 +626,7 @@ const SINGLE_CATALOGS: readonly PickerCatalog[] = [
|
|
|
619
626
|
defaultValue: "sedan",
|
|
620
627
|
categoryOrder: VEHICLE_SUBCATEGORY_ORDER,
|
|
621
628
|
categoryLabels: VEHICLE_SUBCATEGORY_LABELS,
|
|
622
|
-
options: objectOptions(VEHICLES, (
|
|
629
|
+
options: objectOptions(VEHICLES, (e) => `featuring a ${e.label.toLowerCase()}, ${e.description}`),
|
|
623
630
|
},
|
|
624
631
|
{
|
|
625
632
|
nodeType: "weapon",
|
|
@@ -630,7 +637,7 @@ const SINGLE_CATALOGS: readonly PickerCatalog[] = [
|
|
|
630
637
|
defaultValue: "katana",
|
|
631
638
|
categoryOrder: WEAPON_SUBCATEGORY_ORDER,
|
|
632
639
|
categoryLabels: WEAPON_SUBCATEGORY_LABELS,
|
|
633
|
-
options: objectOptions(WEAPONS, (
|
|
640
|
+
options: objectOptions(WEAPONS, (e) => `with a ${e.label.toLowerCase()}, ${e.description}`),
|
|
634
641
|
},
|
|
635
642
|
{
|
|
636
643
|
nodeType: "furniture",
|
|
@@ -641,7 +648,7 @@ const SINGLE_CATALOGS: readonly PickerCatalog[] = [
|
|
|
641
648
|
defaultValue: "sofa",
|
|
642
649
|
categoryOrder: FURNITURE_SUBCATEGORY_ORDER,
|
|
643
650
|
categoryLabels: FURNITURE_SUBCATEGORY_LABELS,
|
|
644
|
-
options: objectOptions(FURNITURE, (
|
|
651
|
+
options: objectOptions(FURNITURE, (e) => `including a ${e.label.toLowerCase()}, ${e.description}`),
|
|
645
652
|
},
|
|
646
653
|
{
|
|
647
654
|
nodeType: "held-prop",
|